让近距词用高维表示,远距词用低维,提升注意力效率
Dual Dimensionality for Local and Global Attention
- 近距词用全维表示,远距词降为1/4维,按距离自适应分配表征能力
- 在70M到410M参数模型上,性能接近全维基准,1B模型微调也表现良好
- 适合追求推理效率的场景,如长文本生成与部署优化
Decoder-only Transformer 对先前标记的键值缓存计算注意力。通常,键和值无论距离预测目标远近都使用相同维度表示。然而,在自然语言中,下一个词主要受前序词影响。我们假设局部与远端词对表征能力的需求不对称:局部词对即时输出预测更关键,需更高维表示;远端词仅作为长程记忆,低维表示即可满足。我们提出距离自适应表征(DAR)方法,在局部上下文窗口内保持全维表示,窗口外则降低维度(如原维度的1/4)。在70M至410M参数的多个预训练规模及1B规模模型的持续监督微调中,该方法性能接近全维基线。相反,统一降低所有位置维度会损害性能。结果挑战了键值维度应全局一致的常见假设,提示注意力架构可动态分配表征容量,有助于推理时进一步压缩键值缓存。
原文摘要 · Abstract (English)
Decoder-only Transformers compute attention over the KV cache of preceding tokens. Keys (and Values) are typically represented with the same dimensionality, regardless of its distance from the prediction target. In natural language, however, the next word is most strongly influenced by the immediately preceding tokens. We hypothesize that local and distant tokens impose asymmetric demands on representational capacity: local tokens are more critical for predicting immediate outputs and thus require richer representations, whereas distant tokens primarily serve as long-range memory, for which lower-dimensional representations may suffice. We formalize this idea as Distance-Adaptive Representation (DAR), implemented in a controlled setting that preserves full-dimensional representations within a local context window while assigning reduced-dimensional representations (e.g. 1/4 of the original dimensionality) to tokens beyond that window. Across multiple pretraining scales (70M to 410M parameters), as well as continued supervised fine-tuning on a 1B-scale model, this approach closely matches the performance of full-dimensional baselines. In contrast, uniformly reducing dimensionality across all token positions leads to worse performance. These results challenge the common assumption that key and value dimensionality should be uniform across token positions. Our findings suggest a new direction for designing attention architectures that adaptively allocate representational capacity across sequences, enabling further reductions in KV cache during inference.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。