Unsupervised Token-wise Alignment to Improve Interpretation of Encoder-Decoder Models

Shun Kiyono, Sho Takase, Jun Suzuki, Naoaki Okazaki, Kentaro Inui, Masaaki Nagata

Introduction

Encoder-Decoder (EncDec) architectures have become the standard for sequence-to-sequence tasks such as machine translation and document summarization. To interpret these models, researchers frequently rely on attention mechanisms to visualize which source tokens influence specific target token generation. However, recent evidence suggests that attention is an unreliable proxy for token-wise alignment. In EncDec models, the attention mechanism is "overloaded," tasked not only with alignment but also with capturing syntactic dependencies and word reordering. This often results in noisy attention maps that focus on punctuation or previous context rather than the semantically corresponding source word.

To address this, we present the Unsupervised Alignment Module (UAM), a plug-and-play component designed to explicitly learn token-to-token mappings without requiring labeled alignment data. By decoupling alignment from the core generation task, UAM provides a significantly clearer window into model behavior while maintaining competitive performance in headline generation.

The Unsupervised Alignment Module (UAM)

The UAM functions as a secondary prediction layer situated atop the decoder's hidden states. Its primary goal is to force the model to account for the source tokens it uses during the generation process.

Dual Prediction and Length Mismatch

At each decoding step $i$, the model performs two tasks: predicting the target token $o_i$ and predicting a corresponding source token $q_i$. Because headlines are typically much shorter than their source documents, many source tokens will not appear in the summary. To handle this, the UAM includes <null> tokens, allowing the model to align irrelevant source information to a non-content placeholder.

Sentence-wise Prediction Module (SPM)

Since ground-truth token alignments are unavailable, the UAM is trained using a novel "Bag-of-Words" loss. The Sentence-wise Prediction Module (SPM) aggregates the source token predictions across the entire generated sequence. The core objective is to ensure that the sum of all predicted source token distributions matches the actual distribution of words in the original source sentence $X$.

Figure 1: The architecture of the Unsupervised Alignment Module (UAM). The model uses a Sentence-wise Prediction Module (SPM) to align predicted source tokens with the actual source bag-of-words via an unsupervised loss.

By minimizing the L2 distance between the predicted aggregate and the true source word counts, the model is incentivized to "assign" each source word to a specific decoding step where it is most relevant.

Experimental Evaluation

The UAM was evaluated on the task of headline generation using the English Gigaword dataset (~3.8M pairs) and the MSR-ATC test set, which features human-annotated summaries. Performance was measured using standard ROUGE scores for summarization quality and manual alignment accuracy for interpretability.

Results and Qualitative Analysis

Quantitative Improvements

The results demonstrate a stark contrast between standard attention and the UAM. In manual evaluations of 100 instances, the standard attention mechanism achieved a meager 6.71% alignment accuracy. In contrast, the UAM reached 51.41%, representing a massive leap in the model's ability to provide interpretable explanations for its outputs.

Crucially, this increase in interpretability does not come at the cost of performance. On the MSR-ATC dataset, the UAM-equipped model achieved a ROUGE-1 score of 32.32, significantly outperforming the previous state-of-the-art (SEASS) score of 25.75.

Qualitative Clarity

Visualizing the alignment matrices reveals the impact of the UAM. While traditional attention maps are often blurry or fixated on periods and common stop words, UAM heatmaps produce sharp, intuitive alignments.

Figure 5: A UAM alignment matrix for a headline generation task. Note the clear diagonal-like mappings between corresponding concepts (e.g., "egyptian" to "egyptian") and the effective use of <null> tokens for filtering out irrelevant source details.

As seen in Figure 5, the model successfully maps specific headline words like "egyptian" and "fm" (foreign minister) back to their exact counterparts in the source text. The <null> tokens effectively absorb the "noise" of the source sentence—words that are necessary for the full text but irrelevant for a concise headline.

Conclusion

The Unsupervised Alignment Module proves that explicit alignment modeling is superior to relying on internal attention for model interpretation. By treating alignment as a distinct, unsupervised task, the UAM provides researchers with a high-fidelity tool for understanding "black-box" neural networks without sacrificing the predictive power of the underlying Encoder-Decoder architecture. Future work will explore extending this one-to-one token mapping to more complex phrase-level alignments.

Summary updated

BibTeX
@inproceedings{kiyono2018unsupervised,
  author = {Shun Kiyono and Sho Takase and Jun Suzuki and Naoaki Okazaki and Kentaro Inui and Masaaki Nagata},
  title = {{Unsupervised Token-wise Alignment to Improve Interpretation of Encoder-Decoder Models}},
  booktitle = {BlackboxNLP @ EMNLP},
  year = {2018},
  doi = {10.18653/v1/w18-5410},
}
Figure