Kimi Linear: An Expressive, Efficient Attention Architecture

📄 arXiv: 2510.26692v2 📥 PDF

作者: Kimi Team, Yu Zhang, Zongyu Lin, Xingcheng Yao, Jiaxi Hu, Fanqing Meng, Chengyin Liu, Xin Men, Songlin Yang, Zhiyuan Li, Wentao Li, Enzhe Lu, Weizhou Liu, Yanru Chen, Weixin Xu, Longhui Yu, Yejie Wang, Yu Fan, Longguang Zhong, Enming Yuan, Dehao Zhang, Yizhi Zhang, T. Y. Liu, Haiming Wang, Shengjun Fang, Weiran He, Shaowei Liu, Yiwei Li, Jianlin Su, Jiezhong Qiu, Bo Pang, Junjie Yan, Zhejun Jiang, Weixiao Huang, Bohong Yin, Jiacheng You, Chu Wei, Zhengtao Wang, Chao Hong, Yutian Chen, Guanduo Chen, Yucheng Wang, Huabin Zheng, Feng Wang, Yibo Liu, Mengnan Dong, Zheng Zhang, Siyuan Pan, Wenhao Wu, Yuhao Wu, Longyu Guan, Jiawen Tao, Guohong Fu, Xinran Xu, Yuzhi Wang, Guokun Lai, Yuxin Wu, Xinyu Zhou, Zhilin Yang, Yulun Du

分类: cs.CL, cs.LG

发布日期: 2025-10-30 (更新: 2025-11-01)

备注: Kimi Linear tech report


💡 一句话要点

Kimi Linear:一种高效且富有表现力的线性注意力架构,性能超越传统全注意力。

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture)

关键词: 线性注意力 长上下文建模 Transformer 深度学习 模型优化

📋 核心要点

  1. 现有全注意力机制在处理长上下文时面临计算和内存瓶颈,限制了其在实际应用中的扩展性。
  2. Kimi Linear通过引入Kimi Delta Attention (KDA) 模块,利用细粒度的门控机制和优化的DPLR转换矩阵,提升了线性注意力的表达能力和硬件效率。
  3. 实验结果表明,Kimi Linear在性能上超越了全注意力机制,同时显著降低了KV缓存的使用量,并提高了解码吞吐量。

📝 摘要(中文)

我们提出了Kimi Linear,一种混合线性注意力架构,在各种场景下(包括短上下文、长上下文和强化学习(RL)扩展机制)首次在公平比较中优于全注意力。其核心是Kimi Delta Attention(KDA),一个富有表现力的线性注意力模块,它通过更细粒度的门控机制扩展了Gated DeltaNet,从而更有效地利用有限的状态RNN内存。我们定制的chunkwise算法通过Diagonal-Plus-Low-Rank(DPLR)转换矩阵的专用变体实现了高硬件效率,与一般的DPLR公式相比,大大减少了计算量,同时与经典的delta规则保持一致。我们预训练了一个具有3B激活参数和48B总参数的Kimi Linear模型,该模型基于KDA和多头潜在注意力(MLA)的逐层混合。实验表明,在相同的训练方案下,Kimi Linear在所有评估任务中都以相当大的优势优于全MLA,同时将KV缓存使用量减少高达75%,并实现了高达6倍的1M上下文解码吞吐量。这些结果表明,Kimi Linear可以作为全注意力架构的直接替代品,具有卓越的性能和效率,包括具有更长输入和输出长度的任务。为了支持进一步的研究,我们开源了KDA内核和vLLM实现,并发布了预训练和指令调整的模型检查点。

🔬 方法详解

问题定义:现有Transformer模型中的全注意力机制在处理长序列时,计算复杂度和内存占用呈平方级增长,导致训练和推理效率低下。此外,有限的状态RNN内存难以有效利用,限制了模型的表达能力。

核心思路:Kimi Linear的核心思路是利用线性注意力机制来降低计算复杂度,并通过引入Kimi Delta Attention (KDA) 模块来增强线性注意力的表达能力。KDA通过更细粒度的门控机制,能够更有效地利用有限的状态RNN内存,从而提升模型性能。

技术框架:Kimi Linear模型采用层级混合结构,将KDA和多头潜在注意力(MLA)相结合。KDA主要负责处理序列中的局部依赖关系,而MLA则负责捕捉全局信息。模型使用定制的chunkwise算法,通过Diagonal-Plus-Low-Rank(DPLR)转换矩阵的专用变体,实现高效的硬件加速。

关键创新:Kimi Delta Attention (KDA) 是最重要的技术创新点。它通过引入更细粒度的门控机制,扩展了Gated DeltaNet,使得模型能够更有效地利用有限的状态RNN内存。与现有线性注意力方法相比,KDA在表达能力上更接近全注意力,同时保持了线性复杂度。

关键设计:KDA模块的关键设计包括:1) 细粒度的门控机制,允许模型根据输入动态地调整每个token的注意力权重;2) 优化的DPLR转换矩阵,降低了计算复杂度,同时保持了与经典delta规则的一致性;3) chunkwise算法,通过将输入序列分成多个chunk,并行处理每个chunk,进一步提高了计算效率。

🖼️ 关键图片

img_0

📊 实验亮点

Kimi Linear在实验中表现出色,在相同的训练方案下,Kimi Linear在所有评估任务中都以相当大的优势优于全MLA,同时将KV缓存使用量减少高达75%,并实现了高达6倍的1M上下文解码吞吐量。这些结果表明,Kimi Linear可以作为全注意力架构的直接替代品,具有卓越的性能和效率。

🎯 应用场景

Kimi Linear具有广泛的应用前景,包括长文本生成、机器翻译、对话系统、代码生成等领域。其高效的计算和内存特性使其能够处理更长的上下文,从而提升模型在这些任务中的性能。此外,Kimi Linear还可以应用于资源受限的设备上,例如移动设备和嵌入式系统。

📄 摘要(原文)

We introduce Kimi Linear, a hybrid linear attention architecture that, for the first time, outperforms full attention under fair comparisons across various scenarios -- including short-context, long-context, and reinforcement learning (RL) scaling regimes. At its core lies Kimi Delta Attention (KDA), an expressive linear attention module that extends Gated DeltaNet with a finer-grained gating mechanism, enabling more effective use of limited finite-state RNN memory. Our bespoke chunkwise algorithm achieves high hardware efficiency through a specialized variant of the Diagonal-Plus-Low-Rank (DPLR) transition matrices, which substantially reduces computation compared to the general DPLR formulation while remaining more consistent with the classical delta rule. We pretrain a Kimi Linear model with 3B activated parameters and 48B total parameters, based on a layerwise hybrid of KDA and Multi-Head Latent Attention (MLA). Our experiments show that with an identical training recipe, Kimi Linear outperforms full MLA with a sizeable margin across all evaluated tasks, while reducing KV cache usage by up to 75% and achieving up to 6 times decoding throughput for a 1M context. These results demonstrate that Kimi Linear can be a drop-in replacement for full attention architectures with superior performance and efficiency, including tasks with longer input and output lengths. To support further research, we open-source the KDA kernel and vLLM implementations, and release the pre-trained and instruction-tuned model checkpoints.