Virtual Head Attention cuts cache while preserving model quality
Virtual Head Attention · arXiv:2610.17959
In plain words
When a language model reads a long passage, its attention mechanism keeps a key-value (KV) cache, which takes memory. Sharing fewer cached heads can save memory but may lower answer quality.
The paper introduces Virtual Head Attention. It learns query and output mixing while training, then folds those operations into ordinary attention for use at inference.
Across four small models, its average accuracy on eight multiple-choice tests was slightly above the matching grouped-query attention models; that average does not mean every test improved.
The research
As language models handle longer contexts, their attention cache uses more memory, while reducing shared key-value heads can damage model quality. Can an attention design reduce this memory burden and training computation without losing accuracy?
The paper tests whether learned transformations can recover useful attention behavior with fewer physical heads.
Virtual Head Attention learns query diversity and cross-head mixing during training, then folds both into standard grouped-query attention for inference.
The authors pretrained four Qwen3-architecture model scales on 50B tokens and compared VHA with grouped-query attention using the standard per-scale key-value head counts. On eight zero-shot multiple-choice tests, average accuracy at each scale was 0.05 to 0.81 percentage points higher with VHA.
At 1.7B, VHA also used 1.00 KB of BF16 key-value cache per layer per token versus 4.00 KB for GQA-8; its training computation was 7.9% lower at sequence length 4096.
Together, these measurements support a quality and efficiency balance in these tests, while the accuracy averages do not imply gains on every test.
The small-model accuracy figures are averages across eight tests, so they do not show that VHA improved every test.
The comparisons also do not establish that all training settings were identical; the larger-model and long-context results come from separate studies with their own model and training setups.
What the evidence shows
- The cache and quality tension
Virtual Head Attention (VHA) is an attention method for large language models that addresses a design tension: reducing the number of key-value heads can shrink the memory cache, but may also lower model quality.
The method uses two key-value heads and half the physical query heads of the grouped-query attention configurations it compares against, then adds learned transformations to recover query diversity and mix attention outputs.
- What the small models showed
The authors tested Qwen3-architecture models at four scales, from 0.6B to 8B-A1B, after pretraining on 50B tokens with a 4K context. On eight standard multiple-choice tests, they averaged zero-shot accuracy separately at each model scale.
VHA’s average was 0.05 to 0.81 percentage points above the corresponding grouped-query attention baseline. Because these are averages, they do not show that VHA scored higher on every test.
- Memory and training cost
The memory and computation measurements add context to that accuracy comparison. At 1.7B, VHA used 1.00 KB of BF16 key-value cache per layer per token, versus 4.00 KB for GQA-8.
At sequence length 4096, the authors counted training operations per token across transformer layers and found 7.9% fewer for VHA. That count describes training computation, not inference speed.
- Controls test the explanation
A 1.7B control test compared head-count reductions with VHA’s added operations. Reducing GQA-8 to two key-value heads lowered average accuracy by 1.00 point; also halving physical query heads lowered it by another 0.71 points.
VHA used that same doubly reduced head-count shape but averaged 0.41 points above GQA-8. Separate tests at 1.7B and 4B found that neither Premix nor Postmix alone consistently matched the joint method’s gains at both scales.
- Results in separate settings
Separate evaluations extended the comparison to other settings. A 30B-A3B model’s accuracy macro-average across four task categories was 50.36% for VHA, versus 47.76% for GQA-4 and 49.66% for MLA.
In a matched 10B-A1B long-context study, VHA’s RULER score averaged across lengths from 8K to 128K was 84.4, compared with 73.0 for GQA. Those findings apply to the specific models and recipes tested.
Deep
- Original paper authors
- Xibo Ding, Guoxia Wang, Jinle Zeng, Jiabin Yang, Sirui Tao
- Submitted to arXiv
- License
- arXiv non-exclusive