Hierarchical Transformer for Task Oriented Dialog Systems

Bishal Santra, Potnuru Anusha, Pawan Goyal

Introduction

Task-oriented dialog systems must navigate complex conversational structures where each turn consists of distinct utterances with internal semantic patterns. While standard Transformer architectures have become the backbone of modern NLP, they typically treat dialog history as a flat sequence of tokens. This approach often fails to explicitly capture the inherent hierarchy of human conversation—the nesting of words within utterances and utterances within a broader context.

This paper introduces the HT-Encoder (Hierarchical Transformer Encoder), a framework designed to bake this hierarchical inductive bias directly into the Transformer architecture. By leveraging specialized attention masks and dual-level positional encodings, the HT-Encoder achieves state-of-the-art performance on task-oriented benchmarks like MultiWOZ without sacrificing the parallelization benefits of the original Transformer.

The HT-Encoder Framework

The core innovation of the HT-Encoder is its two-stage processing pipeline, which "morphs" a standard Transformer into a hierarchical one.

The HT-Encoder architecture featuring dual-level positional encodings and a two-stage encoding process.

As shown in the architecture above, the model consists of:

  1. Shared Utterance Encoder: A stack of $M$ layers that processes each utterance independently. This stage focuses on extracting local, intra-utterance features.
  2. Context Encoder: A stack of $N$ layers that takes the output of the first stage to model dependencies across the entire dialog history.

To support this structure, the authors introduce Dual Positional Encodings. Unlike standard Transformers that use a single index, the HT-Encoder uses Local Positional Encodings (representing a word's position within its utterance) and Global Positional Encodings (representing the utterance's position within the dialog).

Specialized Attention Masking

The hierarchy is enforced primarily through the use of specialized attention masks, which control the flow of information between tokens at different stages of the model.

Visualization of UT-Mask and CT-Mask variants used to enforce hierarchical structure.
  • UT-Mask (Utterance Mask): Applied in the Shared Utterance Encoder, this block-diagonal mask ensures that tokens only attend to others within the same utterance, preventing early cross-utterance interference.
  • CT-Mask (Context Mask): Applied in the Context Encoder, this mask defines how utterances interact. In the "HIER" variant, the mask allows the final utterance to attend to all preceding context, synthesizing a comprehensive dialog representation.

The authors propose several variants: HIER, which passes all contextualized token embeddings to the context layer; HIER-CLS, which uses a single representative token per utterance to reduce complexity; and HIER++, which integrates additional dialog act information.

Experimental Results

The HT-Encoder was evaluated on the MultiWOZ (v2.0) dataset, a standard benchmark for multi-domain task-oriented dialog. The results demonstrate the clear advantage of hierarchical modeling:

  • Performance Gains: The HIER model achieved a Combined Score of 87.76, significantly outperforming the flat Transformer baseline (84.60) and RNN-based hierarchical models like HRED (83.3).
  • Oracle Policy: With the inclusion of dialog acts (HIER++), the model reached a score of 116.39, surpassing specialized architectures like HDSA and SimpleTOD.
  • Versatility: Integrating the HT-Encoder into the "Marco" model improved its success rate from 73.5% to 75.8%, highlighting its "plug-and-play" potential for existing systems.

Conclusion

The HT-Encoder demonstrates that explicitly modeling conversational hierarchy through masking and positional encoding provides a powerful inductive bias for task-oriented dialog. By preserving token-level nuance while enforcing structural constraints, the model achieves superior performance over flat architectures. Future work will explore the application of these hierarchical masks to other document-level tasks, such as long-form summarization and multi-document question answering.

Summary updated

BibTeX
@inproceedings{santra2021hierarchical,
  author = {Bishal Santra and Potnuru Anusha and Pawan Goyal},
  title = {{Hierarchical Transformer for Task Oriented Dialog Systems}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.naacl-main.449},
}
Figure