Dual Dimensionality for Local and Global Attention
Zhiyuan Wang, Xuan Luo, Sirui Zeng, Xifeng Yan
NeurIPS page · OpenReview · alphaXiv · Open on the map
Category: Efficient LLM Inference & Training › Efficient Attention Mechanisms · Type: new method · Keywords: distance-adaptive attention, KV cache compression, local vs global representation, transformer efficiency, parameter-efficient inference
Areas: Long Context › Long-context mechanisms › In-context learning; Model Architectures & Sequence Modeling › Language Model Architectures › Linearized Transformers
Summary
DAR introduces distance-adaptive key/value representations that allocate higher dimensionality to local tokens and lower dimensionality to distant tokens, achieving performance comparable to full-dimensional baselines while reducing KV cache size.
Explained to a 5-year-old
Transformers are like smart assistants that read words one after another. They keep a memory of past words called a cache. Usually the memory for all words is the same size. This paper says that words close to the current word need bigger memory, while far words can have smaller memory. By giving local words bigger memory and far words smaller memory, the program works just as well but uses less memory.
Explained to a 5-year-old, longer
Transformers are like smart assistants that read text and predict the next word. They keep a record of the words they have already seen so they can remember them later. This record is called the KV cache. In most transformers, every word in the cache is stored with the same amount of information. However, the words that are right before the next word are more important for guessing it. The words that are far away are only used to remember things from a long time ago. This paper says that we should give the nearby words more information and the far words less information. By doing this, the model still works well but uses less space in the cache. This makes the model faster and easier to run on smaller computers. The experiments show that this idea works for different sizes of models. It also works when the model is fine-tuned for specific tasks. The result is a more efficient way to run large language models.
For a technical reader
The paper observes that transformer attention currently stores keys and values with the same dimensionality for all tokens, even though nearby tokens are more critical for prediction. It proposes a distance-adaptive scheme where tokens within a local window retain full dimensionality while farther tokens use a reduced dimension (e.g., one-quarter). This allocation preserves performance across model scales and fine-tuning while allowing a smaller KV cache. Experiments confirm that the approach matches full-dimensional baselines and outperforms uniform dimensionality reduction. The result is a simple modification that can reduce memory and latency during inference.
Problem
Current transformer attention uses uniform dimensionality for keys and values across all token positions, despite local tokens being more important for immediate predictions. This uniform allocation may waste capacity on distant tokens that serve mainly as long-range memory.
Method
The approach preserves full-dimensional key/value representations for tokens within a local context window and assigns reduced-dimensional representations (e.g., one-quarter of the original dimension) to tokens outside this window. This distance-adaptive allocation is applied across multiple model scales and during supervised fine-tuning.
Results
The distance-adaptive method matches full-dimensional baseline performance across model scales, while uniform dimensionality reduction degrades performance.
Contributions
It proposes a distance-adaptive allocation of representational capacity for keys and values, showing that local tokens benefit from richer representations and distant tokens can use lower dimensionality, enabling more efficient KV caches.
Limitations and assumptions
The study is limited to a controlled setting and may not capture all real-world scenarios.
Practical relevance
Enabling more compact KV caches can reduce memory and latency for inference, making large transformer models more practical on limited hardware.
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