Lune

NeurIPS2024Top-tier venue

DenseFormer: Enhancing Information Flow in Transformers via Depth Weighted Averaging

Matteo Pagliardini, Amirkeivan Mohtashami, François Fleuret, Martin Jaggi

Abstract

The transformer architecture by Vaswani et al. (2017) is now ubiquitous across application domains, from natural language processing to speech processing and image understanding. We propose DenseFormer, a simple modification to the standard architecture that improves the perplexity of the model without increasing its size -- adding a few thousand parameters for large-scale models in the 100B parameters range. Our approach relies on an additional averaging step after each transformer block, which computes a weighted average of current and past representations -- we refer to this operation as Depth-Weighted-Average (DWA). The learned DWA weights exhibit coherent patterns of information flow, revealing the strong and structured reuse of activations from distant layers. Experiments demonstrate that DenseFormer is more data efficient, reaching the same perplexity of much deeper transformer models, and that for the same perplexity, these new models outperform transformer baselines in terms of memory efficiency and inference time.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

8 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention cites Reformer: The Efficient Transformer
  • Reconstructing KV Caches with Cross-Layer Fusion for Enhanced Transformers cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Reformer: The Efficient Transformer
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Language Models are Few-Shot Learners
  • Improving Model Representation and Reducing KV Cache via Skip Connections with First Value Heads cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • Improving Model Representation and Reducing KV Cache via Skip Connections with First Value Heads cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Improving Model Representation and Reducing KV Cache via Skip Connections with First Value Heads cites Language Models are Few-Shot Learners
  • Improving Model Representation and Reducing KV Cache via Skip Connections with First Value Heads cites Value Residual Learning
  • Value Residual Learning cites Language Models are Few-Shot Learners
  • mHC: Manifold-Constrained Hyper-Connections cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • mHC: Manifold-Constrained Hyper-Connections cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers8

  1. mHC: Manifold-Constrained Hyper-ConnectionsZhenda Xie, Yixuan Wei, Huanqi Cao, Chenggang Zhao et al.ICML 2026 · 72 citations
  2. Transformer Layers as PaintersQi Sun, Marc Pickett, Aakash Kumar Nain, Llion JonesAAAI 2025 · 49 citations
  3. Value Residual LearningZhanchao Zhou, Tianyi Wu, Zhiyun Jiang, Fares Obeid et al.ACL 2025 · 8 citations
  4. Reconstructing KV Caches with Cross-Layer Fusion for Enhanced TransformersHongzhan Lin, Zhiqi Bai, Xinmiao Zhang, Siran Yang et al.ICLR 2026 · 5 citations
  5. Improving Model Representation and Reducing KV Cache via Skip Connections with First Value HeadsZhoutong Wu, Yuan Zhang, Yiming Dong, Chenheng Zhang et al.NeurIPS 2025 · 4 citations

Builds on9

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra et al.NeurIPS 2022 · 5,493 citations
  3. Self-Refine: Iterative Refinement with Self-FeedbackAman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan et al.NeurIPS 2023 · 4,972 citations
  4. Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 citations
  5. Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 citations

Related papers

  1. Brainformers: Trading Simplicity for EfficiencyYanqi Zhou, Nan Du, Yanping Huang, Daiyi Peng et al.ICML 2023 · 38 citations
  2. Fcaformer: Forward Cross Attention in Hybrid Vision TransformerHaokui Zhang, Wenze Hu, Xiaoyu WangICCV 2023 · 10 citations
  3. Sparse is Enough in Scaling TransformersSebastian Jaszczur, Aakanksha Chowdhery, Afroz Mohiuddin, Lukasz Kaiser et al.NeurIPS 2021 · 127 citations
  4. Improving Transformers with Dynamically Composable Multi-Head AttentionDa Xiao, Qingye Meng, Shengping Li, Xingyuan YuanICML 2024 · 8 citations
  5. DictFormer: Tiny Transformer with Shared DictionaryQian Lou, Ting Hua, Yen-Chang Hsu, Yilin Shen et al.ICLR 2022 · 12 citations
Dusk over the sea between two cliffs drawn in fine vertical lines