DAR-Attention
A Pythia-style decoder whose keys and values stay full-width inside a local window and shrink to a quarter beyond it.
Language · 555 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Language
- Parameters
- 71.2M
- Operations
- 555
- Framework
- PyTorch
- Recurrent
- No
- Published
- 2026
- Cited by
- 1 (as of 24 November 2026)
- Authors
- Zhiyuan Wang, Xuan Luo, Sirui Zeng, Xifeng Yan
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m460
- Graph hash
- d85f5c7c258d7bba6ee8f7d58bfd9cb81999070a7b070ec1c057727ef6b66e82
- Skeleton hash
- a71e53ec6eb45462194d6d03c458e0d26ba7ea2fc54cf319318c89bc14aff456
- Architecture hash
- d6d47a407a2e0e14550faa5347750ef25be3cd4a21603a6a7cfcd25705b2ace6
- Diagram SHA-256
- 1cfd9683350237d12196b0ee8acd25ba41f9ee4988bb86f133937fbe09bea6a3
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
DAR, short for Distance-Adaptive Representation, is an attention design for decoder-only Transformers in which keys and values keep full dimensionality inside a local context window while tokens beyond that window get reduced-dimensional representations, for example a quarter of the original. The hypothesis is that local and distant tokens impose asymmetric demands on representational capacity: local tokens need richer representations, while distant tokens mainly serve as long-range memory. The captured member follows the paper's pretraining setup, which uses the Pythia-70M architecture.
For each token, the original hidden state is kept within a window of w recent positions, and a lightweight projection produces a lower-dimensional alternative for tokens beyond it. The bottleneck dimensionality is the central hyperparameter of the design. So that the key and value projections can be shared, the bottlenecked representation is lifted back to the model dimension before computing keys and values along the global path. This up-projection does not restore the information lost in the bottleneck. Attention thus runs along two paths, a local path for tokens within the window and a global path for tokens beyond it. During training, each past token maintains two representations. No auxiliary losses or additional supervision signals are introduced. A variant with a sigmoid after the down-projection performed comparably, so the simpler linear projection is used throughout.
At the Pythia-70M scale with w = 128, DAR with the bottleneck at 256 or 128 outperforms the full-dimensional baseline, and only at 64 does noticeable degradation appear. Applying the same reduction uniformly to all tokens degrades more sharply, reaching a relative perplexity of 105.49% at 128 where DAR stays at 99.61%. With the bottleneck fixed at a quarter of the model dimension, DAR slightly outperforms the baseline at 70M, is essentially equal at 160M and outperforms it more clearly at 410M. A window-size sweep found performance largely unchanged for w ≥ 4, degrading only slightly at w = 1. Continued supervised fine-tuning of a 1B-scale model with the modification preserves downstream task performance. One caveat the authors flag: the current implementation stores two sets of key and value states per token, doubling the KV cache memory compared to vanilla attention. The experiments ran on NVIDIA 8xA100 and 4xGH200 GPUs.
Key idea. Distance-Adaptive Representation: allocating key and value dimensionality by a token's distance from the prediction target, full within a local window and reduced beyond it, which matches full-dimensional baselines where uniform reduction fails and challenges the assumption that key and value dimensionality should be uniform across positions.
- dar
- distance-adaptive representation
- DAR-Attention
- dual dimensionality for local and global attention
- kv cache compression
- local global attention
- pythia
- low-rank keys and values
- language model
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{wang2026dualdimensionalitylocalglobal,
title={Dual Dimensionality for Local and Global Attention},
author={Zhiyuan Wang and Xuan Luo and Sirui Zeng and Xifeng Yan},
year={2026},
eprint={2606.18587},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2606.18587},
}