Empathetic and coherent responses are critical in auto-mated chatbot-facilitated psychotherapy. This study addresses the challenge of enhancing the emotional and contextual understanding of large language models (LLMs) in psychiatric applications. We introduce Emotion-Aware Embedding Fusion, a novel framework integrating hierarchical fusion and attention mechanisms to prioritize semantic and emotional features in therapy transcripts. Our approach combines multiple emotion lexicons, including NRC Emotion Lexicon, VADER, WordNet, and SentiWordNet, with state-of-the-art LLMs such as Flan-T5, LLAMA 2, DeepSeek-R1, and ChatGPT 4. Therapy session transcripts, comprising over 2,000 samples are segmented into hierarchical levels (word, sentence, and session) using neural networks, while hierarchical fusion combines these features with pooling techniques to refine emotional representations. Atten-tion mechanisms, including multi-head self-attention and cross-attention, further prioritize emotional and contextual features, enabling temporal modeling of emotion-al shifts across sessions. The processed embeddings, computed using BERT, GPT-3, and RoBERTa are stored in the Facebook AI similarity search vector database, which enables efficient similarity search and clustering across dense vector spaces. Upon user queries, relevant segments are retrieved and provided as context to LLMs, enhancing their ability to generate empathetic and con-textually relevant responses. The proposed framework is evaluated across multiple practical use cases to demonstrate real-world applicability, including AI-driven therapy chatbots. The system can be integrated into existing mental health platforms to generate personalized responses based on retrieved therapy session data.
翻译:在自动化聊天机器人辅助的心理治疗中,生成共情且连贯的响应至关重要。本研究致力于应对在精神医学应用中增强大语言模型(LLMs)情感与上下文理解能力的挑战。我们提出了情感感知嵌入融合这一新颖框架,该框架集成了层级融合与注意力机制,以优先处理治疗记录中的语义与情感特征。我们的方法将多种情感词典(包括NRC Emotion Lexicon、VADER、WordNet和SentiWordNet)与前沿的大语言模型(如Flan-T5、LLAMA 2、DeepSeek-R1和ChatGPT 4)相结合。超过2000个样本的治疗会话记录通过神经网络分割为不同层级(词、句子和会话),同时层级融合技术结合池化方法将这些特征融合,以精炼情感表征。注意力机制(包括多头自注意力和交叉注意力)进一步优先处理情感与上下文特征,从而实现对跨会话情感转变的时序建模。处理后的嵌入使用BERT、GPT-3和RoBERTa计算,并存储于Facebook AI相似性搜索向量数据库中,该数据库支持在稠密向量空间中进行高效的相似性搜索与聚类。针对用户查询,系统检索相关片段并将其作为上下文提供给大语言模型,从而增强其生成具有共情力且上下文相关响应的能力。所提出的框架在多个实际应用场景(包括AI驱动的治疗聊天机器人)中进行了评估,以证明其现实世界的适用性。该系统可集成到现有的心理健康平台中,基于检索到的治疗会话数据生成个性化响应。