PromptSense: Sentiment-Aware Mental Health Chatbot with Dynamic Prompting
Organizations: Transdisciplinary School, University of Technology Sydney, Sydney, Australia · Data Science Institute, University of Technology Sydney, Sydney, Australia
Abstract
Current Large Language Models (LLMs)-based mental health chatbots often lack sufficient empathy, contextual awareness, and safety mechanisms, potentially leading to ineffective or harmful interactions. This paper proposes a novel framework that integrates sentiment and depression analysis with a rule-based filtering mechanism prior to model inference. By dynamically constructing prompts based on emotional and risk-related insights, the framework aims to significantly improve the contextual relevance, empathy, and risk-aware of model-generated responses. We evaluated four model strategies and two prompt engineered variants across qualitative metrics such as empathy, helpfulness, clarity, relevance, safety, as well as toxicity assessments using the Perspective API. Experimental results indicate that the prompt engineering approaches outperforms DSFT and RLAIF by 1.8% and 1.1% respectively.
Figures & tables
| Study | Objective | Dataset |
|---|---|---|
| [ 16 ] | Fine-tuning LLaMA2-7B with the sets of instructions | IMHI dataset |
| [ 17 ] | Fine-tuning LoRA-based approach on top of LLaMA2-7B | CounselChat dataset |
| [ 8 ] | Fine-tuning GPT-4 model with localised prompt engineering | CounselChat dataset, local Indonesian mental health discussions |
| [ 10 ] | Fine-tuning BERT and RoBERTa with Mental Health dataset | SWMH, Depression Reddit, and other data collected from Reddit |
| Dataset | Application | Train | Val | Test |
|---|---|---|---|---|
| SWMH [ 11 ] | SAM’s Mental Head | 34,823 | 8,706 | 10,883 |
| GoEmotions [ 7 ] | SAM’s Emotion Head | 43,410 | 5,426 | 5,427 |
| NRC VAS Lexicon [ 14 ] | SAM’s VAD Head | - | - | - |
| Counsel Chat [ 1 ] | Fine Tuning LLM | 2,612 | - | - |
| Emphatic Dialogues [ 15 ] | Model Evaluation | - | - | 418 |
| Metric | Description |
|---|---|
| Empathy | Does the response acknowledge and validate the user’s feelings? |
| Helpfulness | Does it offer useful strategies, advice, or insights? |
| Clarity | Is the response clearly written, easy to understand, and coherent? |
| Relevance | Does it directly address the user’s question or concern? |
| Safety | Does it avoid harmful, dismissive, or risky advice? |
| Toxicity | A rude, disrespectful, or unreasonable comment that is likely to make people leave a discussion |
| Model | MH Accy | EH F1 | V RMSE | A RMSE |
|---|---|---|---|---|
| Original (Frozen) | 0.5086 | 0.0801 | 0.2762 | 0.1974 |
| Base (Frozen) | 0.5787 | 0.1088 | 0.2587 | 0.1932 |
| Proposed Model (Frozen) | 0.5997 | 0.3527 | 0.2420 | 0.1990 |
| Proposed Model (Unfreeze) | 0.6803 | 0.4840 | 0.2025 | 0.1835 |
| Model | MIXT [ 13 ] | MIST [ 12 ] | MELL [ 16 ] | AVG |
|---|---|---|---|---|
| Base | 8.63 | 9.12 | 8.44 | 8.73 |
| Base + PE-Q | 8.70 | 9.26 | 8.54 | 8.83 |
| Base + PE-P | 8.78 | 9.25 | 8.52 | 8.85 |
| DSFT | 8.59 | 9.08 | 8.36 | 8.68 |
| DSFT + PE-Q | 8.70 | 9.23 | 8.46 | 8.80 |
| DSFT + PE-P | 8.66 | 9.20 | 8.46 | 8.77 |
| Model | Toxicity | Identity Attack | Insult | Threat | Compassion | Respect | Nuance | Incoherent |
|---|---|---|---|---|---|---|---|---|
| Base | 0.0166 | 0.0022 | 0.0094 | 0.0070 | 0.9250 | 0.8815 | 0.4387 | 0.1748 |
| Base + PE-Q | 0.0156 | 0.0021 | 0.0091 | 0.0069 | 0.9415 | 0.8838 | 0.4452 | 0.1506 |
| Base + PE-P | 0.0180 | 0.0022 | 0.0109 | 0.0070 | 0.9391 | 0.8814 | 0.4638 | 0.1564 |
| DSFT | 0.0174 | 0.0022 | 0.0096 | 0.0072 | 0.9246 | 0.8817 | 0.4092 | 0.1971 |
| DSFT + PE-Q | 0.0178 | 0.0023 | 0.0102 | 0.0069 | 0.9386 | 0.8841 | 0.4268 | 0.1690 |
| DSFT + PE-P | 0.0178 | 0.0023 | 0.0099 | 0.0071 | 0.9380 | 0.8813 | 0.4330 | 0.1747 |