Knocking-Heads Attention: Drop-in Shared Projections for Cross-Head Coordination

Zhanchao Zhou, Xiaodong Chen, Haoxing Chen, Zhenzhong Lan, Jianguo LiNeurIPS 2026

TL;DR

In standard multi-head attention, individual heads operate in isolation until the very end of the layer, missing out on helpful coordination. Knocking-Heads Attention (KHA) fixes this by slipping a tiny, shared transformation into the attention pipeline that subtly links all heads together via shared gradients during training. Best of all, it stabilizes notoriously rocky LLM training runs and boosts downstream reasoning—all while remaining 100% compatible with fast kernels like FlashAttention and adding zero (or near-zero) overhead at deployment.

What Problem Does This Paper Address?

Think of Multi-Head Attention (MHA)—the engine inside modern Large Language Models—as a committee of specialists reading a document. Each "head" has its own parameters and looks for different patterns in parallel, only pooling its notes at the final output projection.

Researchers have long suspected that letting these heads talk during the process could yield smarter representations. Previous attempts, like "Talking-Heads Attention," explicitly mixed attention maps across heads. The catch? Doing so requires materializing massive attention matrices in memory, which breaks compatibility with modern hardware-aware kernels like FlashAttention and slows training to a crawl. Other approaches force heads to share base projection weights, which saves memory but handcuffs their ability to specialize. The challenge is clear: how do you get attention heads to coordinate without ruining head specialization or sacrificing FlashAttention’s blazing speed?

Methods

Instead of mixing signals across heads, the authors couple them at the parameter level. Right after the standard head-specific Query, Key, and Value ($Q, K, V$) projections—and right before scaled dot-product attention—KHA inserts a shared projection module applied identically to every head's features.

Figure 1: The knocking-heads attention architecture. Purple represents the original multi-head attention, while pink represents the added knocking-heads projections. T Q and T K within the dashed box are optional projections due to their lower importance compared to T V .

Because this shared module acts within each head's feature dimensions rather than across the head axis, the actual attention computation stays completely independent per head (keeping FlashAttention and KV-caching happy). However, during backpropagation, every head sends gradients to this exact same shared parameter, creating an implicit "knocking" or coordination effect across the committee.

Crucially, KHA relies on identity-preserving (diagonal) initialization. At step zero of training, the shared module acts like an identity pass-through, recovering standard MHA so heads can specialize normally before cross-head structure gradually emerges. The authors introduce two variants:

  • KHA-Linear: Uses shared linear matrices. At inference time, these matrices can be mathematically absorbed into the original $Q, K, V$ weights, resulting in zero extra parameters or FLOPs at deployment.
  • KHA-MLP: Uses a small shared, sigmoid-gated MLP applied solely to the Value features, trading matrix absorbability for stronger non-linear expressiveness at less than 1% FLOP overhead.

Datasets

While the specific composition of the pretraining text corpora (ranging from 25B to 1 trillion tokens) is not detailed in the main text, the authors evaluate their models across 19 established downstream benchmarks (no new benchmarks are introduced):

  • General Knowledge & Reasoning: ARC-challenge, AGIEval, HellaSwag, WinoGrande, PIQA.
  • Professional Knowledge: MMLU, MMLU-Pro, CMMLU, C-Eval, CommonsenseQA, GPQA.
  • Language Understanding: RACE-middle, RACE-high.
  • Code: HumanEval-Plus, MBPP, MBPP-Plus.
  • Math: GSM8K, MATH, CMATH.

Key Insights and Ideas

  • Values do the heavy lifting: Ablating where to place the shared projection ($Q$, $K$, or $V$) reveals that transforming the Value projection yields almost the exact same loss reduction as transforming all three. Sharing learned representations in value space is where cross-head coordination shines brightest.
  • Initialization is make-or-break: Randomly initializing the shared matrices causes training loss to plateau at much worse values, likely because heads collapse into redundant functions early on. Starting as an identity map lets specialization happen first.
  • Implicit regularization tames loss spikes: Anyone who has trained a large Mixture-of-Experts (MoE) model knows the terror of sudden loss spikes. Because KHA forces all heads to share a bottleneck module, it constrains individual heads from developing wild, runaway activation norms—acting as a built-in stabilizer.
  • Less redundancy, tighter teamwork: When the authors randomly masked out attention heads at inference, KHA's loss degraded much faster than the baseline's. Rather than learning redundant, interchangeable features, KHA heads rely on a tighter division of labor.

Key Results

When scaling up to a 6.1B-parameter MoE model (1.01B active parameters) trained on 1 trillion tokens using Grouped-Query Attention (GQA), KHA-MLP delivered standout improvements:

Figure 2: (Left) Training loss over 1T tokens for 6.1B MoE models (1.01B activated parameters): baseline vs. knocking-heads attention. (Right) The comparisons of gradient norms. The results show that KHA maintains consistently lower training loss and exhibits better stability for both loss and gradient norm.
  • Benchmark Gains: Achieved a +1.26 point average boost across all 19 benchmarks, driven by major leaps in Language Understanding (+4.32), Code (+3.90, including +7.31 on HumanEval-Plus), and Math (+1.62).
  • Training Stability & Speed: Virtually eliminated the severe loss and gradient norm spikes seen in the baseline while maintaining a 0.015 lower pretraining loss. In head-to-head tests against Talking-Heads Attention, KHA ran ~4.5× faster per step (0.84s vs. 3.80s) by retaining standard FlashAttention-3 kernels.
  • Broad Compatibility: Tested across Dense (0.6B–3.9B) and MoE (2.3B–14.6B) scales, as well as MHA, MQA, GQA, GTA, and MLA variants. Notably, KHA-MLP works best for MoEs, whereas the zero-inference-cost KHA-Linear actually outperformed KHA-MLP on dense models.

Limitations and Future Work

The authors note two primary limitations. First, framing KHA's gradient-sharing stability and performance boost as "implicit regularization" is backed by empirical observation (such as more uniform activation norms) rather than a formal mathematical proof, leaving theoretical characterization for future work. Second, their experiments top out at a 14.6B-parameter MoE and 1T tokens; whether KHA's benefits hold—or grow—at 100B+ dense or multi-trillion-parameter frontier scales remains an open question.

Summary updated

Abstract

In standard multi-head attention, each head computes its output independently, with cross-head information exchange limited to the final output projection. Talking-heads attention introduces explicit inter-head mixing on attention maps, but is incompatible with FlashAttention and incurs significant overhead. We propose knocking-heads attention (KHA), which couples heads at the parameter level via a shared, diagonally-initialized projection applied to query/key/value features before the scaled dot-product attention. The shared projection does not mix signals along the head axis; instead, it is jointly optimized by gradients from all heads, providing an implicit regularization on the head-specific projections. The diagonal initialization recovers MHA at step 0 and lets cross-head structure emerge gradually. We instantiate KHA in two complementary forms: a linear variant (KHA-Linear) whose shared projection can be absorbed into the original weights at inference, adding zero parameters or FLOPs at deployment; and a non-linear variant (KHA-MLP) that obtains stronger gains by introducing a small shared MLP, at modest inference cost. Training a 6.1B parameter MoE model (1.01B activated) on 1T tokens, we observe substantially fewer loss spikes, more uniform per-head activation norms, and a +1.26 average improvement across 19 downstream benchmarks. KHA is compatible with FlashAttention, KV-caching, and existing attention variants (MHA, MQA, GQA, GTA, MLA).
BibTeX
@inproceedings{zhou2026knocking,
  author = {Zhanchao Zhou and Xiaodong Chen and Haoxing Chen and Zhenzhong Lan and Jianguo Li},
  title = {{Knocking-Heads Attention: Drop-in Shared Projections for Cross-Head Coordination}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=2Wv7TpQl5l},
}
Figure