WhiteMatter:通过 KV 源混合实现全对全跨层连接
研究论文 · 2026/09/30
在生成文本时,Transformer 会在每一层生成过去 token 的表示,但每一层通常只能使用相同深度的表示。这一限制阻碍了模型充分利用已计算的信息。我们提出 WhiteMatter,允许每一层利用任意深度的过去 token 表示。一个学习到的混合器为当前上下文选择最有用的深度,并将其表示组合到共享的键值(KV)缓存通道中。跨层共享这些通道可以减少缓存大小。在相同训练 token 数量下,使用全尺寸缓存的 WhiteMatter 与层数多 50% 的标准 Transformer 性能相当。在 KV 缓存减半的情况下,WhiteMatter 在两个模型规模(最大 13 亿参数)上均优于匹配的标准 Transformer。然而,跨层连接引入了依赖关系,会减慢训练和提示处理速度。我们通过循环迭代解决这一问题,该迭代轮流更新交错的 token 组,同时并行处理每组内的 token。在精确自回归执行训练的参考模型上,循环迭代的收敛速度比标准 Jacobi 迭代快 12.5 倍。
WhiteMatter 通过跨层连接和 KV 源混合,在减少缓存大小的同时提升模型性能,为 Transformer 架构的效率优化提供了新思路。
When generating text, a Transformer produces representations of past tokens at every layer, but each layer can normally use only representations from the same depth. This restriction prevents the model from fully reusing information it has already computed. We introduce WhiteMatter, which allows every layer to draw on past-token representations from any depth. A learned mixer selects the most useful depths for the current context and combines their representations into shared key-value (KV) cache channels. Sharing these channels across layers can reduce the cache size. Given the same number of training tokens, WhiteMatter with a full-size cache performs comparably to a standard Transformer with 50% more layers. With half the KV cache, WhiteMatter outperforms matched standard Transformers at two model scales, up to 1.3B parameters. Cross-layer connections, however, introduce dependencies that slow training and prompt processing. We address this problem with cyclic iteration, which updates interleaved groups of tokens in turn while processing the tokens within each group in parallel. On a reference model trained with exact autoregressive execution, cyclic iteration converges 12.5x faster than standard Jacobi iteration.