Mem2Seq: Effectively Incorporating Knowledge Bases into End-to-End Task-Oriented Dialog Systems

Andrea Madotto, Chien-Sheng Wu, Pascale Fung

Abstract

End-to-end task-oriented dialog systems usually suffer from the challenge of incorporating knowledge bases. In this paper, we propose a novel yet simple end-to-end differentiable model called memory-to-sequence (Mem2Seq) to address this issue. Mem2Seq is the first neural generative model that combines the multi-hop attention over memories with the idea of pointer network. We empirically show how Mem2Seq controls each generation step, and how its multi-hop attention mechanism helps in learning correlations between memories. In addition, our model is quite general without complicated task-specific designs. As a result, we show that Mem2Seq can be trained faster and attain the state-of-the-art performance on three different task-oriented dialog datasets.

Introduction

Building task-oriented chatbots—systems designed to assist users with specific tasks like booking restaurants or providing navigation—remains a significant challenge. Traditional systems rely on modular pipelines (Natural Language Understanding, Dialogue Management, and Natural Language Generation), which are often brittle and labor-intensive to design. While end-to-end neural models offer a more streamlined alternative, they struggle with two critical issues: effectively integrating structured data from external Knowledge Bases (KB) and handling Out-of-Vocabulary (OOV) entities, such as specific addresses or names not seen during training.

Methodology: The Mem2Seq Architecture

Mem2Seq addresses these challenges by combining multi-hop memory networks with a pointer mechanism. The architecture consists of two primary components: a Memory Encoder and a Memory Decoder.

The Mem2Seq architecture: (a) the memory encoder and (b) the memory decoder with pointer mechanism.

Memory Encoder

The encoder stores dialog history and KB tuples (e.g., [The Westin, Distance, 5 miles]) as vectors in a multi-hop memory. This "multi-hop" approach allows the model to perform multiple passes over the data, refining its internal representation and learning complex correlations between different memory entries.

Memory Decoder and Pointer Mechanism

The decoder is a Gated Recurrent Unit (GRU) that generates responses word-by-word. At each time step, the model generates a query to the memory. The "secret sauce" of Mem2Seq is its ability to choose between two generation modes:

  1. Vocabulary Mode: Selecting a common word from a fixed vocabulary (e.g., "the", "is").
  2. Pointer Mode: Directly copying a token from the memory (e.g., "436 Alger Dr").

This choice is mediated by a Sentinel ($) token. If the attention mechanism points to the sentinel, the model generates a word from the standard vocabulary; otherwise, it copies the corresponding entry from the memory. This mechanism is crucial for handling OOV entities, as the model can copy facts directly from the KB even if it has never encountered them during training.

Evaluation and Results

The researchers evaluated Mem2Seq on three benchmarks: the simulated bAbI Dialog, the real-world DSTC2, and the complex In-Car Assistant dataset.

Qualitative comparison of Mem2Seq against baseline models on the In-Car Assistant dataset.

Performance and Robustness

Mem2Seq achieved state-of-the-art results across all datasets. Notably, on the bAbI Task 5, it reached 97.9% per-response accuracy. In OOV scenarios, where traditional Seq2Seq models often fail, Mem2Seq maintained high performance due to its direct copying capability. As shown in the qualitative examples, Mem2Seq successfully retrieves and incorporates specific KB entities like "Palo Alto Cafe" and its address, whereas baseline models often produce generic or incorrect information.

Efficiency

Beyond accuracy, Mem2Seq is highly efficient. By treating dialog history and the KB as memory blocks rather than sequential inputs, it avoids the computational overhead of processing long sequences step-by-step. On the In-Car Assistant dataset, Mem2Seq trained up to five times faster than standard Seq2Seq models with attention.

Discussion and Future Work

The success of Mem2Seq highlights the importance of multi-hop reasoning and pointer mechanisms in task-oriented dialog. Visualizations of attention weights revealed that the model uses initial hops for broad searches and final hops to "sharpen" its focus on the correct token to copy.

While highly effective, future work could explore integrating Reinforcement Learning to further improve response naturalness or developing advanced indexing methods to scale the memory mechanism to massive Knowledge Bases.

Conclusion

Mem2Seq provides a powerful, general-purpose framework for task-oriented dialog systems. By effectively bridging the gap between neural generation and structured knowledge, it enables the creation of more accurate, robust, and efficient conversational agents.

Summary updated

BibTeX
@inproceedings{madotto2018mem,
  author = {Andrea Madotto and Chien-Sheng Wu and Pascale Fung},
  title = {{Mem2Seq: Effectively Incorporating Knowledge Bases into End-to-End Task-Oriented Dialog Systems}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2018},
  url = {https://openreview.net/forum?id=BJ--Lixd-H},
}
Figure