作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2024, Vol. 50 ›› Issue (6): 94-101. doi: 10.19678/j.issn.1000-3428.0068404

• 人工智能与模式识别 • 上一篇    下一篇

基于多头注意力机制融合常识知识的共情对话生成

程腾腾1, 姚春龙1, 于晓强2, 李旭2, 王庆丰1   

  1. 1. 大连工业大学信息科学与工程学院, 辽宁 大连 116034;
    2. 大连工业大学工程训练与创新创业中心, 辽宁 大连 116034
  • 收稿日期:2023-09-17 修回日期:2023-11-12 发布日期:2024-06-11
  • 通讯作者: 姚春龙,E-mail:yaocl@dlpu.edu.cn E-mail:yaocl@dlpu.edu.cn
  • 基金资助:
    辽宁省教育厅青年科技人才“育苗”项目(J2020113);辽宁省教育厅基本科研项目(LJKZ0537)。

Empathetic Dialogue Generation by Incorporating Commonsense Knowledge Based on Multi-Head Attention Mechanism

CHENG Tengteng1, YAO Chunlong1, YU Xiaoqiang2, LI Xu2, WANG Qingfeng1   

  1. 1. School of Information Science and Engineering, Dalian Polytechnic University, Dalian 116034, Liaoning, China;
    2. Engineering Training and Innovation Entrepreneurship Center, Dalian Polytechnic University, Dalian 116034, Liaoning, China
  • Received:2023-09-17 Revised:2023-11-12 Published:2024-06-11

摘要: 当前对话生成技术已取得显著进展,然而为了更好地满足人类交流的需求,研究人员开始将共情引入对话生成领域。共情作为人际交流的重要组成部分,有助于更好地理解他人的情感和感受。通过引入常识知识来加强对用户情感和处境的理解,然而目前方法对非情感知识采用统一编码以及对常识知识融合采用简单的向量拼接,导致某些常识知识特征的影响可能降低,并且各个知识之间的关联刻画模糊。为此,提出一种基于多头注意力机制融合常识知识的共情对话模型ATT-EDM。该模型对引入的5种关系(xReact、xWant、xNeed、xIntent、xEffect)进行单独编码,保留了每种常识各自的特征,并利用多头注意力机制融合常识知识,对每种知识在注意力层进行运算,以更准确地反映它们各自的影响,同时更有效地刻画各个常识知识之间的联系。在数据集EmpatheticDialogues上的实验结果表明,该模型在困惑度(PPL)、准确率和Distinct-2指标上优于基线模型,PPL降低到36.435 0,准确率和Distinct-2分别达到37.96%、3.345 5,能够生成质量更高、内容更丰富、共情能力更强的同理心响应。

关键词: 自然语言处理, 共情对话生成, 同理心, 注意力机制, 常识知识

Abstract: Significant progress has been made in dialogue generation techniques. However, to meet the demands of human communication more effectively, researchers have incorporated empathy into dialogue generation. Empathy, a crucial component of interpersonal communication, aids in enhanced understanding of others' emotions and feelings. The latest methods realize this enhanced understanding by introducing commonsense knowledge through the use of unified encoding for non-emotional knowledge and employing a simple vector concatenation for integrating commonsense knowledge. However, this approach may potentially decrease the influence of certain commonsense knowledge features and also lacks clear representations of the interrelations among various knowledge components. An empathetic dialogue model ATT-EDM is proposed to address these limitations, which leverages the multi-head attention mechanism to effectively fuse commonsense knowledge. The model individually encodes the five introduced relationships-xReact, xWant, xNeed, xIntent, and xEffect, preserving the distinctive features of each commonsense knowledge. It leverages a multi-head attention mechanism to integrate knowledge, computes each type of knowledge separately in the attention layer to reflect their respective influences more accurately, and effectively captures the interconnections among various commonsense knowledge components. Experimental results obtained using the EmpatheticDialogues dataset demonstrate that the proposed model outperforms baseline models in terms of the Perplexity (PPL), accuracy, and Distinct-2 metrics. Specifically, it achieves a reduced PPL of 36.435 0, with the accuracy and Distinct-2 metrics reaching 37.96% and 3.345 5, respectively. This enables the generation of high quality responses that are content-rich and empathetic.

Key words: Natural Language Processing(NLP), empathetic dialogue generation, empathy, attention mechanism, commonsense knowledge

中图分类号: