浅层编码释放深层记忆
Shallow Encoding Emits Deep Memories
AI总结:
该研究针对混合语言模型的记忆冗余问题,提出SEED方法,通过浅层预填充与状态压缩降低计算开销,在多参数规模模型上几乎无损失,将Qwen3.8-Flash-Next的GPU吞吐量提升1.2-1.4倍。
摘要:
混合语言模型将少量softmax注意力层与大量线性注意力层或状态空间层交错排列,因此每一层都保留了早期token的记忆:键值缓存或固定大小的循环状态。服务这些记忆所需的计算和高带宽内存超过了输出要求。预填充阶段会为每个prompt token运行所有层,而每个解码步骤会加载和存储完整的循环状态,在Qwen3.8-Flash-Next上,每个请求的字节数相当于数千个token的注意力缓存。我们发现训练后的混合模型的两个特性可定位这种冗余:第一,写入比读取更容易:写入深层层的某个token的记忆所需的深层计算远少于预测下一个token所需的计算。因此,我们称之为“发射器”的深层层写入路径的训练副本,会从较浅锚定层的残差流中写入prompt的深层记忆,且除最后一个token外,所有prompt token仅需运行少至63%的层。第二,循环状态存在“状态汇”:其大部分能量位于每个头固定方向上的秩一项,其余部分为低秩工作记忆。SEED(浅层编码释放深层记忆)基于这两个特性构建:它使预填充在深度上变浅,解码状态在表示上变浅。每个循环状态存储为其状态汇加上低秩因子,Gated DeltaNet、Kimi Delta Attention和Mamba-2的更新可精确扩展该存储方式;我们证明,周期性压缩回低秩的开环误差与压缩次数无关,具有有界性。SEED保持原始权重冻结,不压缩注意力缓存,且为每个生成的token运行所有层。在5个参数规模从30B到超过300B的生产混合模型的6个检查点上,它在11项官方考试中几乎无损失。在NVIDIA GB300 GPU上通过SGLang服务于智能体编码轨迹时,它将Qwen3.8-Flash-Next的每GPU吞吐量提升了1.2至1.4倍。
英文摘要:
Hybrid language models interleave a few softmax-attention layers with many linear-attention or state-space layers, so every layer keeps a memory of earlier tokens: a key-value cache or a fixed-size recurrent state. Serving them spends more compute and high-bandwidth memory on these memories than the output requires. The prefill runs every layer for every prompt token, and every decode step loads and stores whole recurrent states, which on Qwen3.8-Flash-Next take as many bytes per request as the attention cache of thousands of tokens. We find two properties of trained hybrids that locate this excess. First, writes are easier than reads: writing a deep layer's memory of a token needs little of the deep computation that predicting the next token needs. Trained copies of the deep layers' write paths, which we call emitters, therefore write a prompt's deep memories from the residual stream of a shallower anchor layer, and all prompt tokens but the last run as few as 63% of the layers. Second, recurrent states have a state sink: most of their energy lies in a rank-one term along a fixed direction of each head, and the rest is a low-rank working memory. SEED builds on both: it makes the prefill shallow in depth and the decode state shallow in representation. Each recurrent state is stored as its sink plus low-rank factors, which the Gated DeltaNet, Kimi Delta Attention and Mamba-2 updates extend exactly; we prove that the open-loop error of the periodic compressions back to low rank is bounded independently of their number. SEED keeps the original weights frozen, compresses no attention cache, and runs all layers for every generated token. On six checkpoints of five production hybrids of 30B to over 300B parameters, it is nearly lossless on eleven official exams. Served with SGLang on NVIDIA GB300 GPUs on an agentic-coding trace, it raises the per-GPU throughput of Qwen3.8-Flash-Next 1.2-1.4x.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。