Cascaded Head-colliding Attention

Lin Zheng, Zhiyong Wu, Lingpeng Kong

TL;DR

Cascaded Head-colliding Attention (CODA) re-imagines the Multi-Head Attention (MHA) mechanism as a probabilistic latent variable model. By explicitly modeling interactions between attention heads through a hierarchical structure, CODA reduces head redundancy and improves parameter efficiency, leading to state-of-the-art gains in language modeling and machine translation with negligible computational overhead.

What Problem Does This Paper Address?

The Transformer architecture relies on Multi-Head Attention (MHA) to capture different types of relationships within a sequence. However, empirical studies have shown a frustrating reality: many of these heads are redundant. They often attend to the exact same regions of a sequence, effectively wasting the model's capacity.

In standard Transformers, heads are parameterized separately and act in parallel. Because there is no explicit mechanism for heads to "talk" to one another or coordinate their focus, they often converge on the same easy-to-learn features. The authors argue that if we want to improve the expressiveness and efficiency of Transformers, we need a way to encourage heads to extract complementary information rather than repeating each other.

Methods

The authors propose a probabilistic framework where each attention head is treated as a latent variable.

The "Head-Colliding" Concept

In probabilistic graphical models, a "collider" occurs when multiple independent variables influence a single observed variable. In CODA, the attention heads ($a_1, a_2, \dots, a_h$) are the independent variables that "collide" on the observed target sequence ($Y$).

Probabilistic graphical model of head-colliding attention

This structure introduces the "explaining-away" effect: if one head already explains a part of the data well, the probability of other heads needing to attend to that same part decreases. This naturally discourages redundancy.

Cascaded Architecture (CODA)

To make this computationally feasible across deep networks, the authors introduce a cascaded structure. They link heads across layers using a hierarchical variational distribution. Specifically, they add a "direct connection" where the attention logits of layer $L$ are influenced by a fused representation of all heads from layer $L-1$ via a small Multi-Layer Perceptron (MLP). This allows the model to pass information about what has already been "attended to" up the stack.

Datasets

The model was evaluated on three standard benchmarks:

  • Wikitext-103: A large-scale dataset for token-level language modeling.
  • WMT14 EN-DE: A standard benchmark for English-to-German machine translation.
  • IWSLT14 DE-EN: A smaller German-to-English translation dataset used for ablation studies and analysis.

Key Insights and Ideas

  • Expectation Placement Matters: In vanilla MHA, the model essentially calculates the expectation of each head before passing it through the final non-linear output function. CODA calculates the expectation after the non-linearity. Because the output function is complex and non-linear, this change allows for much richer interactions between heads.
  • Breaking the Scaling Curse: In vanilla Transformers, increasing the number of heads (while keeping total parameters constant) often leads to worse performance because each head becomes "weaker" and they still remain redundant. CODA flips this: as you add more heads, performance continues to improve because the heads are forced to be diverse.
Figure 3: Left: BLEU scores on test dataset for base transformers and CODA under different number of at- tention heads (higher is better); Right: Perplexity on validation dataset for base transformers and CODA un- der different number of attention heads (lower is bet- ter).
  • Visualizing Diversity: Using Jensen-Shannon Divergence (JSD) to measure the difference between heads, the authors show that CODA heads are significantly more distinct than those in a standard Transformer.
JSD heatmaps showing less redundancy in CODA

Key Results

CODA achieves consistent improvements over the baseline Transformer with almost no change in parameter count (only a ~0.02% increase due to the small MLPs):

  • Language Modeling (Wikitext-103): CODA improved perplexity by 0.6 over the baseline and even outperformed the best-reported setting of the baseline (which used a much larger context size) by 0.3.
  • Machine Translation (WMT14 EN-DE): CODA achieved a 0.6 BLEU point gain.
  • Machine Translation (IWSLT14 DE-EN): A significant 1.1 BLEU point gain was observed.

Limitations and Future Work

While CODA effectively reduces redundancy, the authors note a few areas for further exploration:

  • Priors: The current model uses relatively simple priors for the latent variables. Future work could investigate more expressive, data-driven priors to further guide head behavior.
  • Explicit Constraints: The framework allows for the potential to add explicit regularization or constraints on heads (e.g., forcing specific heads to focus on syntax vs. semantics), which was not fully explored in this paper.
  • Computational Complexity: Although the parameter increase is negligible, the hierarchical dependencies might introduce slight sequential overhead in training compared to the perfectly parallel nature of vanilla MHA.

Summary updated

BibTeX
@inproceedings{zheng2021cascaded,
  author = {Lin Zheng and Zhiyong Wu and Lingpeng Kong},
  title = {{Cascaded Head-colliding Attention}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-long.45},
}
Figure