Virtual Head Attention
Xibo Ding, Guoxia Wang, Jinle Zeng, Jiabin Yang, Sirui Tao, Chao Yang, Dianhai Yu
NeurIPS page · Open on the map
Category: Efficient LLM Inference & Training › Efficient Attention Mechanisms · Type: new method · Keywords: attention mechanisms, KV cache optimization, model efficiency, linear transformations, large language models
Areas: Long Context › Long-context mechanisms › Attention optimizations; Model Architectures & Sequence Modeling › Language Model Architectures › Efficient Attention
Summary
Virtual Head Attention (VHA) improves the attention trade-off among KV cache size, compute, and model quality by using two lightweight linear operations that recover virtual head diversity while keeping the model compatible with existing GQA inference.
Explained to a 5-year-old
Imagine a big computer brain that reads long stories. It needs to remember some parts, like a memory, to answer questions. If it remembers too much, it becomes slow, and if it tries to be fast by remembering less, it can become less accurate. The researchers found a way to make the brain remember less while staying accurate and fast. They did this by using two simple tricks that change how the brain looks at the information it stores, and these tricks can be hidden inside the brain so it works like before, helping it run better on big computers.
Explained to a 5-year-old, longer
A big computer brain is used to understand long texts. To answer questions, the brain must keep some parts of the text in its memory. Keeping a lot of memory uses a lot of space and makes the brain slow. Trying to be fast by remembering less can make the brain forget important details. This creates a problem where you cannot have all three: small memory, fast speed, and good accuracy. The researchers wanted to solve this problem for long-context models. They discovered two simple tricks that change how the brain looks at the information it stores. The first trick slightly changes the way the brain reads the stored information to add back some variety. The second trick combines information from different parts of the brain using a simple mathematical trick. Because these tricks are simple, they can be hidden inside the brain’s normal calculations. This means the brain still works like the old version but uses less memory and runs faster. The new approach also keeps the brain’s answers just as good or even better. It works on many sizes of models, from small to huge industrial models. The researchers tested it on many different tasks and found it improved performance across the board. This makes the brain more useful for real-world applications where speed and memory matter.
For a technical reader
The paper addresses the classic trade-off in attention mechanisms between KV cache size, compute, and model quality. It proposes two linear transformations-Q Premix and Linear Postmix-that recover virtual head diversity without adding non-linear layers, allowing the model to be folded into existing GQA inference pipelines. Empirical results show consistent quality gains, up to 4× KV cache reduction, and up to 7.9% FLOPs savings across model scales, with further improvements on industrial-scale MoE models.
Problem
Designing attention mechanisms for long-context LLMs must balance KV cache size, training/prefill FLOPs, and model quality, but existing approaches cannot simultaneously improve all three. This creates an ``impossible triangle'' where improving one aspect typically harms another.
Method
The approach uses two lightweight linear operations: a near-identity Q Premix that transforms queries within each KV group to recover virtual head diversity, and a low-rank I + ABT Postmix that fuses inter-head features. These operations can be folded into the existing query and output projections, resulting in a model that behaves like standard GQA-2 at inference. The design halves the number of KV heads while keeping performance high.
Results
VHA improves model quality by +0.05% to +0.81% over GQA across four scales, reduces KV cache by 4× (dense) and 2× (MoE) compared to GQA-8/GQA-4, and cuts training/prefill FLOPs by up to 7.9% on the 1.7B model. On an industrial 30B-A3B MoE, it beats MLA and GQA-4 by +0.70%/+2.60% on the 12-benchmark suite.
Contributions
Introduces a method that simultaneously improves KV cache size, compute, and model quality for attention, using only linear operations that can be folded into existing projections, and demonstrates consistent gains across model scales and industrial-scale evaluation.
Practical relevance
Enables more efficient training and inference for large-scale long-context LLMs on existing hardware, reducing memory and compute requirements while maintaining or improving performance.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction