Ark 架构按 token 路由注意力内核,2B 模型 64K 长上下文解码提速 3.8 倍
Not Every Token Deserves Softmax
做长上下文或推理优化的同学可以看看这篇:它把 softmax 和线性注意力缝在一个架构里,每个 token 自己决定走哪条记忆路径,64K 下比 FlashAttention-4 快 3.8 倍还省九成缓存。想给自研模型降推理成本的团队值得拿来对比 Mamba 和混合架构试试。
一篇新论文提出 Attention Routing Kernels(Ark),核心做法是不再对全部 token 统一使用固定内核,而是由一个可学习的路由器在每一层、每个 KV 组中为每个 token 单独选择内核:需要指数内核的 token 保留在 KV cache 中,其余 token 则折叠进固定大小的循环状态,每个 query 同时读取两份记忆。
由于只有被路由保留的 token 才进入 KV cache,Ark 的记忆开销大幅下降:在 400M–2B 参数规模上,Ark 与 Transformer 及 softmax/线性注意力混合架构性能相当,但分别节省约 90% 和 25–53% 的记忆。训练时采用线性时间的循环前向传播加保留键上的成对注意力,推理时则只携带固定大小循环状态和少量保留条目。
这种省内存直接转化为长上下文解码速度:在 64K 上下文下,2B 的 Ark 模型比 GLA 混合架构快 1.8 倍,比 FlashAttention-4 快 3.8 倍。相比 Mamba 类纯循环模型牺牲召回能力、Transformer 全量缓存 token 的两极方案,Ark 用路由机制在两种记忆之间按需分配,代码已在 GitHub 开源。
Not Every Token Deserves Softmax
Softmax and linear attention sit at opposite ends of a memory tradeoff because they compare tokens with different kernels. The former uses an exponential kernel and caches every token, growing memory linearly with length; the latter uses a linear kernel, which factorizes so that the past compresses into a fixed-size recurrent state, at the cost of limited recall. In both cases the kernel is fixed, so neither adapts computation or memory to the input. We introduce Attention Routing Kernels (Ark), an architecture that chooses the kernel separately for each token, in every layer and KV group. A learned router sends each token to exactly one of two memories: tokens that need the exponential kernel stay in a KV cache, and the rest are folded into a fixed-size recurrent state. Every query reads both memories. The routing split governs cost: training combines a linear-time recurrent pass with pairwise attention over retained keys, while inference carries a fixed-size recurrent state plus the retained entries in the KV cache. Across 400M--2B parameters, Ark is competitive with Transformers and with hybrids that interleave softmax- and linear-attention layers, while storing about 90% and 25--53% less memory, respectively. Ark's smaller memory thus speeds up long-context decoding: at 64K, the 2B model is $1.8\times$ faster than a GLA hybrid and $3.8\times$ faster than FlashAttention-4. Code is available at https://github.com/goombalab/ark.
本条情报归属 AITOP「论文」核心栏目,重点聚焦北美前沿实验室与硅谷科技巨头。在跨区域产业观察坐标中,该动态直接关联「AI 开发者工具链、Coding Agent 与工程化实践」「中美大模型技术代差与商业化对照」研究主线,反映出当前技术演进与商业落地的最新风向。涉及核心实体与技术议题包括:Ark、FlashAttention、线性注意力、KV cache,读者可通过下方标签进入对应专题页查阅历史脉络与关联对比。
信源核验说明:本文原始线索采编自「arXiv cs.LG」(@Aviv Bick, Arshia Afzal, Roger Waleffe, Aakash Lahoti, Mostofa Patwary, Mohammad Shoeybi, Bryan Catanzaro, Eric P. Xing, Albert Gu),经 AITOP 多维评分管线结构化提炼。截至目前,全网已有 2 家独立信源对该事件进行交叉印证与跟进报道(含 Together AI 等),属于近期高关注度行业信号。
- Together AI12-03 19:40原文