Interleaved Head Attention

Sai Surya Duvvuri, Chanakya Ekbote, Rachit Bansal, Rishabh Tiwari, Fnu Devvrit, David Brandfonbrener, Paul Pu Liang, Inderjit S Dhillon, Manzil ZaheerNeurIPS 2026

TL;DR

In standard Transformers, attention heads operate in strict isolation within a layer: $H$ heads yield at most $H$ independent attention maps, forcing the model to rely heavily on network depth to piece together multi-step reasoning chains. Interleaved Head Attention (IHA) breaks down these silos by mixing queries, keys, and values across heads before computing attention, unlocking up to $P^2$ interaction patterns per head. Best of all, it achieves substantial gains in long-context retrieval and math reasoning while staying completely compatible with FlashAttention and adding zero overhead to the inference KV-cache.

What Problem Does This Paper Address?

Imagine trying to answer, "Where was the author of The Hobbit born?" You first link The Hobbit to J.R.R. Tolkien, and then Tolkien to South Africa. In a Large Language Model (LLM), Multi-Head Attention (MHA) handles these token-to-token relationships.

However, within a single layer, MHA suffers from a "head isolation" bottleneck. Each of the $H$ attention heads computes its own Query, Key, and Value projections and looks at the sequence independently—there is zero cross-talk during the attention step. Because $H$ heads produce exactly $H$ attention patterns (linear scaling), a single layer has limited bandwidth to compose multiple relationships simultaneously. Standard Transformers compensate for this by stacking more layers, deferring complex relational mixing to depth. The authors ask: Can we increase the compositional bandwidth inside a single layer without simply adding dozens of bulky new heads?

Methods

The authors propose Interleaved Head Attention (IHA), a drop-in replacement for MHA. Instead of modifying the core attention math—which often breaks hardware-friendly kernels—IHA rewires what goes into the attention operator.

Figure 1: Overview of Interleaved Head Attention (IHA). First, the model generates P pseudo- tokens for each of the H original heads via a learned linear transformation (×αQ) operating on the heads axis (green). These tokens are then interleaved to create an expanded sequence of length P · N. Finally, standard causal self-attention is computed on this expanded sequence, utilizing a sliding window (e.g., N/2P) to manage computational complexity while enabling cross-head interaction. Different linear transforms are used in query, key and values.

Here is how it works for a sequence of $N$ tokens and $H$ original heads:

  1. Cross-Head Mixing: For each head, IHA generates $P$ "pseudo-heads" (typically $P = H$). Each pseudo-query, pseudo-key, and pseudo-value is a learned linear combination of all $H$ original queries, keys, and values. This adds a tiny parameter overhead of $4H^2P$—a drop in the bucket when $H \ll d_{\text{model}}$.
  2. Sequence Interleaving: Rather than inventing a custom multi-head tensor operator, IHA interleaves these $P$ pseudo-tokens directly into the sequence dimension. Every original token becomes $P$ consecutive virtual tokens, stretching the sequence length from $N$ to $N \cdot P$.
  3. Standard Attention & Collapse: Standard causal scaled dot-product attention is run once over this expanded $NP$ sequence, allowing pseudo-queries and pseudo-keys to interact and form up to $P^2$ attention patterns per head. A learned linear projection then collapses the $P$ virtual tokens back into a single token representation.

Because Step 3 increases compute cost by $P^2$, the authors match FLOPs with standard Transformers by using a hybrid 4:1 schedule: four local sliding-window IHA layers (with window size $N / 2P^2$) followed by one global attention layer.

Datasets

  • Pretraining: 240B tokens (specific corpus name is not discussed in the paper; tokenized using the Llama 3 tokenizer).
  • Supervised Fine-Tuning (SFT): OpenThoughts (8B tokens) for reasoning, plus a 64k context-length fine-tuning run for long-context evaluation.
  • Evaluation Benchmarks: RULER (long-context retrieval), GSM8K and MATH-500 (mathematical reasoning), and MBPP and HumanEval (code generation).
  • Synthetic Tasks: Polynomial Graph Filters (a standard proxy for $k$-hop aggregation) and Count Permutation Match-3 (CPM-3), a newly introduced benchmark designed to test order-sensitive 3-token composition and counting (unlike polynomial filters, which ignore the order in which facts are combined).

Key Insights and Ideas

  • Quadratic Expressivity from Linear Mixing: By factoring multi-step operations across query-key pairs, IHA achieves quadratic reductions in head requirements. On synthetic $k$-step Polynomial Filters and CPM-3, one-layer IHA needs only $\mathcal{O}(\sqrt{k})$ and $\lceil\sqrt{N_{\max}}\rceil$ heads, respectively, compared to $\mathcal{O}(k)$ and $N_{\max}$ for MHA.
  • Hardware-Friendly by Design: Previous head-mixing methods (like Talking-Heads) mix attention logits during attention, creating memory bottlenecks. By interleaving pseudo-heads into the sequence before attention, IHA runs seamlessly on off-the-shelf FlashAttention and naturally assigns distinct RoPE positional phases to each virtual token.
  • Zero KV-Cache Bloat: You might expect $P$ pseudo-heads to multiply memory usage by $P$ during text generation. Instead, IHA caches the original $H$ keys and values and computes the lightweight linear mixtures on the fly—leaving the KV-cache footprint identical to standard MHA.

Key Results

Evaluated on FLOP-matched 2.4B-parameter Transformers against Global Attention, Global+Local, Talking-Heads, and Diff Transformer baselines:

  • Long-Context Retrieval (RULER): After 64k fine-tuning, IHA achieves the highest overall exact match average (44.0% vs. 35.0% for Global Attention and 40.6% for Global+Local). On Multi-Key Retrieval, it delivers massive relative gains over Global Attention: +27% at 4k, +32% at 8k, and +112% at 16k context lengths (roughly 10–20% absolute gains).
  • Math & Code Reasoning: After OpenThoughts SFT, IHA leads all math metrics under majority voting (Maj@16), hitting 54.2% on GSM8K (+5.8% over Global Attention) and 18.4% on MATH-500 (+2.8%). On MBPP coding, it places a close second (41.6% P@10) behind Talking-Heads (43.1%).
  • Throughput: At sequence length $N=16,384$, FLOP-matched IHA runs within 1–2% of standard MHA throughput.

Limitations and Future Work

  • Quadratic Cost of Global IHA: Expanding the sequence to $NP$ scales global attention complexity to $\mathcal{O}(P^2 N^2)$. While the 4:1 sliding-window hybrid schedule effectively neutralizes this cost in practice, running pure global IHA across every layer remains prohibitively expensive.
  • Future Directions: Rather than fixing $P=H$ uniformly across the network, the authors suggest exploring adaptive pseudo-head allocation per layer or head, alongside extending IHA to encoder–decoder and vision Transformer architectures.

Summary updated

Abstract

Multi-Head Attention (MHA) is the core computational primitive underlying modern Large Language Models (LLMs). However, within a single attention layer, MHA has an intrinsic linear scaling limitation: $H$ attention heads produce exactly $H$ independent attention matrices, with no communication between heads during attention computation. While deep Transformers can compose information across layers, this places much of the burden of building and combining intermediate relations on depth, potentially requiring additional layers to expose interactions useful for downstream computation. Our focus is complementary: increasing the compositional bandwidth available within each attention layer. To this end, we propose Interleaved Head Attention (IHA), which enables within-layer cross-head mixing by constructing $P$ pseudo-heads per head, typically with $P=H$, where each pseudo query, key, and value is a learned linear combination of all $H$ original queries, keys, and values, respectively. Interactions between pseudo-query and pseudo-key heads induce up to $P^2$ attention patterns per head with modest parameter overhead $\mathcal{O}(H^2P)$. We provide theory showing improved parameter efficiency on Polynomial Filters, where IHA uses $\Theta(\sqrt{k}n^2)$ parameters versus $\Theta(kn^2)$ for MHA, and on the order-sensitive CPM-3 task, where IHA uses $\lceil\sqrt{N_{max}}\rceil$ heads versus $N_{max}$ for MHA. On real-world benchmarks, IHA improves Multi-Key retrieval on RULER by 10–20% at 4k–16k context lengths and, after OpenThoughts reasoning fine-tuning, improves GSM8K by 5.8% and MATH-500 by 2.8% under majority voting over full attention, with modest throughput overhead.
BibTeX
@inproceedings{duvvuri2026interleaved,
  author = {Sai Surya Duvvuri and Chanakya Ekbote and Rachit Bansal and Rishabh Tiwari and Fnu Devvrit and David Brandfonbrener and Paul Pu Liang and Inderjit S Dhillon and Manzil Zaheer},
  title = {{Interleaved Head Attention}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=AoSjvxQp5K},
}
Figure