arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.12452cs.CL
收藏

基于MLA的潜在压缩Transformer用于高效长上下文建模

Latent-Condensed Transformer for Efficient Long Context Modeling

South China University of Technology(南方科技大学);Pengcheng Laboratory(鹏城实验室);AIGCode;Harbin Institute of Technology(哈尔滨工业大学);Pazhou Laboratory(琶洲实验室)

Zeng You, Yaofo Chen, Qiuwu Chen, Ying Sun, Shuhai Zhang, Yingjian Li, Yaowei Wang, Mingkui Tan

AI总结:

本文提出Latent-Condensed Attention,通过在MLA的潜在空间内压缩上下文,减少计算成本和KV缓存,同时保持性能。

摘要:

大型语言模型(LLMs)在处理长上下文时面临关键值(KV)缓存线性增长和自注意力二次复杂度的挑战。现有方法分别解决这些问题:多头潜在注意力(MLA)通过将标记投影到低维潜在空间减少KV缓存,而稀疏注意力减少计算。然而,稀疏方法无法在MLA的压缩潜在结构上原生操作,错过了联合优化的机会。本文提出潜在压缩注意力(LCA),在MLA的潜在空间内直接压缩上下文,将表示解耦为语义潜在向量和位置键。LCA通过查询感知池化聚合语义向量,并通过锚点选择保留位置键。此方法在不增加参数的情况下同时减少计算成本和KV缓存。除了MLA之外,LCA的设计是架构无关的,并可扩展到其他注意力机制如GQA。理论上,我们证明了长度无关的误差界。实验表明,LCA在128K上下文下实现了高达2.5倍的预填充加速和90%的KV缓存减少,同时保持竞争力的性能。

英文摘要:

Large language models (LLMs) face significant challenges in processing long contexts due to the linear growth of the key-value (KV) cache and quadratic complexity of self-attention. Existing approaches address these bottlenecks separately: Multi-head Latent Attention (MLA) reduces the KV cache by projecting tokens into a low-dimensional latent space, while sparse attention reduces computation. However, sparse methods cannot operate natively on MLA's compressed latent structure, missing opportunities for joint optimization. In this paper, we propose Latent-Condensed Attention (LCA), which directly condenses context within MLA's latent space, where the representation is disentangled into semantic latent vectors and positional keys. LCA separately aggregates semantic vectors via query-aware pooling and preserves positional keys via anchor selection. This approach jointly reduces both computational cost and KV cache without adding parameters. Beyond MLA, LCA's design is architecture-agnostic and readily extends to other attention mechanisms such as GQA. Theoretically, we prove a length-independent error bound. Experiments show LCA achieves up to 2.5$\times$ prefilling speedup and 90% KV cache reduction at 128K context while maintaining competitive performance.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑