你本可以想出 Kimi 的 Delta Attention。
A walk through of the DeltaNet family of linear attention variants

原始链接: https://blog.doubleword.ai/you-could-have-come-up-with-kimi-delta-attention

本文介绍了 **Kimi Delta Attention (KDA)**,这是一种在 Qwen 和 Kimi 等现代大语言模型中使用的内存高效型线性注意力机制。 ### 核心问题 标准的 Softmax 注意力机制需要 $O(T^2)$ 的内存和计算量,因为每个查询(Query)都必须检查整个历史记录。线性注意力机制通过将 Softmax 替换为固定大小的状态矩阵 $S_t = \sum |v_i\rangle\langle k_i|$ 来尝试解决这一问题,从而实现 $O(T)$ 的递归。然而,简单的加法更新会导致“干扰”,即新的写入会破坏先前的关联。 ### DeltaNet 的解决方案 DeltaNet 通过使用**增量规则修正(delta-rule correction)**来解决此问题:它不直接添加整个值,而只添加*残差*(新值与当前内存预测值之间的差额)。 * **门控 DeltaNet (Gated DeltaNet)** 增加了一个标量保留门 $\alpha$,以允许模型进行遗忘。 * **KDA** 将其升级为对角保留矩阵 $D_t$,使模型能够有选择地遗忘特定的键通道(key channels)。 ### 实现方式 KDA 为相同的数学递归提供了两种执行模式: 1. **递归模式 (Decode):** 使用串行向量运算,非常适合低延迟、有状态的推理。 2. **分块模式 (Chunkwise/Training/Prefill):** 将计算重组为并行矩阵乘法,利用张量核心实现海量吞吐量。

```Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 你本可以想出 Kimi Delta Attention (doubleword.ai) 28 分,由 AnhTho_FR 发布于 30 分钟前 | 隐藏 | 过往 | 收藏 | 2 条评论 | 帮助 rekshaw 2 分钟前 | 下一条 [–] 粗略读过之后,我可以自信地说,事实上,我确实想不出 Kimi Delta Attention。 回复 world2vec 0 分钟前 | 父评论 | 下一条 [–] 我也完全想不出。 回复 考虑申请 YC 2026 年秋季班吧!申请截止日期为 7 月 27 日。 准则 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索: ```
相关文章

原文

Math notation

A note on notation: this article defaults to bra-ket notation because (in my quantum-inspired opinion) it makes the shapes in this derivation very clear. The Math notation switch above rewrites every equation using conventional bold vectors and explicit transposes instead. In bra-ket mode, q\lvert q\rangle is a column vector, k\langle k\rvert is a row vector, kq\langle k\rvert q\rangle is a number, and vk\lvert v\rangle\langle k\rvert is a matrix. Vectors face right by default, while keys face left when written into the linear-attention state. We work with one causal attention head and real-valued vectors, assume DeltaNet’s keys are normalized, and let the state map from key space to value space.

Modern linear attention variants are complex, and a upon first glance it is not so easy to see what they are designed to achieve. For reference here is the state update equation for Kimi Delta Attention (KDA):

S~t=St1Diag(αt)\widetilde S_t = S_{t-1}\operatorname{Diag}(\alpha_t)
联系我们 contact @ memedata.com