An Iterative Associative Memory Model for Empathetic Response Generation (2024)

Abstract: Empathetic response generation aims to comprehend the cognitive and emotional states in dialogue utterances and generate proper responses. Psychological theories posit that comprehending emotional and cognitive states necessitates iteratively capturing and understanding associated words across dialogue utterances. However, existing approaches regard dialogue utterances as either a long sequence or independent utterances for comprehension, which are prone to overlook the associated words between them. To address this issue, we propose an Iterative Associative Memory Model (IAMM)1 for empathetic response generation. Specifically, we employ a novel second-order interaction attention mechanism to iteratively capture vital associated words between dialogue utterances and situations, dialogue history, and a memory module (for storing associated words), thereby accurately and nuancedly comprehending the utterances. We conduct experiments on the Empathetic-Dialogue dataset. Both automatic and human evaluations validate the efficacy of the model. Variant experiments on LLMs also demonstrate that attending to associated words improves empathetic comprehension and expression.

heading: 1 Introduction
text: As an important task for improving dialogue quality, empathetic response generation aims to comprehend the emotional and cognitive states of the user in dialogue utterances and provide appropriate responses (Liang et al., 2021; Liu et al., 2021; Rashkin et al., 2019; Zheng et al., 2021; Zhong et al., 2020).
The majority of methods treat the dialogue utterances as a long sequence to comprehend the user states (Li et al., 2022; Lin et al., 2019; Majumder et al., 2020; Sabour et al., 2022; Zhou et al., 2023).
∗Corresponding author. 1Our code is available at https://github.com/
zhouzhouyang520/IAMM
These approaches ignore the discrepancies in meanings among individual utterances, leading to inaccurate understanding of emotional and cognitive states (Wang et al., 2022; Welivita et al., 2021). To address this issue, some methods comprehend more delicate emotional and cognitive states within a set of independent utterances by distinguishing selfother awareness (Zhao et al., 2022) or emphasizing emotion-intent transitions (Wang et al., 2022).
However, the situation model (Van Dijk et al., 1983), as an important theory for understanding empathy, posits that comprehending emotional and cognitive states in detail necessitates not only understanding independent utterances, but also iteratively associating pivotal associated words within those utterances (Gernsbacher et al., 1992; Gygax et al., 2003; McNamara and Magliano, 2009; Zwaan and Radvansky, 1998). As shown in Figure 1, the speaker’s independent utterances imply the emotion of “anger,” yet the overall expression conveys “furious.” If the utterances are understood independently, the listener is likely to misinterpret the speaker’s emotion as “anger.” In contrast, the iterative association integrates subtle associated
3081
words, allowing for an accurate understanding of the dialogue. Specifically, when faced with the first utterance, the listener combines this utterance with related words from the situation and stores it in its memory to form an initial understanding. When encountering the speaker’s second utterance, the listener meticulously compares and reasons this utterance with the dialogue history, situation, and related words in memory, to deepen its understanding of the utterance. For instance, associating “jerks” and “guy” reveals an intensification of the emotion of anger, i.e., “furious”. Additionally, reasoning that “cut me off” and “caused an accident” makes it easier to realize the speaker’s furious due to the life-threatening event. Overall, by associating explicit and implicit information, the listener attains a more nuanced understanding of the utterances. While this comprehension process proves effective, simulating it to achieve meticulous understanding of dialogues remains an open challenge.
In this paper, we propose an iterative associative memory model (IAMM) that iteratively employs an information association module to identify and learn subtle connections within both explicit and implicit information. We first treat the dialogue content, including both the dialogue utterances and situations, as explicit information, and treat the reasoning knowledge about the dialogue content generated by COMET (Hwang et al., 2021) as implicit information. Subsequently, we iteratively utilize the information association module to identify and learn associated words between utterances and situations, dialogue history, and memory (initialized as an empty set) in the explicit/implicit information, and store them in the memory for a thorough understanding of the utterances. Specifically, the information association module, inspired by the idea that "pages (nodes) linked by important pages (nodes) are also more important" (Brin and Page, 1998; Weng et al., 2010), effectively identifies associated words in the to-be-associated sentences through a second-order interaction attention mechanism.
To validate our model, we construct IAMM and IAMMlarge (LLMs-based model). Experiments are conducted on the Empathetic-Dialogue dataset (Rashkin et al., 2019). Both automatic evaluation and human evaluation demonstrate that compared with the state-of-the-art baselines, our models possess stronger understanding while expressing more informative responses.
Overall, our contributions are as follows:
• We introduce an iterative association framework for empathetic response generation, which simulates the human iterative process of understanding emotions and cognition.
• We propose an iterative associative memory model (IAMM), which iteratively employs a second-order interaction attention mechanism to capture subtle associations in dialogues.
• Experiments on the Empathetic-Dialogue dataset validate the efficacy of our models.

heading: 2 Related Work
text: Empathetic response generation requires comprehending the user states in dialogue utterances to generate appropriate responses (Rashkin et al., 2019). Existing methods can be categorized into dialogue-level models and utterance-level models, according to whether they understand dialogue utterances independently.
Dialogue-level models. Dialogue-level models view all dialogue utterances holistically as a long sequence to comprehend user states. Some dialogue-level models focus on the coarse emotions (Lin et al., 2019; Majumder et al., 2020; Rashkin et al., 2019) or subtle emotions (Gao et al., 2021; Kim et al., 2021; Li et al., 2020, 2022; Wang et al., 2024; Yang et al., 2023) present in a conversation to understand the user states. While focusing on emotional states, these models ignore cognitive states, leading to inadequate empathy comprehension (Sabour et al., 2022). Some methods introduce reasoning knowledge to more comprehensively attend to user states (Cai et al., 2023; Sabour et al., 2022; Zhou et al., 2023).
Utterance-level models. Utterance-level models focus on differences in emotional and cognitive states within individual utterances. These models view dialogue utterances as independent sentences to understand the user’s state within them via selfother awareness differentiating Zhao et al. (2022) and emotion-intent transitions Wang et al. (2022).
The aforementioned methods view the dialogue utterances as either long sequences or as independent sentences to understand the user’s emotions and cognitive states. However, understanding emotional and cognitive states requires iteratively capturing and comprehending associated words (Gernsbacher et al., 1992; Gygax et al., 2003;
McNamara and Magliano, 2009). Therefore, we propose an Iterative Associative Memory Model (IAMM), which iteratively understands the associated words between utterances from both explicit and implicit information, and generates empathetic responses.

heading: 3 Method

heading: 3.1 Task Formulation
text: The task of empathetic response generation is as follows: Given the dialogue content, including the context D = [U1, ..., Ui, ..., UM ] and the situation S = [ws1, w s 2, ..., w s m], the model needs to understand the dialogue emotion E and generate an appropriate response Y = [y1, y2, ...,yj , yN ]. Ui = [wi1, w i 2, ..., w i mi] is the i-th utterance containing mi words. S represents a situation description consisting of m words. Y represents a response sequence consisting of N words.

heading: 3.2 Overview
text: We illustrate the overall architecture of IAMM in Figure 2. As iterative association requires attention to both explicit and implicit information (Garrod and Sanford, 2012), we view the dialogue content as explicit information, and their reasoning knowledge (Hwang et al., 2021) as implicit information. We construct IAMM in the following three steps: (1) Encoding dialogue information (Section 3.3), which learns explicit and implicit information in dialogue through multiple encoders. (2) Capturing associative information (Section 3.4), which iteratively captures associated words in the dialogue regarding the explicit and implicit aspects. (3) Predicting emotion and generating responses (Section 3.5), which predicts the dialogue emotion and generates responses based on the learned content. Furthermore, we construct a variant model IAMMlarge (Section 4.3), which leverages instructions to guide the large language models to focus on associated words and capture the nuanced associations within the dialogue.

heading: 3.3 Encoding Dialogue Information
text: We encode the dialogue information from both explicit and implicit perspectives.
Explicit Information. We take the dialogue utterances and situations as explicit information. Following previous work (Wang et al., 2022), we add special start tokens [CLS] before the dialogue utterances and situations to obtain word sequences Ui
and S, respectively. Based on the word sequence Ui of the dialogue utterances, we first learn sentence representations using an utterance-level encoder Encu, then learn the overall meaning of the dialogue using a dialogue-level encoder Encctx.
H iu = Encu(E i w + Ep + Er) (1) Hc = Encctx(H 1 u ⊕ ...⊕HMu ) (2)
where Eiw, Ep, Er are the word embedding, positional embedding, and state embedding of the utterances, respectively. The state embedding is used to distinguish between speakers and listeners. And H iu ∈ Rmi×d, Hc ∈ RMD×d, with mi, Hc being the lengths of the i-th utterance and total dialogue utterances. d and ⊕ represent the hidden size and concatenation operation, respectively.
For the word sequence S of the situations, we employ an encoder Encsit to learn the situation representations.
Hs = Encsit(E sit w + E sit p ) (3)
where Esitw and E sit p represent the word embedding and the positional embedding of the situations, respectively. Hs ∈ Rm×d and m is the number of words it contained.
Implicit Information. Following (Sabour et al., 2022; Wang et al., 2022), we utilize the COMET model (Hwang et al., 2021) to generate reasoning knowledge Kui and Ks for the dialog utterance Ui and situation S, and take them as the implicit information. Among them, the reasoning knowledge Krk (rk ∈ (Ui, s)) contains 5 types of text: the impact of events (xEffect), personal emotional reactions (xReact), personal intentions (xIntent), personal needs (xNeed), and personal desires (xWant). For convenience, we represent them as Ktyperk , where type ∈ [xEffect, xReact, xIntent, xNeed, xWant].
Subsequently, we prepend [CLS] before the reasoning knowledge and feed it into the encoder Enccs. To understand the overall implicit information, we utilize the encoder Enccs to learn the reasoning knowledge of the situation and the last utterance.
Htyperk = Enccs([CLS]⊕K type rk ) (4)
Hcsrk = ∥ type Htyperk [0] (5)
Hcs = H cs s ⊕HcsUM (6)
H̃cs = Ẽnccs(Hcs) (7)
Where Htypeirk [0] is the overall semantic representation of the sentence, and rk ∈ (Ui, s), type ∈ [xEffect, xReact, xIntent, xNeed, xWant]. ∥ is the concatenation operation. UM and s represent the last utterance and situation, respectively. Htyperk ∈ Rd type rk ×d, Hcs ∈ R10×d, H̃cs ∈ R10×d and dtyperk is the number of words in the reasoning knowledge Ktyperk .

heading: 3.4 Capturing Associated Information
text: We employ the information association module (IAM) to capture important associated words in explicit and implicit information to coherently and thoroughly understand the dialogue. To elaborate on the process of the information association module, we explain it in two aspects: Iterative association process, which describes the process executed by the information association module. Information association module, which explicates in detail the internal structure of the module.

heading: 3.4.1 Iterative Association Process
text: To understand the current utterance Ui, we construct pairs of explicit and implicit information as the input to the information association module. These pairs are used to capture important associations between utterance-situation, utterancedialogue history, and utterance-memory, respec-
tively. Here, Mi and M i represent the memory, which is used to store associated words and is initialized as empty. Note that when Ui=U1, both the dialogue history and memory are empty.
Explicit Information Pairs: (Eiw, Es), (Eiw, E 1 w ⊕ ..., Ei−1w ), (Eiw,M1 ⊕ ...,Mi−1).
Implicit information pairs: (HcsUi , H cs s ),
(HcsUi , H cs U1 ⊕ ..., HcsUi−1), (HcsUi ,M1 ⊕ ...,M i−1). Next, we feed the pairs of explicit and implicit information into the information association module (IAM). Since the processing procedures for the two types of information are the same, we take the processing procedure for explicit information as an example to illustrate.
Based on the utterance pairs of Ui, including utterance-situation, utterance-dialogue history, and utterance-memory, the IAM bidirectionally identifies key associated words in the pairs’ sentences and stores them in the memory. Subsequently, the model continuously capture the associated words of the next utterance Ui+1 until the last dialogue utterance. This iterative process captures the explicit and implicit associations between the utterance and related sentences from multiple perspectives, thereby promoting better understanding of the dialogue.

heading: 3.4.2 Information Association Module
text: This module identifies associated words between relevant sentences, such as the situation and utterance. Inspired by the notion that "nodes highly attended by key nodes are likely important", we propose a second-order interaction attention mechanism with two processes: the first-order interaction attention identifies situation words attended by the overall utterance meaning as keywords (key nodes). The second-order interaction attention identifies utterance words attended by the keywords as associated words (the nodes highly attended by key nodes). This two-stage filtering selects associated words that explicitly reflect the connections between the two sentences.
Since associated words exist simultaneously in two sentences (e.g. in the utterance or situation), we bidirectionally select words from the sentences. For example, selecting associated words in the situation based on the utterance (i.e., u2s), and selecting associated words in the utterance based on the situation (i.e., s2u). For simplicity, we elaborate on the whole process using the example of s2u: (1) Constructing association matrices that contain association scores between words and are used for word identification. (2) First-order Interaction Attention, which identifies keywords in the situation. (3) Second-order Interaction Attention, which identifies associated words in the utterance based on the keywords in the situation. (4) Storing the bidirectionally associated words in memory for the next processing.
Constructing Association Matrices. To capture rich features, we construct two multi-head association matrices. As2t represents the association scores from the situation words to the utterance words, while At2s represents the association scores from the utterance words to the situation words.
As2tij = H
∥ n=1 σ((wnq v n s,i) T (wnkv n t,j)) (8)
At2sij = H
∥ n=1 σ((wnq v n t,i) T (wnkv n s,j)) (9)
where As2t ∈ RH×ds×dt , At2s ∈ RH×dt×ds and H is the number of multi-heads. Here, σ is the Sigmoid function.
First-order Interaction Attention. We identify keywords in the situation. Intuitively, the words that are associated as important by most other words are more likely to be important. Therefore, we select the words in the situation that have
higher degrees of association with utterance words as the keywords.
As = Mean(At2s) (10)
Ask1 = T̃ opk1(A s) (11)
where Mean and T̃ op are the average function and filter function respectively. k1 represents the number of important words to filter. And As ∈ RH×ds , Ask1 ∈ RH×k1 .
Second-order Interaction Attention. We select words in the utterance that have the highest degrees of association with the key situation words, as important associated words.
As2tk2 , E s2t k2 = Topk2(A t2s) (12)
Ẽs2tk2 = k2 ∥
k=1
As2tk · Es2tk (13)
Estt = A s k1 · Ẽs2tk1,k2 (14)
where As2tk2 ∈ RH×ds×k2 , Es2tk2 ∈ RH×ds×k2×dh , and they are the representations and scores of the utterance words attended by situation words, respectively. K2 is the number of associated words. Ẽs2tk2 ∈ RH×ds×(k2×dh), Estt ∈ RH×k1×(k2×dh) and dh is the hidden size. Estt is the representation of associated words.
We select the associated words from the situation in the same way. Subsequently, we concatenate the associated words of the situation and the utterance, where Est ∈ R(2H×k1)×(k2×dh).
Est = E st t ⊕ Ests (15)
Storing the Associated Words in Memory. Regarding explicit information, we select associated words between utterances and situations (Eeksc ), between utterances and dialogue history (Eekcc ), and between utterances and memory (Eekmc) in the same way.
Vek = E ek sc ⊕ Eekcc ⊕ Eekmc (16)
where Eeksc , E ek cc , E ek mc ∈ R(2H×k1)×(k2×dh).
Specifically, regarding implicit information, we also construct associated words between utterances and situations (Eiksc), between utterances and dialogue history (Eikcc ), and between utterances and memory (Eikmc). When iterating to the last sentence, we combine the explicit information memory Vek and the implicit information memory Vik as the
final associated information V .
Vik = E ik sc ⊕ Eikcc ⊕ Eikmc (17)
V = Vek ⊕ Vik (18)
where Eiksc , E ik cc , E ik mc ∈ R(2H×k1)×(k2×dh). V ∈ RLm×d and Lm is the number of associated words in the memory.
Based on the memory of associated words, we learn association information through an encoder Encm.
Hm = Encm(V ) (19)

heading: 3.5 Predicting Emotion and Generating Response

heading: 3.5.1 Prediction Emotion
text: In order to predict emotion, we input the dialogue utterance representation Hc, the situational representation Hs, into aggregation network ANu (Yang et al., 2023) to obtain emotion representations. We subsequently use these representations to separately predict the probability of emotions.
Pc = ϕ(ANu(Hc)) (20)
Ps = ϕ(ANu(Hs)) (21)
where ϕ is the softmax function. Pc, Ps ∈ Rde and de is the number of emotions.
Similarly, we also predict the emotion probabilities for the association representation Hm, and the reasoning knowledge representation Hcs.
Pa = ϕ(ANa(Hm)) (22)
Pcs = ϕ(ANcs(H̃cs)) (23)
where Pa, Pcs ∈ Rde . ANa, and ANcs represent aggregate networks with the same architecture but different parameters.
We multiply the above emotion probabilities as the final emotion probability. Then we use loglikelihood loss to optimize the parameters based on the emotion probability and the ground truth label e∗.
Pe = Pc(e ∗) · Ps(e∗) · Pa(e∗) · Pcs(e∗) (24)
Le = −log(Pe) (25)

heading: 3.5.2 Generation Response
text: To fully utilize the associative words containing important information, we design a word selector and flexibly incorporate associative information during decoding.
Word Selector. We select important associated words to utilize the effective information in memory.
Sm = σ(wvHm) (26)
S̃m, H̃m = Topk3(Sm, Hm) (27)
H̃m = S̃m · H̃m (28)
where Top is a selecting function that selects the top associated words with the highest scores from the memory Hm based on the score Ss. wv ∈ Rd×1 is a trainable parameter. H̃m ∈ Rk3×d and K3 is a hyperparameter.
Based on the representations of the utterance and associated words, we generate the decoding vectors Oc and Os , respectively.
Oc = Decc(Hc) (29)
Om = Deca(H̃m) (30)
where Decc and Deca represent decoders with the same architecture but different parameters. Oc, Om ∈ RLt×d, and Lt is the length of the response words at time t.
We then combine the decoding vectors to form O and use it to predict word probabilities.
g = σ(w(Oc ⊕Om)) (31) O = g ·Oc + (1− g) ·Om (32)
P (yt|y < t,D, S) = Generator(Ey<t, O) (33)
where w ∈ Rd×1 represents learnable parameters. Generator denotes the point generator (See et al., 2017) that transforms the decoded vectors into word probabilities.
Finally, we employ cross-entropy loss as the generation loss Lgen(yt). By integrating the generation loss Lgen(yt) and the emotion loss Le, we optimize the overall parameters.
Lgen(yt) = − T∑
t=1
log(P (yt|y < t,D, S)) (34)
L = Lgen(yt) + Le (35)

heading: 3.6 Baselines
text: To compare the performance of IAMM, we select the state-of-the-art models as baselines. EmpDG (Li et al., 2020) considers fine-grained emotional words and user feedback; KEMP (Li et al., 2022) enhances hidden emotional representations using a ConceptNet-based emotional
graph; CEM (Sabour et al., 2022) enhances emotion and cognition using reasoning knowledge; CASE (Zhou et al., 2023) aligns emotion and cognition from fine-grained and coarse-grained perspectives; SEEK (Wang et al., 2022) is a model that captures emotional-intention transitions in dialogue utterances; ESCM (Yang et al., 2023) captures emotion-semantic dynamic associations based on word-level emotions.

heading: 3.7 Implementation Details
text: We conduct experiments on the EMPATHETICDIALOGUES (Rashkin et al., 2019) dataset. The details are provided in Appendix A.

heading: 3.8 Evaluation Metrics
text: To comprehensively understand model performance, we conduct automatic and human evaluations.
Automatic Evaluation. Following previous methods (Li et al., 2022; Sabour et al., 2022), we use perplexity (PPL), accuracy (Acc), distinct-1 (Dist-1)/distinct-2 (Dist-2) (Li et al., 2015) to evaluate response fluency, emotion classification accuracy, and response diversity, respectively. Specifically, lower perplexity indicates better quality, while higher values are better for the other metrics.
Human Evaluation Metrics. We invite three professional crowdworkers to evaluate the response quality. Consistent with previous methods (Majumder et al., 2020; Yang et al., 2023), we conduct A/B testing to compare the baseline and IAMM. For a response, if IAMM has better quality, the crowdworkers add one point to Win. If IAMM is worse than the comparison model, they add one point to Lose. To evaluate quality, we consider em-
pathy (Emp.), relevance (Rel.), and fluency (Flu.): Empathy measures whether the emotion in the response is appropriate. Relevance measures whether the response is relevant to the dialogue topic and content. Fluency measures whether the language of the response is natural and fluent.

heading: 4 Results and Analysis

heading: 4.1 Main Results
text: Automatic Evaluation Results. As shown in Table 1, IAMM outperforms the baselines on most metrics. For emotion accuracy, IAMM significantly surpasses the baselines. This is because leveraging associated information facilitates dialogue subtle understanding, which promotes accurate emotional comprehension. In diversity, IAMM substantially surpasses the baselines. This is primarily attributed to the focused important associated words facilitating the generation of informative responses. Regarding perplexity, IAMM does not surpass the baseline. This is because the generated responses contain fewer generic sentences could have better perplexity and lower diversity. For instance, for the context “I am very ashamed in my grades”, responses like “I am so sorry to hear that” may have better PPL and lower diversity, but they are not relevant or empathetic to the context. In contrast, responses like “I know that feeling. I have a bad grade and I know how you feel” may have worse PPL compared to the former, but it is more likely to be relevant and empathetic to the context.
Human Evaluation Results. As shown in Table 2, IAMM also demonstrates better performance over the baselines in human evaluation. The model shows superiority in empathy. This is because focusing on the associations between utterances promotes delicate understanding, thus expressing appropriate emotional responses. The model is
excellent in relevance. This is primarily because associated words tend to be important words, and responses generated based on these significant words are more likely to be relevant. Regarding fluency, IAMM is better than the baselines in human evaluation, although it is worse on the automatic metric (PPL). This is primarily because the automatic metric (PPL) tends to favor sentences that are common in the training set, while human evaluation conforms better to natural language. IAMM generates fewer common and general sentences, such as "I am so sorry to hear that." Hence, the evaluation results turn out this way.

heading: 4.2 Ablation Studies
text: As shown in Table 1, we conduct the following ablation experiments to validate the effectiveness of each module: w/o EA: without explicit association; w/o IA: without implicit association; w/o WSD: without the associated word selector and decoder.
For emotion accuracy and diversity, the results show both explicit and implicit associative information have considerable influence. Explicit associative information contributes more to diversity, while implicit information contributes more to emotion inference. This indicates that associated words in explicit information are more easily utilized for expression, while those in implicit information are more conducive for emotion inference. For perplexity, incorporating both types of information leads to better perplexity, as more non-general informative expressions are generated. Furthermore, without the associated word selector and decoder, the model’s diversity decreases, owing to insufficient expression of key information.

heading: 4.3 IAMM on Large Language Models
text: Large language models have shown superior performance on multiple tasks (Chen et al., 2023; Qin et al., 2023; Sun et al., 2023; Tang et al., 2023; Wang et al., 2023; Zheng et al., 2023). To further verify the effect of iterative association on large
models, we first make the large model pay attention to the associated words captured by IAMM. We then use instructions to focus on the relationships between the associated words to deeply understand the dialogue. The verification methods include fine-tuning and non-fine-tuning. Regarding the fine-tuning method, we input the associated words through instructions on the Chinese-English mixed model ChatGLM3 (Du et al., 2022; Zeng et al., 2022) and conducted fine-tuning training. Regarding the non-fine-tuning method, we instruct GPT-3.5 to pay attention to the associated words and their relationships to enhance the model.
The experimental results are shown in Table 3. Compared with the baseline models, the models focusing on associative relationships have stronger emotion recognition and expression abilities, which further demonstrates the effectiveness of iterative associations.

heading: 4.4 Analysis of Associated Words
text: To further explore the characteristics of associated words, we collected 8,012 associated words on the test set and statistically analyzed their emotion intensity and inverse document frequency (IDF) 2. The analysis results show: (1) The most frequently attended words are common words (e.g., "that", "guys"). (2) Words that are paid more attention to (assigned higher weights) have either greater emotional intensity or are non-stop words (e.g. "traffic", "accident"). The main reasons are: (1) The model tends to correlate phrase-phrase and phrase-word associations, such as (swerve onto the shoulder, caused a accident) and (cuts me off in traffic, That) in Example 1. In the phrase-word associations, phrases often contain both common and uncommon words, while the individual words are typically common words. This results in more common words attended by the model. (2) The model places more emphasis on phrases with emotion or definite meanings. To better understand the emotion or meaning, the model often assigns higher weights to emotion words or uncommon words within the phrase. See Appendix C for details.

heading: 4.5 Case Study
text: We conduct case studies for the strongest baseline and IAMM. See Appendix B for details.
2Characteristics of IDF: The more common a word is, the lower its IDF score, and vice versa.

heading: 5 Conclusion and Future Work
text: In this paper, we have proposed an Iterative Associative Memory Model (IAMM) for empathetic response generation, inspired by the human iterative process of understanding emotions and cognition. It employs a novel second-order interaction attention mechanism to iteratively identify key associated words across dialogue utterances, enabling a more accurate understanding of the emotional and cognitive states. Automatic and human evaluations demonstrate that IAMM accurately understands emotions and expresses more empathetic responses. Experiments based on large language models and associated word analysis further validate the effectiveness of the iterative associations. In the future, we will explore empathetic comprehension mechanisms based on large language models.

heading: 6 Limitations
text: The limitations of our work are as follows: (1) This work is inspired by the text-based empathetic comprehension mechanism. As the better comprehension of empathy relies on multimodal and large language models, we will conduct research combining these aspects in the future. (2) Iterative association relies on situation information. Although it is prevalent and effective, some datasets still lack this feature. In the future, we will also explore how to effectively construct situation information.

heading: 7 Ethical Considerations
text: Regarding the potential ethical impacts of our work: (1) The dataset we use is EMPATHETICDIALOGUE, which is open source and does not involve any potential ethical risks. (2) The baseline models we use are also public and do not have potential moral impacts. Moreover, the components employed in our model are open-sourced or innovative and do not involve potential ethical risks.

heading: Acknowledgments
text: We are grateful to the reviewers for their diligent evaluation and constructive feedback, which helped enhance the quality of this paper. We also appreciate the insightful discussions and comments from the authors, which stimulated valuable thinking and contributed significantly to the development of this research. This work was supported by National Natural Science Foundation of China (No.61976054).

heading: A Appendix A
text: We conduct experiments on the EMPATHETICDIALOGUES (Rashkin et al., 2019) dataset, which contains 32 types of emotions, i.e. de = 32. In the encoder, the hidden size is d = 300. In the information association module, the numbers of heads and hidden layer size are H = 2 and dh = 20, respectively. The numbers of keywords and associated words are k2 = 15 and k1 = 5, respectively. And the number of selected keywords for the decoder is k3 = 5. The batch size of the model is set to 16. We optimize the model using Adam optimizer (Kingma and Ba, 2014) on an NVIDIA Tesla T4 GPU. The model converges after 14,400 iterations.

heading: B Appendix B
text: We select the strongest baselines to compare with IAMM. The details of the results are listed in Table 4.
In the first case, SEEK fails to correctly express the emotion of “proud”. ESCM incorrectly recognizes the emotion within. While IAMM perceives the speaker’s feeling of “proud” by identifying the associative words “accepted into harvar”. At the same time, it also understands the subject stated by the speaker, “my daughter”, thus incorporates emotions and responses appropriately in the response “bet she was so proud of her”.
In the second case, as the models fail to identify key information in the dialogue, SEEK and ESCM express general sentences. While IAMM discovers the key information “family” in the dialogue by associating “my family” and “they”. At the same time, by associating the emotion "ashamed" in the sentence, IAMM also clearly understands the emotion. Based on the key information and emotion, the model generates an empathetic response.
Overall, the iterative associated words in dialogues facilitate nuanced understanding. Additionally, by conveying key associated words, IAMM produces more informative and relevant responses.

heading: C Appendix C
text: To validate the characteristics of the associated words, we extracted 8,012 associated words from the test set that the model paid attention to. We statistically analyzed the data in terms of emotions and word frequency.
Figure 3 shows the results of the emotion analysis. The red line ranks words by attention counts from high to low, and calculates the average emotion intensity of the top k words. The blue line ranks words by the weight given by the model, and calculates the emotion intensity of the top k words. The gray line is the average emotion intensity of all words in the test set. The x-axis is the number of top k words, and the y-axis is the emotion intensity value. The red line indicates that the most attended words by the model have relatively low emotion intensity, while the blue line indicates that the most attended words by the model have high emotion intensity.
Figure 4 shows the results of word frequency analysis. The red line sorts words by attention counts and calculates the average inverse document frequency (IDF) of the top k words. The blue line sorts words by the weight given by the model, and the gray line is the average IDF for all words. Similarly, the x-axis represents the number of top k words, and the y-axis represents the IDF value. The red line indicates that the most attended words are the most common ones, while the blue line indicates that the most attended words are uncommon.
The overall results show that the model pays attention to common words with low emotions (e.g. "That", "it"), while its most highly weighted words have high emotion intensity or are less common.

heading: Future Work
text: As the better comprehension of empathy relies on multimodal and large language models, we will conduct research combining these aspects in the future. (2) Iterative association relies on situation information. Although it is prevalent and effective, some datasets still lack this feature. In the future, we will also explore how to effectively construct situation information