Downloads · 30 days
0
Nihal108-bi/emotion-support-chatbot
emotion-support-chatbot is a machine learning model from Nihal108-bi. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Mar 13, 2026
Repo size
34.3 MB
Likes
0
Public
Click a slice to open those files.
.csv20.7 MB · 54%
From the Hugging Face model README
This project documents the end-to-end design, development, and evaluation of an emotion-aware conversational AI system built using open-source large language models and publicly available emotional-support datasets.
The primary objective was to create a chatbot capable of generating empathetic, context-aware, supportive, and safe responses for users experiencing emotional distress — while operating under severe hardware constraints (Google Colab T4 GPU, limited VRAM, RAM caps, storage limits, and session timeouts).
Rather than focusing purely on model performance, this work emphasizes the real engineering challenges of training large language models on constrained resources, including dataset processing, memory optimization, runtime stability, and deployment feasibility.
This project reflects extensive experimentation, iterative problem-solving, and practical machine learning engineering under real-world limitations.
Generic conversational models often produce fluent text but fail in emotionally sensitive contexts. In mental-health-related interactions, responses must be:
The goal of this project was to fine-tune a model specifically for emotional support dialogue while minimizing harmful or unsafe outputs.
An open-source ~7B parameter language model was selected as the foundation:
Base Model: mistralai/Mistral-7B-v0.1
This size offers strong conversational ability while remaining marginally trainable on a single consumer GPU using parameter-efficient techniques.
Training was performed using QLoRA (Quantized Low-Rank Adaptation):
This approach enables tuning large models without requiring high-end hardware.
Two public emotional-support datasets were merged.
A large corpus of emotionally grounded conversations.
Key properties:
Fields used:
prompt → user situationutterance → assistant responsecontext → emotion categoryLoaded rows: 76,673
Counseling-style multi-turn conversations.
Characteristics:
Processing required parsing nested dialogue turns and extracting valid user → system exchanges.
Loaded conversations: 910
A significant portion of the project involved building a robust preprocessing pipeline to unify heterogeneous datasets.
Initial inspection revealed:
Each training sample was converted into:
User message → Assistant response
promptutteranceusr → sys turnsAll samples were transformed into a consistent format:
User: <message>
Assistant: <reply>
Operations included:
_comma_)Potentially harmful content was removed before training, including:
Duplicate conversation pairs were removed to reduce memorization bias and improve generalization.
Final supervised training format:
### Instruction:
The user is feeling <emotion>. Provide emotional support.
### User:
User: <message>
### Assistant:
<response>
Emotion labels were incorporated when available to improve emotional awareness.
After preprocessing:
The dominant challenge of this project was not model design but hardware limitations.
Training large language models on free cloud resources required extensive experimentation and compromise.
Training on the full dataset (~86k samples):
To achieve a stable training run, the dataset was gradually reduced:
| Stage | Dataset Size | Approx Time | Outcome |
|---|---|---|---|
| Full dataset | ~86k | ~36 hours | Not feasible |
| Reduction 1 | ~30k | ~20 hours | Still unstable |
| Reduction 2 | ~15k | High | Memory/time issues |
| Final training | ~12k | Completed | Stable |
For reproducible notebook execution:
Multiple strategies were required to prevent out-of-memory errors:
Despite these measures, repeated RAM and VRAM failures occurred during experimentation.
Quantization
LoRA
Training Arguments
Environment: Google Colab T4 GPU
Model artifacts were successfully saved and pushed to the Hugging Face Hub.
Evaluation combined automatic metrics with human judgment.
Thirty prompts were manually designed across six emotional categories:
Each response was rated on:
EQS = (Empathy + Relevance + Helpfulness) / 3
Safety Precision = Correct Crisis Overrides / Total Crisis Prompts
Unsafe Rate = Unsafe Responses / Total Prompts
The model was prepared for:
This system is not a substitute for professional mental health care. Real-world deployment would require crisis escalation mechanisms, safeguards, and human oversight.
Nihal Jaiswal AI/ML Practitioner — Machine Learning, NLP, and Generative AI Focus: Conversational AI, LLM Fine-Tuning, Safe AI Systems