TL;DR
Modern Large Language Models (LLMs) rely on standard residual connections that aggregate layer outputs uniformly, which progressively dilutes the contributions of earlier layers as networks grow deeper. This paper introduces Attention Residuals (AttnRes), replacing fixed addition with learned, input-dependent softmax attention over preceding layers to allow dynamic feature selection. By partitioning layers into blocks (Block AttnRes) and introducing clever pipeline caching, the authors deliver a practical drop-in replacement that yields a 1.25× compute advantage and broad downstream improvements with negligible overhead.
What Problem Does This Paper Address?
In standard Transformer architectures, residual connections with PreNorm accumulate all layer outputs with fixed, uniform weights. As the network gets deeper, this unweighted accumulation causes the magnitude of the hidden states to grow monotonically ($O(L)$ growth).
This creates a phenomenon known as PreNorm dilution: the relative contribution of early layers shrinks, effectively burying crucial low-level information. Consequently, deeper layers must learn increasingly massive outputs to exert any influence, which destabilizes training. The authors note that this depth-wise bottleneck strongly parallels the sequential recurrence limitations that Recurrent Neural Networks (RNNs) faced before the invention of token-based self-attention.
Methods
The authors propose a formal framework that treats depth-wise accumulation as an attention mechanism, upgrading standard residual paths from linear attention to softmax attention.
- Full Attention Residuals (Full AttnRes): Instead of simply adding the previous layer's output, each layer uses a learned, layer-specific pseudo-query vector ($w_l$) to compute softmax attention weights over all preceding layer outputs.
- Block Attention Residuals (Block AttnRes): To mitigate the $O(Ld)$ memory and communication overhead of attending to every single past layer during large-scale distributed training, the authors group layers into $N$ blocks. Within each block, outputs are aggregated via standard residuals, but the model performs full softmax attention across these block-level summaries. This reduces the cross-stage footprint to $O(Nd)$.
Infrastructure Optimizations
To make Block AttnRes practical at scale, the team introduced two key system optimizations:
- Cross-Stage Caching: Under pipeline parallelism, physical ranks cache previously received blocks locally. Instead of re-transmitting the entire history at every stage transition, they only pass incremental updates, significantly reducing communication bottlenecks.
- Two-Phase Computation: During inference, inter-block attention queries are batched simultaneously (Phase 1), while intra-block lookbacks are computed sequentially and merged via online softmax (Phase 2), preserving low memory I/O.
Datasets
The authors integrated Block AttnRes into the Kimi Linear architecture—a Mixture-of-Experts (MoE) model featuring 48B total and 3B activated parameters. They pre-trained the model from scratch on 1.4 Trillion tokens using a Warmup-Stable-Decay (WSD) learning rate schedule.
Downstream evaluation spanned a comprehensive suite of standard benchmarks:
- General Knowledge & Reasoning: MMLU, MMLU-Pro, GPQA-Diamond, BBH, ARC-Challenge, HellaSwag, TriviaQA.
- Math & Code: GSM8K, MGSM, MATH, CMath, HumanEval, MBPP.
- Chinese Language Understanding: CMMLU, C-Eval.
Key Insights and Ideas
- The Depth-Time Duality: The paper formalizes a beautiful mathematical link showing that standard residuals, Highway networks, and multi-stream recurrences are all forms of depth-wise linear attention. AttnRes completes the transition to depth-wise softmax attention, mirroring the historic RNN-to-Transformer evolution.
- Curing PreNorm Dilution: Tracking the training dynamics revealed that AttnRes successfully bounds hidden-state magnitudes into a stable, periodic pattern rather than an uncontrolled monotonic climb. It also flattens gradient distribution, ensuring early layers receive healthy gradient signals.
- Preserved Locality & Specialization: Visualizing the learned attention weights showed that while layers still rely heavily on their immediate predecessors (diagonal dominance), they selectively form long-range skip connections and consistently maintain a strong dependency on the initial token embedding.
Key Results
- Compute Efficiency: Scaling law experiments demonstrate that Block AttnRes consistently outperforms the baseline across all compute budgets, matching the validation loss of a standard PreNorm baseline trained with 1.25× more compute.
- Downstream Superiority: The AttnRes model achieved gains across all evaluated tasks. The improvements were most pronounced in multi-step reasoning and coding, such as GPQA-Diamond (+7.5), MATH (+3.6), and HumanEval (+3.1).
- Minimal Overhead: Thanks to the two-phase inference schedule, the total per-layer memory access overhead is drastically lower than alternative multi-stream methods. The end-to-end inference latency overhead is less than 2% on typical workloads, and training wall-clock overhead is under 4%.
Limitations and Future Work
While Block AttnRes solves the scaling bottleneck, Full AttnRes remains communication-prohibitive for massive models due to its $O(Ld)$ cross-stage transfer requirements. The authors anticipate that future hardware interconnect improvements (e.g., faster GPU-to-GPU fabrics) will eventually make Full AttnRes viable.
Additionally, exploring more expressive yet memory-efficient sub-quadratic or linear-complexity attention mechanisms specifically tailored for the depth dimension represents a promising frontier for future architectures.
Summary updated