2026年11月23日
Kyriakos Axiotis,Staff Research Scientist,以及 Thomas Fu,Principal Engineer,Google Research
我们提出了 DeepCrossAttention(DCA),一种通过使用可学习权重和逐层交叉注意力机制来增强 transformer 网络的新架构,该架构能够动态合并前一层的输出,避免传统残差连接中出现的信息稀释问题。该架构改进方案出自我们发表于 ICML 2025 的论文,可使模型以极少的参数量增长实现同等效果,且速度最快提升三倍。
可以将传统的深度学习模型比作一个巨大的"传话筒"游戏:数据经过层层传递,每一层都会对信息进行轻微修改。如果一个网络有几十或上百层,原始学习信号可能在到达所有层之前就已严重退化甚至完全消失,这在 AI 中被称为梯度消失问题。
为应对这一挑战、使数十或数百层的网络得以训练,transformer 严重依赖残差连接(也称为"skip"连接),它们犹如信息高速公路或捷径。数据无需强制穿过复杂的层级,原始输入的副本可直接跳过当前层,再与该层输出直接相加,从而确保模型始终能参考到原始的原始数据。
标准残差连接实现了一个简单的操作:将层输出与其输入进行逐点求和。虽然计算高效,但这一简单流程存在一个关键局限性:它对所有先前的表征赋予相同权重,导致深层网络中出现信息稀释。当特征经过大量层传播时,来自早期层的特定、高分辨率细节可能会被平均化或扭曲,使得网络难以选择性检索这些特征。这迫使网络重新计算它们,从而降低了学习效率。
在我们发表于 ICML 2025 的论文《DeepCrossAttention: Supercharging Transformer Residual Connections》中,我们研究了传统残差架构的不足之处,并引入了 DeepCrossAttention(DCA),它通过允许每一层从先前层的序列中动态选择和路由特征,将残差连接进行了泛化。DCA 允许模型在任意时刻动态选择最重要的先前层,从而实现相当甚至更优的学习效果,同时将所需参数数量减少最多 30-40%。
与将跳跃连接视为刚性加法流水线不同,DCA 将残差学习重构为一种动态路由问题。DCA 不将之前各层以同等权重全部前向传递,而是引入一个轻量级、逐层模块,以逐 token 的方式决定如何最佳地组合先前 embeddings。
该架构引入了两个主要机制:
- 动态层路由:对于处理的每个 token,DCA 使用静态、可学习的基底结合输入依赖投影计算一组独特的混合权重。这使得网络能够根据 token 的具体上下文自适应调整其处理结构——从纯序列模式到完全并行模式。
- 深度交叉注意力(分割 Q/K/V):标准 transformer 注意力跨序列中的 token 进行操作,而 DCA 在深度维度上跨层应用注意力。每个 token 查询所有先前层嵌入的动态加权混合,在不增加传统注意力扩展所需计算代价的前提下解锁模型的完整历史上下文。
通过允许网络动态选择和检索来自早期层的高分辨率特征,DCA 消除了经典残差连接中固有的信息稀释问题。
为验证 DCA 是否能在实践中克服信息稀释,我们在受控合成设置、大规模语言建模基准测试以及图像分类任务上评估了该方法。
实验表明,DCA 在这些任务的收敛速度、训练稳定性和最终模型质量方面均取得了显著改进。
在Common Crawl网络爬取语料库(C4)和十亿词语言模型基准(LM1B)这两个超大规模清洗数据集上,DCA以最多少至五倍的训练步数达到了标准Transformer的性能水平。在相同训练时长或相同步数的情况下,DCA始终获得了比标准残差连接更低的困惑度(衡量概率模型对样本的预测准确度),从而从相同的训练预算中提取了更多的表征能力。为在LM1B上达到困惑度低于14,标准Transformer需要42层(固定宽度),而DCA仅需30层即可获得更低的困惑度——深度和参数量均减少了29%。
AI领域最常见的权衡之一是:性能更好的模型往往体积更大、运行更慢。DCA仅增加极少量的参数(不到模型总规模的0.2%),对计算量和内存占用几乎无影响,同时还能提升显存带宽,因为来自不同层的表征是完整传递而非混合后再传递的。有趣的是,由于DCA可以初始化为与标准残差网络行为完全一致,因此无需从头训练:将DCA适配到已预训练的Transformer并短暂继续训练,在LM1B上的困惑度降低了0.19,而同等条件下继续使用标准训练的困惑度仅降低0.02。
随着大语言模型(LLM)被应用于更广泛的领域,优化其训练过程和底层架构对于扩展规模和解锁新能力至关重要。DCA 及类似的动态残差技术已得到广泛应用并取得了显著成功。这些方法的迅速涌现凸显了动态路由是一个高度活跃且前景广阔的研究方向。
Moonshot AI 开发的注意力残差机制与 DCA 共享核心理念,即用选择性检索替代固定的加法操作。该方法并非盲目地将每一层前序层的输出相加,而是采用可学习的 softmax 注意力机制配合层特定伪查询(pseudo-query)。这使得每一层能够有选择地加权并从更早的深度中检索表示。通过防止隐藏状态的无限增长以及早期层信息的稀释,该方法提升了梯度稳定性,并在编程和数学等重度推理任务上显著提高了性能。为了在规模扩张时保持计算效率,"Block AttnRes" 变体将网络层划分为多个区块,以更少的显存开销获得全注意力机制的收益。Thinking Machines 近期推出的 Inkling 2 模型也采用了这一设计,并结合了 DCA 的跨注意力(Q/K/V 拆分)机制。
超连接将残差流扩展到多个并行通道,提供了一种超越单纯增加模型宽度或深度的记忆缩放形式。它们采用固定大小的栈结构,层输出通过可学习的混合矩阵进行聚合与混合。然而,这种无约束的混合方式会破坏残差连接固有的恒等映射特性,可能引起信号放大或衰减,进而在大规模场景下导致训练不稳定。
为解决标准超连接的不稳定问题,流形约束超连接(manifold-constrained hyper-connections)对混合矩阵施加特定约束。通过将矩阵约束在预定义的流形上——具体而言,利用 Sinkhorn-Knopp 算法使矩阵成为双随机的——该方案恢复了稳定的信号传播路径。该方法在保留扩展残差流丰富信息流动与表达能力的前提下,有效防止梯度爆炸或消失,使模型能够稳健地进行规模扩展。
DCA 证明了从静态残差连接转向基于动态注意力机制的路由,是构建更高效模型的一种强大策略。通过利用扩展的残差流和深度交叉注意力机制,DCA 使深度网络能够在不同层之间选择性检索和整合 token 嵌入。我们预计下一代模型将能够根据正在处理的具体 token 或输入,对过往层的表示进行动态路由和加权。这将允许将所有模型层作为协同工作的专业化专家来有效使用,实现信息最大化共享且无冗余,从而带来更强的表达能力和更深层次的交互作用。我们期待看到这些多深度交互如何塑造下一代 transformer 架构。
这项工作由 Google 的研究人员与学术合作伙伴合作完成,包括 Mike Heddes、Adel Javanmard、MohammadHossein Bateni 和 Vahab Mirrokni,他们的贡献对本研究的发展至关重要。
×
❮
❯
×
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
November 23, 2026
Kyriakos Axiotis, Staff Research Scientist, and Thomas Fu, Principal Engineer, Google Research
We present DeepCrossAttention (DCA), an architecture that enhances transformer networks by using learnable weights and depth-wise cross-attention to dynamically combine outputs from previous layers, preventing the information dilution seen in traditional residual connections. Presented in our ICML 2025 paper, this architectural improvement allows models to achieve the same quality up to three times faster with a negligible increase in parameters.
Think of a traditional deep learning model like a giant game of "Telephone": data passes through layer after layer, with each layer changing the information slightly. If a network has dozens or hundreds of layers, the original learning signal can become severely degraded or lost by the time it reaches all layers, which is known as the vanishing gradient problem in AI.
To overcome this challenge and enable the training of networks with dozens or hundreds of layers, transformers rely heavily on residual connections, also known as “skip” connections, which act like an information highway or a shortcut. Instead of forcing the data to pass exclusively through the complicated layer, a duplicate copy of the original input skips right past this layer and is added directly to its output. This ensures that the model always has the original raw data to refer back to.
The standard residual connection implements a simple operation: point-wise summation of a layer's output with its input. While computationally efficient, this simple process has a key limitation: it treats all prior representations with equal weight, leading to information dilution in deep networks. As features propagate through many layers, specific, high-resolution details from earlier layers can be averaged out or distorted, making it difficult for the network to selectively retrieve them. This forces the network to recompute them, reducing learning efficiency.
In our ICML 2025 paper, "DeepCrossAttention: Supercharging Transformer Residual Connections," we studied the shortcomings of the traditional residual architecture and introduced DeepCrossAttention (DCA), which generalizes residual connections by allowing each layer to dynamically select and route features from the history of preceding layers. By allowing the model to dynamically choose which previous layers are most important at any given moment, DCA achieves comparable or improved learning, while reducing the number of parameters needed by up to 30-40%.
Instead of treating skip connections as a rigid, additive pipeline, DCA reframes residual learning as a dynamic routing problem. Rather than passing all prior layers forward with equal weight, DCA introduces a lightweight, layer-wise module that decides how to best combine previous embeddings on a per-token basis.
The architecture introduces two primary mechanisms:
- Dynamic layer routing: For every token processed, DCA computes a unique set of mixing weights using a static, learnable base combined with an input-dependent projection. This allows the network to adaptively shift its processing structure — ranging from purely sequential to fully parallel — based on the specific context of the token.
- Depth-wise cross-attention (split Q/K/V): While standard transformer attention operates across tokens in a sequence, DCA applies attention across layers in depth. Each token queries a dynamically weighted mix of all prior layer embeddings, unlocking the model's full historical context without the computational penalty usually required to scale traditional attention.
By allowing the network to dynamically select and retrieve high-resolution features from earlier layers, DCA eliminates the information dilution inherent to classic residual connections.
To test whether DCA can overcome information dilution in practice, we evaluated our approach across controlled synthetic setups, large-scale language modeling benchmarks, and image classification tasks.
DCA demonstrated significant improvements in convergence speed, training stability, and final model quality across these experiments.
On the colossal, cleaned version of Common Crawl's web crawl corpus (C4) and 1 Billion Word Language Model Benchmark (LM1B) datasets, DCA reached the performance of standard transformers in up to five times fewer training steps. When trained for the same duration or number of steps, DCA consistently achieved lower perplexity — how well a probability model predicts a sample — than standard residual connections, effectively extracting more representational capacity from the same training budget. To achieve a perplexity of <14 on LM1B, a standard transformer with fixed width required 42 layers, whereas the DCA model achieved a lower perplexity with only 30 layers — a 29% reduction in depth and parameter count.
One of the most common trade-offs in AI is that better models are often much larger and slower to run. DCA adds a tiny number of parameters — less than 0.2% of the total model size — making it negligible in terms of compute and memory footprint, while increasing memory bandwidth, as representations from different layers are presented intact rather than blended together. Interestingly, because DCA can be initialized to behave identically to a standard residual network, it doesn’t require training from scratch: retrofitting DCA onto an already pre-trained transformer and briefly continuing training reduced perplexity by 0.19 on LM1B, compared to just 0.02 for continued standard training.
As large language models (LLMs) are used across a broader range of domains, optimizing their training processes and underlying architectures is critical for scaling and unlocking new capabilities. DCA and similar dynamic residual techniques are already seeing significant adoption and success. The rapid emergence of these methodologies highlights dynamic routing as a highly active and promising area of research.
Developed by Moonshot AI, attention residuals share DCA's core principles of replacing fixed addition with selective retrieval. Instead of blindly summing every prior layer's output, they use a learnable softmax attention mechanism paired with a layer-specific pseudo-query. This allows each layer to selectively weight and retrieve representations from earlier depths. By preventing the unbounded growth of hidden states and the dilution of early-layer information, this method improves gradient stability and boosts performance on reasoning-heavy tasks like coding and mathematics. To maintain computational efficiency at scale, a "Block AttnRes" variant partitions layers into blocks, recovering the benefits of full attention with significantly less memory overhead. The recent Inkling 2 model developed by Thinking Machines also adopted this design in addition to DCA’s cross attention (Q/K/V split) mechanism.
Hyper-connections expand the residual stream into multiple parallel channels, offering a form of memory scaling that goes beyond simply increasing model width or depth. They use a fixed-size stack where layer outputs are aggregated and mixed using learnable mixing matrices. However, this unconstrained mixing breaks the traditional identity mapping property of residual connections, which can cause amplification or attenuation of signals, and lead to training instability at scale.
To address instability in standard hyper-connections, manifold-constrained hyper-connections apply specific constraints to the mixing matrices. By forcing these matrices to live on a defined manifold — specifically, constraining them to be doubly stochastic using the Sinkhorn-Knopp algorithm — manifold-constrained hyper-connections restore stable signal propagation. This approach prevents exploding or vanishing gradients while preserving the rich information flow and expressivity of the widened residual streams, allowing models to scale robustly.
DCA demonstrates that transitioning from static residual connections to dynamic, attention-based routing is a powerful strategy for building more efficient models. By leveraging an expanded residual stream and depth-wise cross-attention, DCA empowers deep networks to selectively retrieve and integrate token embeddings across different layers. We expect that next-generation models will dynamically route and weigh past layer representations based on the specific tokens or inputs being processed. This will allow for the effective use of all the model layers as specialized experts working in tandem, with maximum information sharing and no redundancy, leading to more expressivity and deeper interactions. We look forward to seeing how these multi-depth interactions will shape the next generation of transformer architectures.
This work was a collaboration between researchers at Google and academic partners, including Mike Heddes, Adel Javanmard, MohammadHossein Bateni, and Vahab Mirrokni, whose contributions were critical for the development of this work.
×
❮
❯
×
Auto-fetched and translated by AI Atlas. All rights belong to the original author.