A Static and Dynamic Attention Framework for Multi Turn Dialogue Generation

Wei-Nan Zhang, Yiming Cui, Kaiyan Zhang, Yifa Wang, Qingfu Zhu, Lingzhi Li, Ting Liu · DOI

TL;DR

The paper introduces a novel attention framework for multi-turn dialogue generation that combines static attention (fixed global context) and dynamic attention (context that updates at each decoding step). This dual-attention approach effectively models long dialogue histories without the vanishing gradient issues of traditional RNNs, successfully balancing response relevance with vocabulary diversity.

What Problem Does This Paper Address?

Building a conversational AI that can handle open-domain, multi-turn dialogues is a major hurdle in NLP. Unlike single-turn systems (which just map an input to an output), multi-turn chatbots must maintain context over an entire conversation history.

Previous state-of-the-art architectures relied on Hierarchical Recurrent Encoder-Decoder (HRED) models. These use one RNN to encode words into sentences, and a higher-level RNN to chain those sentences into a dialogue history. However, RNNs naturally suffer from vanishing gradients over long sequences, causing the chatbot to "forget" earlier parts of the conversation and default to generic responses like "I don't know." While newer self-attention mechanisms (like ReCoSa) mitigate this, they often treat the dialogue context as a static entity during response generation, failing to capture how the relevance of past utterances shifts as a reply is being written word-by-word.

Methods

The authors propose a framework that splits context processing into two distinct attention mechanisms:

  1. Static Attention: This calculates the importance of each historical utterance once, relative to the very last utterance, before the decoding process begins. This context vector remains unchanged throughout response generation, ensuring the model stays anchored to the core topic.
  2. Dynamic Attention: Instead of remaining fixed, this mechanism maintains a fluctuating weight matrix that updates the importance of past utterances at every single time step of the decoding process, conditioned on the decoder's current hidden state.
Fig. 2. The proposed attentive framework for the generation of open domain dialogues. Here, 𝑢∗denotes the ∗-th utterance in a conversation. ℎ∗is the hidden state. 𝑐∗and 𝑐indicate the context representations that are obtained by the dynamic attention and static attention respectively.

The framework also explores Hybrid Attention, combining both vectors via methods like concatenation, summation, linear interpolation, or element-wise pooling. Furthermore, the architecture is highly flexible: it supports multi-head attention, token-level enhancements, and can seamlessly integrate pretrained language models like GPT-2 to encode token embeddings.

Datasets

The framework was evaluated on two massive, distinct multi-turn dialogue benchmarks:

  • Ubuntu Dialogue Corpus: A dataset extracted from Ubuntu IRC logs. It features technical, formal, and entity-dense conversations with an average of 7.5 utterances per session.
  • OpenSubtitles Dataset: A corpus of movie dialogues. These conversations are highly casual, shorter, and exhibit much higher semantic variance, averaging 10 utterances per session.

Key Insights and Ideas

  • The Relevance vs. Diversity Trade-off: The paper reveals an inherent tension in dialogue modeling. Static attention excels at semantic fitting—making sure the response is highly relevant to the ground truth. Dynamic attention, by constantly shifting its context vector, introduces fluid randomness that significantly boosts response diversity (preventing repetitive or generic phrasing).
  • Context Length Dynamics: The performance of static vs. dynamic models scales differently with context length. Dynamic models require longer dialogue histories (more utterances) to effectively learn how to dynamically shift attention, whereas static models can generate high-quality responses using just the last three utterances.
  • Pretraining Synergy: Even though the framework relies on a standard encoder-decoder structure, simply swapping out initial token representations for pretrained GPT-2 embeddings yielded massive performance leaps, demonstrating excellent compatibility with modern transformer components.

Key Results

The models were evaluated using embedding-based similarity metrics (Average, Greedy, Extrema) and diversity metrics (Distinct-1, Distinct-2), alongside human evaluation.

  • Semantic Relevance: On the Ubuntu dataset, the Static model achieved the highest semantic relevance scores (Average: 0.6071, Greedy: 0.4535), outperforming strong baselines like HRAN and ReCoSa.
  • Response Diversity: The Dynamic model dominated diversity metrics on both datasets, achieving a Distinct-1 score of 0.82 and Distinct-2 of 3.54 on Ubuntu, nearly tripling the diversity of standard HRED models.
  • GPT-2 Integration: Combining the framework with GPT-2 embeddings provided the best overall results, significantly boosting diversity (e.g., Dynamic+GPT2 hit a Distinct-1 of 4.20 on OpenSubtitles).
  • Human Evaluation: Human annotators consistently rated the Static model highest for Coherence (1.070 on Ubuntu) and Naturalness (0.513), confirming that a stable global context prevents confusing or erratic chatbot behavior.

Limitations and Future Work

While the hybrid attention models (combining static and dynamic) successfully boosted response diversity, they occasionally suffered a drop in semantic relevance, indicating that poorly optimized combinations can cause the model's logic to drift away from the golden response. Additionally, integrating token-level attention sometimes introduced redundant information that destabilized training.

For future work, the authors plan to move beyond raw attention matrices and explicitly incorporate complex linguistic structures into the context loop—specifically targeting ellipsis (where words are omitted because they are understood from context) and anaphora (resolving what pronouns like "it" or "they" refer to across multiple turns).

Summary updated

BibTeX
@misc{zhang2024static,
  author = {Wei-Nan Zhang and Yiming Cui and Kaiyan Zhang and Yifa Wang and Qingfu Zhu and Lingzhi Li and Ting Liu},
  title = {{A Static and Dynamic Attention Framework for Multi Turn Dialogue Generation}},
  year = {2024},
  eprint = {2410.20766},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.20766},
}
Figure