CITIZEN COLLEGE PROJECT NO.: 2021-1-53-0027 A PROPOSAL ON AI CHATBOT FOR MENTAL HEALTH SUPPORT BY MD HANAN ANSARI A PROJECT PROPOSAL SUBMITTED TO THE DEPARTMENT OF BACHELOR OF COMPUTER APPLICATION IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE DEGREE OF BACHELOR OF COMPUTER APPLICATION LALITPUR, NEPAL MAY, 2025 AI chatbot for Mental Health Support by MD Hanan Ansari 2021-1-53-0027 Project Supervisor Er. Nishan Khanal A proposal submitted in partial fulfillment of the requirements for the degree of Bachelor of Computer Application Department of Bachelor of Computer Application Pokhara University, Citizen College Lalitpur, Nepal MAY, 2025 ii COPYRIGHT © The author has agreed that the library, Department of Bachelor of Computer Application, Pokhara University, Citizen College, may make this project work freely available for inspection. Moreover the author has agreed that the permission for extensive copying of this project work for scholarly purpose may be granted by the professor(s), who supervised the proposal work recorded herein or, in their absence, by the Head of the Department, wherein this project work was done. It is understood that the recognition will be given to the author of this project work and to the Department of Bachelor of Computer Application, Pokhara University, Citizen College in any use of the material of this project work. Copying of publication or other use of this project work for financial gain without approval of the Department of Bachelor of Computer Application, Pokhara University, Citizen College and author’s written permission is prohibited. Request for permission to copy or to make any use of the material in this project proposal in whole or part should be addressed to: Head Department of Bachelor of Computer Application Citizen College Kumaripati, Lalitpur, Nepal Affiliated to Pokhara University iii DECLARATION I declare that the work hereby submitted for Bachelor of Computer Application at the Pokhara University, Citizen College entitled ”AI chatbot for Mental Health Support” is my own work and has not been previously submitted by me at any university for any academic award. I authorize the Pokhara University, Citizen College to lend this project work to other institutions or individuals for the purpose of scholarly research. MD Hanan Ansari 2021-1-53-0027 MAY, 2025 iv RECOMMENDATION The undersigned certify that he has read and recommend to the Department of Bachelor of Computer Application for acceptance, a proposal entitled “AI chatbot for Mental Health Support”, submitted by ”MD Hanan Ansari” in partial fulfillment of the requirement for the award of the degree of “Bachelor of Computer Application”. Project Supervisor Er. Nishan Khanal Lecturer/Researcher BCA Program Coordinator Er. Nishan Khanal Department of Bachelor of Computer Application, Citizen College MAY, 2025 v DEPARTMENTAL ACCEPTANCE The proposal entitled “AI chatbot for Mental Health Support”, submitted by MD Hanan Ansari in partial fulfillment of the requirement for the award of the degree of “Bachelor of Computer Application” has been accepted as a genuine record of work independently carried out by the student in the department. Head of the Department Department of Bachelor of Computer Application, Citizen College. MAY, 2025 vi ACKNOWLEDGMENT This proposal work would not have been possible without the guidance and the help of several individuals who in one way or another contributed and extended their valuable assistance in the preparation and completion of this study. First of all, I would like to express my sincere gratitude to my supervisor, Er. Nishan Khanal, of Citizen College for providing invaluable guidance, insightful comments, meticulous suggestions, and encouragement throughout the duration of this proposal work. My sincere thanks also goes to the BCA Coordinator, Er. Nishan Khanal, for coordinating the proposal works, providing astute criticism, and having inexhaustible patience. I am also grateful to my classmates and friends for offering me advice and moral support. To my family, thank you for encouraging me in all of my pursuits and inspiring me to follow my dreams. I am especially grateful to my parents, who supported me emotionally, believed in me and wanted the best for me. MD Hanan Ansari 2021-1-53-0027 MAY, 2025 vii ABSTRACT Mental health challenges like anxiety, loneliness, and academic pressure are increasingly impacting youth in Nepal, often worsened by societal stigma, migration, and restricted availability of mental health experts. Drawing from the development of AI-driven chatbots, beginning with ELIZA in 1966 and most recently transformer models such as FLAN-T5 created by Google in 2022, this project presents an AI-enhanced mental health support chatbot specifically designed for the Nepalese setting. The chatbot will utilize the FLAN-T5-small model and will be fine-tuned on a unique dataset comprising more than 2000 entries that capture culturally significant emotional experiences. The system will interact with users in compassionate, text-driven dialogues. It will start with friendly greetings, invites users to share their emotions, and then offers reassuring replies based on the provided input. The chatbot can comprehend typical emotional conditions and reply with context-aware, unbiased messages. Assessment metrics like ROUGE-L, BLEU , and METEOR wil suggest that the model produces fairly coherent and emotionally suitable replies. Nonetheless, the existing implementation has several restrictions. It won’t be substitute for professional counseling or emergency assistance systems. In spite of these limitations, the chatbot will act as a hopeful initial digital partner for people facing emotional challenges. Keywords: Chatbot, FLAN-T5, Mental Health, Nepal, NLP viii TABLE OF CONTENTS COPYRIGHT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii DECLARATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv RECOMMENDATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v DEPARTMENTAL ACCEPTANCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi ACKNOWLEDGMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii ABSTRACT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii TABLE OF CONTENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix LIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi LIST OF TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii LIST OF ABBREVIATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii 1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.3 Problem Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.4 Project Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.5 Scope of Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.6 Feasibility Study. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.6.1 Technical Feasibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.6.2 Economic Feasibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.6.3 Ethical Feasibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.6.4 Social Feasibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.6.5 Operational Feasibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.7 Potential Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.7.1 Chat-based Mental Health Support for Nepalese Students . . . . . . . 6 1.7.2 Emotional Wellbeing Tools Integrated into Educational Platforms 6 1.7.3 Digital Companions for Individuals in Rural Communities . . . . . . 7 1.7.4 First-line Emotional Support Prior to Professional Counseling . . . 7 1.8 Originality of Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 ix 1.9 Organisation of Project Proposal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 LITERATURE REVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 x LIST OF FIGURES Figure 1.1 Motivation Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi 2 LIST OF TABLES xii LIST OF ABBREVIATIONS AI Artificial Intelligence BLEU Bilingual Evaluation Understudy CBT Cognitive Behavioral Therapy CLI Command Line Interface FLAN-T5 Fine-Tuned Language Net T5 Model LMS Learning Management Systems METEOR Metric for Evaluation of Translation with Explicit ORdering NLG Natural Language Generation NLP Natural Language Processing ROUGE Recall-Oriented Understudy for Gisting Evaluation Seq2Seq Sequence-to-Sequence T5 Text-To-Text Transfer Transformer xiii 1 INTRODUCTION Mental health is an essential aspect of overall well-being, but it continues to be a largely neglected concern in various regions globally, including Nepal. In a nation where cultural standards, social pressures, and restricted access to mental health services frequently label emotional difficulties, those experiencing mental health issues often feel alone and lack sufficient support. This initiative seeks to close this divide by utilizing artificial intelligence to develop a chatbot specifically intended to offer compassionate, culturally appropriate, and accessible mental health assistance. The chatbot will been trained using a dataset of 2,000 entries that represent real-life situations specific to the Nepali context. These entries will cover a broad spectrum of issues, including academic stress, family demands, migration-related anxiety, relationship challenges, and health issues. Every entry will feature user expressions, emotional conditions, contextual classifications, encouraging replies, and follow-up inquiries, allowing the chatbot to comprehend and tackle various emotional challenges proficiently. The chatbot will utilize the FLANT5-small language model, which will been specially fine-tuned on a tailored dataset containing more than 2000 input-response pairs .The chatbot will integrates sophisticated natural language processing methods with culturally aware content, promoting open conversations while enabling users to make small, practical moves to enhance their mental health.This proposal offers a complete overview of the project, outlining the dataset, preprocessing steps, model structure, training procedure, and assessment metrics. 1.1 Background The idea of mental health chatbots began in the 1960s when Joseph Weizenbaum created ELIZA in 1966. ELIZA emulated a Rogerian therapist through basic pattern recognition, signifying the onset of machine-driven therapeutic dialogue. Nonetheless, it was devoid of genuine comprehension and compassion. The advancement of Natural Language Processing over the years has revolutionized chatbot functionalities, particularly with the introduction of models such as BERT in 2018 and GPT-2 in 2019.In 2022, Google launched FLAN-T5-a refined variant of the T5 model aimed at enhancing instruction adherence. Utilizing this, developers started creating conversational agents tailored for specific tasks. Nonetheless, the majority of these chatbots were developed using generalized or Western-focused datasets. The requirement for contextually relevant 1 mental health bots was still unmet, especially in nations such as Nepal, where cultural beliefs, language nuances, and emotional communications vary.Nepal’s socio-cultural landscape introduces distinct stressors: educational demands, economic emigration, and familial responsibilities, frequently overlooked because of stigma or restricted availability of professional assistance. The earliest recognized efforts to digitize mental health assistance in South Asia emerged after 2020, particularly during the COVID-19 pandemic when remote options became crucial. This initiative advances that timeline by creating a culturally sensitive, compassionate mental health chatbot tailored to datasets that represent Nepali contexts. By customizing FLAN-T5 for this specific need, the chatbot seeks to offer valuable assistance, particularly for young individuals dealing with social, academic, and emotional changes. 1.2 Motivation Figure 1.1: Motivation Image Mental health in Nepal continues to be a neglected concern, even as occurrences of anxiety, depression, and academic pressure increase among students and young adults. Cultural taboos regarding the pursuit of psychological assistance cause numerous individuals to be reluctant to consult professionals. This gap can be closed with the use of accessible AI tools. As smartphones and internet access expand in both rural and urban regions, implementing a chatbot that offers initial emotional assistance turns into a viable solution. Motivated by the effectiveness of models such as Woebot and Wysa 2 in various regions, this initiative aims to develop a comparable solution-tailored for Nepal.This AI-driven assistance can act as a link to additional aid, mitigate stigma, and foster an emotionally nurturing space for self-expression. The chatbot serves as a hands-on example of AI for social benefit, promoting the responsible and meaningful application of machine learning in resource-limited settings. 1.3 Problem Statements In Nepal, the increase in emotional distress stemming from academic demands, job uncertainty, and familial expectations is noticeable. However, there is a scarcity of available, culturally sensitive, and non-critical support systems. Mental health services are often costly or hard to access, especially in rural areas. Despite the presence of chatbots such as Replika or Woebot, they are not customized for the local languages, idioms, or cultural contexts found in Nepal. The uniform approach results in a gap between user feedback and chatbot replies. This project seeks to address the lack of emotionally intelligent digital assistance customized for the Nepali context by adjusting an open-source NLP model to react empathetically to culturally significant inputs. • Most existing mental health chatbots are trained on English datasets based on Western cultural contexts, which do not reflect the unique social and emotional challenges faced in Nepal. • Cultural mismatch in existing models leads to responses that may feel generic, irrelevant, or emotionally disconnected for Nepali users. • They often focus on single-turn conversations, which are inadequate for deep, supportive mental health interactions requiring multi-turn empathetic dialogues. 1.4 Project Objectives 1. To generate empathetic and culturally relevant mental health responses based on Nepali social contexts. 2. To develop chatbot for multi-turn conversation based on Nepali social context 3 1.5 Scope of Project Capabilities: The project aims to create a multi-turn mental health chatbot specifically designed for the social and cultural context of Nepal. By utilizing the FLAN-T5-small model, the chatbot will undergo fine-tuning with a specialized dataset which will include more than 2000 pairs of empathetic user responses. It will have the ability to produce helpful replies based on user inputs that address issues such as academic pressure, relocation, joblessness, and familial expectations. The model will successfully recognizes contextual signals in English while considering Nepali emotional indicators. It will accommodate UTF-8 output, facilitating seamless deployment on different platforms, and will include early stopping in training to enhance learning efficiency. This tool will serve as an initial emotional support resource, particularly for students and young adults experiencing psychological stress who are reluctant to pursue professional assistance. Limitations: The model only takes in English inputs, despite the emotional context being culturally Nepali-rendering it will be less accessible for users who prefer local languages. The chatbot will not be intended for clinical applications and cannot substitute for licensed psychological therapy. It will deliver general encouraging messages but will not have the capacity to evaluate mental health severity or provide tailored therapy. The comparatively limited dataset might constrain the chatbot’s capacity to generalize across a range of emotional scenarios 1.6 Feasibility Study 1.6.1 Technical Feasibility The project will be technically viable, built using robust and widely adopted open-source tools: • PyTorch for deep learning and training the model. • HuggingFace Transformers to implement the FLAN-T5-small model. • Evaluate library for assessing model output using ROUGE-L, BLEU, and METEOR. 4 Training will be performed on a consumer-level laptop with 8GB RAM and a Ryzen 5 processor, demonstrating that the model can be fine-tuned without requiring expensive GPUs or high-end hardware. This ensures the technical approach is lightweight, reproducible, and accessible. 1.6.2 Economic Feasibility The project will be cost-effective and suitable for low-resource settings: • Utilizes free, open-source software frameworks, eliminating licensing costs. • Employs a custom-built dataset, avoiding external data acquisition expenses. • Training will be conducted using a personal laptop, minimizing infrastructure costs. This makes the project economically feasible for students, independent developers, or institutions in developing countries like Nepal. 1.6.3 Ethical Feasibility The system will be designed with ethical responsibility at its core: • Provides general emotional support without replacing professional mental health services. • Ensures user anonymity and does not store any personally identifiable information. • Uses prompt engineering and safeguards to prevent biased, harmful, or inappropriate outputs. • Complies with basic AI ethics and privacy standards. 1.6.4 Social Feasibility The chatbot will be socially relevant and culturally appropriate: • Addresses increasing mental health issues such as stress, depression, and anxiety among Nepali youth. 5 • Offers a non-judgmental, anonymous space that encourages emotional expression. • Reflects Nepal’s unique cultural and social dynamics, improving user acceptance and relatability. This will enhance mental health awareness and provides accessible emotional support in traditionally underserved communities. 1.6.5 Operational Feasibility The chatbot will be simple to operate and easy to maintain: • Can functions even through a command-line interface with minimal training required. • will be deployed on web. • Modular design allows for incremental improvements, including dataset expansion and model updates. 1.7 1.7.1 Potential Applications Chat-based Mental Health Support for Nepalese Students This initiative seeks to offer prompt, readily available emotional assistance to students in Nepal, a significant number of whom encounter heavy academic stress and societal demands. Incorporating a chatbot that comprehends and responds with empathy in culturally appropriate manners enables students to articulate themselves openly, particularly during examinations or stressful moments. The chatbot serves as a supportive listener, providing comfort and advice without the stigma commonly associated with seeking mental health assistance. 1.7.2 Emotional Wellbeing Tools Integrated into Educational Platforms Incorporating mental health support resources into current school or university digital platforms-like learning management systems or student portals-provides students with convenient access. These resources can be utilized to monitor mood, deliver motivational material, and offer immediate chat-based interactions to assist in managing stress, fear of failure, and anxiety related to exams. This incorporation regularizes emotional wellness as a fundamental aspect of the educational experience. 6 1.7.3 Digital Companions for Individuals in Rural Communities In numerous rural regions of Nepal, mental health is still greatly stigmatized, and there is restricted access to professional services. A chatbot can serve as a virtual friend, offering non-judgmental emotional assistance while maintaining anonymity. By having basic access to smartphones or the internet, users can receive support at any time and place, assisting in closing the mental health service gap in underserved regions. 1.7.4 First-line Emotional Support Prior to Professional Counseling Although the chatbot cannot take the place of therapists or clinical psychologists, it acts as an initial resource for those who might be reluctant or unable to pursue professional assistance. By providing a secure, accessible method to discuss feelings and hardships, it promotes users to express themselves and possibly pursue professional therapy if necessary. This serves as an essential gateway for the wider mental health support network 1.8 Originality of Project In contrast to worldwide solutions, this chatbot is uniquely trained on the socio-cultural contexts of Nepal. While resources such as Woebot and Replika rely on broad datasets, this initiative targets problems such as academic pressure, migration-related anxiety, and cultural shame, establishing it as a unique project in Nepal. It also distinguishes itself by employing FLAN-T5, while the majority of mental health chatbots depend on BERT or GPT models. The instruction tuning of FLAN-T5 enables responses that are more controlled and aware of the context. 1.9 Organisation of Project Proposal The material in this proposal is organised into four chapters. The introductory chapter introduces the problem topic this research tries to address, chapter 2 contains the literature review of vital and relevant publications, pointing toward a notable research gap. Chapter 3 describes the methodology for the implementation of this project and finally Chapter 4 includes the proposal with the expected results. 7 2 LITERATURE REVIEW Literature Review-I The paper presents TherapyBot, an innovative chatbot system designed to support mental health through meaningful and empathetic conversations. It utilizes a transformer-based architecture, integrating a fine-tuned BERT model for accurately identifying user intent and a transformer decoder to generate emotionally aware and contextually relevant responses. The authors adopt a hybrid methodology that blends both retrieval-based and generative techniques. This hybrid design ensures that the responses are not only factually coherent and structurally sound but also emotionally aligned with the needs of users seeking psychological comfort and support ?. Among the key strengths of the system is its robust architecture, which leverages the power of large pre-trained models. The BERTbased intent classifier significantly improves the system’s capability to comprehend a wide range of mental health-related user inputs with higher precision. Meanwhile, the generative component based on transformer decoders allows for creating personalized and empathetic replies in real time. By combining these two approaches, the chatbot can handle both general and specific queries, maintaining fluency and sensitivity in its interactions. Additionally, the use of pre-trained language models considerably reduces the training time while still achieving impressive results in terms of conversational empathy and user engagement.Despite these advancements, TherapyBot exhibits notable limitations. The system has been predominantly trained on English-language datasets, which limits its cultural flexibility and linguistic inclusiveness, especially for non-English speaking populations. Furthermore, the evaluation of the system was conducted on a limited scale, involving a small and demographically uniform group of users. This raises concerns about its effectiveness and generalizability across broader and more diverse populations.The research gap that emerges from this study lies in its lack of adaptation to specific cultural and social contexts. While TherapyBot serves as a solid technological foundation for mental health chatbots, it does not account for the unique psychological stressors and conversational nuances found in different cultures. My project builds upon the same transformer-based foundation but introduces meaningful improvements by customizing the system for Nepali social and emotional realities. 8 Literature Review-II Raffel et al. introduced the Text-To-Text Transfer Transformer, a groundbreaking framework that unified a wide range of natural language processing tasks under a single architecture by framing every problem as a text-to-text generation task. This approach allowed for an elegant and consistent interface across diverse NLP challenges, such as translation, question answering, and summarization. The T5 model was pretrained on a massive corpus of text data and then fine-tuned across various NLP benchmarks, demonstrating robust performance across domains. Building on this foundation, the researchers later introduced a variant called FLAN, which incorporated instruction tuning - a technique where the model is fine-tuned with task-specific instructions included directly in the input. This enhancement significantly improved the model’s ability to follow prompts and generate relevant outputs, making it more suitable for practical applications where understanding user intent is crucial ?.In my project, I utilize FLANT5-small, a lighter yet still powerful version of this architecture, to build a mental health support chatbot. The key benefit of instruction tuning is that it trains the model to recognize and respond to specific prompt structures, such as “Provide comfort to someone experiencing stress” or “Offer support to a student feeling lonely.” This aligns perfectly with the needs of emotionally intelligent systems, where task-specific and emotionally attuned responses are essential. Despite being a smaller variant, FLAN-T5small maintains high levels of generalization and can effectively generate supportive, empathetic replies when trained on the right data. Its adaptability and compact size make it especially attractive for projects with limited computational resources but requiring sophisticated language understanding.The strengths of this approach are manifold. The T5 and FLAN architectures offer remarkable flexibility, allowing the same model to be used across a wide range of NLP tasks without major changes to the architecture. The inclusion of instruction tuning enhances zero-shot and few-shot learning capabilities, making the model versatile even when task-specific data is limited. Moreover, its scalability means that smaller models like FLAN-T5-small still retain strong performance, which is critical for applications like chatbots that must run efficiently in real-world environments.However, there are some notable shortcomings. The original T5 and FLAN models were not explicitly tested on tasks involving emotional nuance or therapeutic support. 9 Literature Review-III The EmpatheticDialogues dataset, introduced in this paper, represents a major step forward in the development of emotionally intelligent conversational agents. Comprising 25,000 open-domain conversations, each grounded in one of 32 predefined emotions, the dataset was specifically designed to help machine learning models generate responses that are both emotionally aware and contextually appropriate. It was compiled through Amazon Mechanical Turk, where crowdworkers were asked to generate dialogues based on personal experiences that evoked specific emotions, such as sadness, pride, or embarrassment. These conversations reflect natural, emotionally rich exchanges, allowing models trained on them to better interpret and respond to human feelings. The authors also evaluated the performance of various transformer models, including GPT and BERT, demonstrating that fine-tuning these architectures with the EmpatheticDialogues dataset significantly enhanced their empathetic capabilities. By providing a comprehensive resource of emotion-driven dialogues, the dataset has become an invaluable tool for researchers working on emotionally responsive AI systems ?.In the context of my project, this dataset serves as a key reference point, as it emphasizes the need for emotional grounding in AI-generated responses. It validates the importance of training models on data that reflects human emotional nuance, especially in therapeutic or support-driven applications. The dataset’s structured emotional annotations and diversity of conversational examples make it particularly useful for teaching models to distinguish between subtle emotional cues and to respond with appropriate tone and empathy. For emotion-sensitive tasks like mental health support, this kind of data can greatly improve the realism and human-likeness of AI responses, ensuring they are not only grammatically correct but also emotionally resonant.Among the primary strengths of the EmpatheticDialogues dataset is its introduction of a rich and structured emotional taxonomy, allowing models to be fine-tuned with a more refined understanding of user feelings. The authors were able to empirically demonstrate how model performance improved after training on this dataset, particularly in generating emotionally aligned responses. Additionally, by establishing baseline evaluations using several popular transformer architectures, they laid the groundwork for future research into empathy-focused AI. 10 Literature Review-IV Woebot represents a pioneering effort in the use of chatbot technology for mental health support, particularly through the lens of delivering cognitive-behavioral therapy via mobile messaging. Designed as a conversational agent, Woebot engaged users—especially college students—in structured, pre-scripted dialogues that offered therapeutic guidance, psychoeducation, and emotional reflection. In a short-term study spanning two weeks, the chatbot demonstrated a statistically significant reduction in depressive symptoms among participants, showcasing its potential as an accessible and scalable mental health intervention. By emphasizing user anonymity and offering therapy-like interactions in a simple, mobile-friendly format, Woebot laid the groundwork for democratizing mental health care, making it available outside traditional clinical settings and offering support to individuals who might otherwise avoid or lack access to therapy ?.The contribution of Woebot to the field is notable for several reasons. First, it provided early empirical evidence that digital interventions, particularly chat-based ones, could positively influence users’ emotional well-being. Its delivery of CBT through structured conversations demonstrated how therapeutic techniques could be automated without losing their core effectiveness. Second, Woebot’s anonymity feature built trust among users, especially in populations that may be hesitant to seek in-person help due to stigma or logistical barriers. The ease of access through smartphones further emphasized its potential to reach underserved communities. Importantly, Woebot helped establish the idea that AI-driven mental health tools could deliver real-world impact, even when operating within a narrowly defined, scripted framework.However, several limitations accompany Woebot’s initial design. As a rule-based system, it relied on rigid, pre-scripted responses, limiting its adaptability to the diverse and unpredictable nature of human conversation. Unlike modern natural language generation systems, Woebot was unable to understand or respond dynamically to the full range of user expressions. This lack of flexibility often resulted in generic or repetitive exchanges, potentially reducing user engagement over time. Furthermore, Woebot’s content was rooted in Western interpretations of stress and emotion, failing to consider culturally nuanced ways of experiencing and articulating mental health challenges. 11 Literature Review-V This comprehensive review investigates the intersection of Natural Language Processing and mental health, focusing on how linguistic analysis can be used to assess conditions such as depression, anxiety, PTSD, and suicidal ideation. Drawing on studies across multiple domains—including computational linguistics, psychology, and public health—the authors analyze how lexical, syntactic, and semantic features derived from social media platforms such as Twitter and Reddit can reveal subtle signs of psychological distress. The review serves as a foundational resource for understanding how automated systems interpret language patterns to infer emotional or mental health states. It also addresses the ethical complexities inherent in applying artificial intelligence to sensitive areas, such as user consent, data privacy, and the potential stigmatization of individuals based on AI-driven assessments ?.The strength of this review lies in its interdisciplinary scope and methodological depth. By synthesizing findings across NLP and mental health research, the authors not only identify prominent linguistic markers—such as negative sentiment, first-person pronoun usage, or disfluencies—but also advocate for more holistic, multimodal approaches to diagnosis. Furthermore, their attention to ethical considerations distinguishes this work from purely technical studies, emphasizing the importance of transparency and responsible AI deployment in mental health applications. These insights have directly informed the design of my own chatbot project, particularly the focus on empathy, ethical deployment, and the use of emotional language cues as indicators for appropriate system responses.Despite its merits, the review reveals certain limitations. Its emphasis is heavily skewed toward the detection and classification of mental health issues, rather than on support or therapeutic engagement. Most of the referenced work revolves around mining public data from platforms like Reddit or Twitter, where language may not be reflective of deeper, ongoing mental health struggles expressed in private or structured settings. Additionally, there is little exploration of conversational AI or real-time response generation—elements that are critical for building interactive, empathetic systems that do more than detect distress. This gap limits the applicability of the review’s findings to the development of chatbots designed to actively support and engage users, rather than merely flag risk.This creates an important opportunity that my project seeks to address. 12 3 3.1 METHODOLOGY Theoretical Formulations This project will utilize a sequence-to-sequence learning model based on Google’s FLAN-T5-small transformer. The FLAN version is instruction-tuned, which denotes that it is trained to adhere to clear task instructions more precisely than conventional pre-trained models. The foundational theory originates from the encoder-decoder model, in which the input sequence (a user’s inquiry regarding a mental health concern) is transformed into a latent representation and then interpreted into a pertinent supportive response. The primary learning approach is transfer learning, in which a model trained on broad text collections is adjusted using a dataset specific to a task-in this instance, empathetic replies in Nepali contexts. This allows the model to leverage language comprehension while adjusting to the emotional tone, intent, and sociocultural standards reflected in the personalized dataset. 3.2 Mathematical Modelling Let the input text be tokenized as: x = (x1 , x2 , . . . , xn ) (i) y = (y1 , y2 , . . . , ym ) (ii) and the output response as: Then, the model estimates the conditional probability of the output sequence given the input: m P(y | x) = ∏ P(yt | y<t , x) (iii) t=1 The training objective is to minimize the cross-entropy loss over the predicted distribution and the true distribution: m L (x, y) = − ∑ log P(yt | y<t , x) t=1 where Input x: This is the tokenized user query, e.g., ”I’m feeling very anxious today.” 13 (iv) Output y: This is the tokenized target response, e.g., ”I’m sorry you’re feeling that way. I’m here to help you.” FLAN-T5 uses a sequence-to-sequence architecture. It encodes the input x, and the decoder generates tokens of y one at a time, conditioning on previous tokens (y<t , x) 3.3 System Block Diagram Figure 3.1: System Block Diagram 1. User Input: This will be the user interface of my chatbot, where interactions take place. In my project, this will be a messaging interface on a web. The user will enter their message (for instance, “I’m feeling quite down today”), which will be subsequently sent to the backend for processing. This interface will enable real-time multi-turn dialogue, allowing users to engage in conversation through numerous messages as they would with a human. 2. Preprocessing Module: Before the message reaches the model, it needs to be cleaned and converted. This module will perform the following tasks: • Removing unwanted characters or emojis: Cleans the input to eliminate non-textual or irrelevant symbols. 14 • Converting the text to lowercase: Standardizes the input for consistent processing. • Tokenizing: Splits the message into smaller chunks (tokens) that the model can interpret. • Encoding: Transforms the tokenized input into a numerical format compatible with the FLAN-T5 model. This step will be crucial to ensure the model receives clean and meaningful input every time. 3. Conversation History Manager Since my project supports multi-turn dialogue, this component will keep track of past messages between the user and the AI. For example: User: I’m really stressed about exams. AI: I understand. Exams can be overwhelming. Want to talk about what’s making it hard? User: I feel like I can’t focus at all. The Conversation History Manager will collect this thread and passes it all to the model so the chatbot can understand context and respond empathetically. Without this, the model would treat each message as an isolated input (single-turn), losing emotional and conversational continuity. 4. Encoder (FLAN-T5): This will be the core engine of the chatbot-a transformer-based language model fine-tuned to: • Understand mental health-related concerns. • Detect emotions in text (such as sadness, anxiety, or stress). • Generate empathetic and supportive responses. The model will takes user input along with the conversation history and produces a thoughtful, context-aware reply. 15 Example: • Input: “I feel very lonely these days.” • Output: “I’m really sorry you’re feeling this way. Loneliness can be heavy. Do you want to talk about what’s been happening lately?” 5. Postprocessing Module: After the FLAN-T5 model will generate a response, this module will perform several essential tasks: • Converts the model’s tokens back into readable text. • Removes any irrelevant or repetitive words. • Formats the response to feel more natural and conversational. This helps ensure that the chatbot’s replies are clean, empathetic, and human-like. 6. Empathetic Response Output: The final response will be returned to the user. This response will aim to acknowledge the user’s emotional state and offer supportive language. Example Output: “I understand how stressful exams can be. Try to take breaks, and remember, doing your best is what really matters.” 7. Response Output Interface: The response will then displayed back to the user in the chat interface. This will complete one cycle of the conversation. The user can then respond, and the next message will get added to the conversation history -enabling multi-turn dialogue. 16 3.3.1 Sequence Diagram Figure 3.2: Sequence Diagram 1. User Input • The user will send a raw message (e.g., “I feel sad today.”). • The input will be passed to the Preprocessing Module. 2. Preprocessing Module • will receive raw input and applies preprocessing techniques such as: – Text normalization – Tokenization – Noise removal 17 • will send a request to update context to the Conversation History Manager. 3. Conversation History Manager • will maintain and update the ongoing conversation context. • will return the context data to the Preprocessing Module. 4. Preprocessing Module (continued) will merge the user’s input with the context received.will prepare a fully contextualized input for the model. will send the input to the FLAN-T5 Model. 5.• FLAN-T5 Model • will generate a response based on the contextualized input. • will output a sequence of response tokens. • will send the raw response to the Postprocessing Module. 6. Postprocessing Module • will clean and formats the model’s response. • will fix grammar, punctuation, or removes extraneous content. • will send the cleaned output to the Empathetic Response module. 7. Empathetic Response Module • will enhance the response with emotionally intelligent phrasing (e.g., “I understand how you feel.”). • will add empathy and tone appropriate for mental health contexts. • will send the final enhanced response to the Response Output Interface. 8. Response Output Interface • will deliver the final response back to the user. • will close the loop and prepares for the next input. 18 3.4 Instrumentation Requirements Hardware Software PL Tools/IDE AMD Ryzen 5 Windows 11 Python TensorFlow LaTeX editor PyTorch for documentation 8GB RAM Datasets Transformers Evaluate Table 3.1: Instrumentation Requirements Hardware Requirements: The project will be created on a laptop that has a AMD Ryzen 5 processor. At least 8 GB of RAM is required. Regarding storage, it will have at least 20 GB of available disk space to support the dataset, model checkpoints, log files, and library requirements.Training will be done on a CPU but might require several hours for each epoch. Software Requirements: The chatbot will be developed in Python, particularly version 3.9 or higher. Python will be selected for its comprehensive support of libraries related to NLP, deep learning, and data processing. PyTorch (version 2.2.2) will act as the main framework for deep learning. It will offer dynamic computation graphs and effective tensor operations, all of which are crucial for training models based on transformers. The Hugging Face Transformers library (version 4.40.1) will be utilized to load the FLAN-T5-small model, manage tokenization, and carry out fine-tuning. This library streamlines the access to pre-trained models and provides highly adjustable training pipelines. Other dependencies consist of the tokenizers library (version 0.19.1) for encoding textual inputs, datasets (version 2.18.0) for handling and loading the custom dataset, and evaluate (version 0.4.1) for computing evaluation metrics like ROUGE, BLEU, and METEOR. All of these tools will be set up using a requirements.txt file, simplifying the installation process. 19 3.5 Dataset Explanation Structure The dataset will be organized in a structured JSON format, with each entry containing the following fields: • ”input”: This field will captures a user’s mental health-related statement or concern, such as “I feel worthless and alone.”. These inputs simulate real-life expressions of emotional distress commonly encountered among Nepalese youth. • ”output”: A carefully crafted empathetic response will intend to provide emotional support, validation, or guidance in a compassionate and culturally aware tone. Responses align with best practices in supportive dialogue. • ”emotion”: This field will classify the emotional tone of the input into one of seven predefined categories: – Anxiety – Stress – Depression – Loneliness – Anger – Hopelessness – Grief These labels will support emotional understanding and will enable the model to generate appropriately tailored responses. • ”category”: will represents the contextual domain of the user’s concern, such as: – Academic stress – Migration and displacement – Family issues – Employment struggles 20 – Peer pressure – Identity conflict This will allow the model to remain context-aware and generate more relevant, domain-specific responses. Statistics • The dataset will comprises over 2,000 unique input-output pairs. • All entries will be manually written and reviewed to ensure emotional sensitivity, linguistic clarity, and cultural relevance. • A balanced class distribution across emotion categories will be maintained to avoid bias and improve generalization. Curation Process The dataset will be developed with a strong emphasis on authenticity and cultural grounding: • Each entry will simulates realistic mental health scenarios faced by Nepalese youth, especially students, migrant workers, and unemployed individuals. • Language will be adapted using Nepali-English idiomatic expressions, maintaining cultural nuance while ensuring comprehensibility in English. • Emotional expressions will carefully be selected to reflect the social, familial, and economic challenges commonly experienced in Nepal. • Responses will be crafted to follow empathetic communication principles, avoiding judgment, offering validation, and reinforcing a sense of self-worth. 3.6 Description of Algorithms 3.7 1. Loading the Dataset The dataset will be loaded into a Python dictionary using the json library. This dataset will contains pairs of inputs (mental health-related user queries) and outputs (supportive responses). The dataset will be split into training and validation sets using train test split from the scikit-learn library, with an 80%/20% split. 21 3.8 2. Defining the Dataset Class A custom SupportDataset class will be created, inheriting from the Dataset class in PyTorch. This class will be responsible for tokenizing and formatting the data. In the getitem method: • The input text will be prefixed with the string "mental health support: " to give the model context for the input. • The input and target texts will be tokenized using the T5 tokenizer, which will convert text into sequences of tokens (IDs). • Padding and truncation will be applied to ensure the sequences fit within the maximum length (max len). • The target text (response) will be tokenized, and the tokens corresponding to padding will be replaced with -100, which is ignored by the loss function during training. 3.9 3. Loading the Model and Tokenizer The T5 model (flan-t5-small) is loaded from the Hugging Face model hub. This model is fine-tuned for conditional text generation tasks, making it suitable for generating responses based on input text. The T5Tokenizer is also loaded from the Hugging Face model hub to convert text into token IDs and vice versa. 3.10 4. Preparing the Datasets for Training Instances of the SupportDataset class are created for both training (train dataset) and validation (val dataset) data, using the tokenizer and a specified maximum sequence length of 128 tokens. 3.11 5. Setting Training Arguments The TrainingArguments is configured to define the training behavior, including: • Batch size of 4 for both training and evaluation. • Number of epochs is set to 10. 22 • Learning rate of 3e-4 with weight decay for regularization. • Logging every 20 steps and storing logs in the ./logs directory. • Early stopping is enabled through the EarlyStoppingCallback, with patience set to 2 epochs (the model stops training if validation loss does not improve for 2 epochs). 3.12 6. Training the Model A Trainer object is created, which is responsible for handling the training loop. The Trainer takes the following inputs: • The model (model), training arguments (training args), training and validation datasets (train dataset, val dataset), and the tokenizer (tokenizer). • The EarlyStoppingCallback is used to prevent overfitting. The model is trained using the trainer.train() method. 3.13 7. Saving the Model Once training is completed, the model and tokenizer are saved to the directory ./flan t5 mental healt for future use. 3.14 8. Inference Function The generate response function takes an input text (e.g., a user’s mental healthrelated message), prepends it with the context "mental health support: ", and tokenizes it. The model generates a response using beam search with the following parameters: • num beams=4: Uses 4 beams for beam search to explore multiple candidate sequences. • no repeat ngram size=2: Prevents repeating n-grams of size 2 in the generated text. • repetition penalty=1.2: Penalizes repetition in the generated text. 23 • early stopping=True: Stops generation when the end-of-sequence token is reached. The model’s output is decoded back into text and returned as the generated response. 3.15 9. Sample Output The algorithm evaluates the model on the validation data by generating responses for a sample of the data. It prints the user input, target response, and the predicted response generated by the model for comparison. 24
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )