Google's DeepCrossAttention achieves comparable model quality up to 3x faster

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Google’s DeepCrossAttention achieves comparable model quality up to 3x faster

Kyriakos Axiotis, Staff Research Scientist, and Thomas Fu, Principal Engineer, Google Research

我们推出了 DeepCrossAttention (DCA),这是一种通过使用可学习权重和深度交叉注意力来增强 Transformer 网络的新架构。它能够动态组合来自先前层的输出,从而防止传统残差连接中出现的信息稀释现象。正如我们在 ICML 2025 论文中所述,这种架构改进使模型能够以快达三倍的速度达到相同的质量,且参数增加量微乎其微。

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.

为了克服这一挑战并实现对几十或几百层网络的训练,Transformer 严重依赖残差连接(也称为“跳跃”连接),它们就像信息高速公路或捷径。数据不必被迫完全通过复杂的层,原始输入的副本可以直接跳过该层并直接添加到其输出中。这确保了模型始终拥有原始数据可供参考。

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%.

在我们的 ICML 2025 论文《DeepCrossAttention: Supercharging Transformer Residual Connections》中,我们研究了传统残差架构的缺陷,并引入了 DeepCrossAttention (DCA)。它通过允许每一层动态选择并路由来自先前层历史的特征,从而推广了残差连接。通过允许模型在任何给定时刻动态选择哪些先前的层最重要,DCA 实现了相当或更好的学习效果,同时将所需的参数数量减少了 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.

DCA 没有将跳跃连接视为僵化的加法管道,而是将残差学习重新定义为动态路由问题。DCA 不再以相等的权重向前传递所有先前的层,而是引入了一个轻量级的层级模块,该模块决定如何基于每个 Token 最佳地组合先前的嵌入。

Comparison between a standard residual network and DeepCrossAttention (DCA). While a standard residual network uses rigid, additive point-wise connections with equal weighting, DCA introduces dynamic, learned routing weights (W) that allow each layer to selectively route and combine features from across the history of preceding layers.

标准残差网络与 DeepCrossAttention (DCA) 的比较。标准残差网络使用僵化的、等权重的逐点加法连接,而 DCA 引入了动态的、可学习的路由权重 (W),允许每一层有选择地路由和组合来自先前层历史的特征。

The architecture introduces two primary mechanisms:

该架构引入了两个主要机制:

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.

通过允许网络动态选择并检索来自早期层的高分辨率特征,DCA 消除了经典残差连接中固有的信息稀释问题。

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 在实践中是否能克服信息稀释,我们在受控合成设置、大规模语言建模基准测试和图像分类任务中评估了我们的方法。

DCA demonstrated significant improvements in convergence speed, training stability, and final model quality across these experiments.

在这些实验中,DCA 在收敛速度、训练稳定性和最终模型质量方面表现出了显著的改进。

Perplexity (PPL) — how well a probability model predicts a sample — comparison across language modeling benchmarks. On both the LM1B (top) and C4 (bottom) datasets, DeepCrossAttention (DCA) achieves lower perplexity than standard transformers and alternative connection baselines (such as LAUREL-PA, 1x1-DenseFormer, and Hyper-Connections) under the same parameter and training budgets.

困惑度 (PPL) — 概率模型预测样本的好坏 — 在语言建模基准测试中的比较。在 LM1B(上)和 C4(下)数据集上,在相同的参数和训练预算下,DeepCrossAttention (DCA) 比标准 Transformer 和其他连接基线(如 LAUREL-PA、1x1-DenseFormer 和 Hyper-Connections)实现了更低的困惑度。

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.

在 Common Crawl 网络爬取语料库 (C4) 的大型清洗版本和 10 亿词语言模型基准 (LM1B) 数据集上,DCA 以少达五倍的训练步数达到了标准 Transformer 的性能。在训练相同的时间或步数时,DCA 始终比标准残差连接实现更低的困惑度,从而有效地从相同的训练预算中提取了更多的表示能力。为了在 LM1B 上实现 <14 的困惑度,固定宽度的标准 Transformer 需要 42 层,而 DCA 模型仅用 30 层就实现了更低的困惑度——深度和参数数量减少了 29%。

Impact of varying connection history (k) on model perplexity. Performance comparison showing how scaling the number of preceding layer connections in DCA consistently improves language modeling perplexity over the standard Transformer baseline, achieving the lowest perplexity at higher configurations (16-DCA and 24-DCA).

改变连接历史 (k) 对模型困惑度的影响。性能比较显示,在 DCA 中扩展先前层连接的数量如何持续改善语言建模困惑度,使其优于标准 Transformer 基线,并在更高的配置(16-DCA 和 24-DCA)下实现最低的困惑度。

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.

人工智能中最常见的权衡之一是,更好的模型往往体积更大、运行更慢。DCA 增加的参数极少(不到模型总大小的 0.2%),因此在计算和内存占用方面几乎可以忽略不计,同时还增加了内存带宽,因为来自不同层的表示是完整呈现的,而不是混合在一起的。有趣的是,由于 DCA 可以被初始化为与标准残差网络表现一致,因此它不需要从头开始训练:将 DCA 改装到已经预训练好的 Transformer 上并进行短暂的持续训练,在 LM1B 上将困惑度降低了 0.19,而持续的标准训练仅降低了 0.02。

As large language models (LLMs) are used across a broader range of domains, optimizin

随着大型语言模型 (LLM) 被应用于更广泛的领域,优化