Mixture-of-Depths Attention

Lianghui Zhu, Yuxin Fang, Bencheng Liao, Shijie Wang, Tianheng Cheng +8 more
3/16/2026
cs.CLcs.AI

Official code: hustvl/MoDA (273 stars, MIT, last commit 2026-04-21).

Abstract

Scaling depth is a key driver for large language models (LLMs). Yet, as LLMs become deeper, they often suffer from signal degradation: informative features formed in shallow layers are gradually diluted by repeated residual updates, making them harder to recover in deeper layers. We introduce mixture-of-depths attention (MoDA), a mechanism that allows each attention head to attend to sequence KV pairs at the current layer and depth KV pairs from preceding layers. We further describe a hardware-efficient algorithm for MoDA that resolves non-contiguous memory-access patterns, achieving 97.3% of FlashAttention-2's efficiency at a sequence length of 64K. Experiments on 1.5B-parameter models demonstrate that MoDA consistently outperforms strong baselines. Notably, it improves average perplexity by 0.2 across 10 validation benchmarks and increases average performance by 2.11% on 10 downstream tasks, with a negligible 3.7% FLOPs computational overhead. We also find that combining MoDA with post-norm yields better performance than using it with pre-norm. These results suggest that MoDA is a promising primitive for depth scaling. Code is released at https://github.com/hustvl/MoDA .

View on arXivView PDF

Code Implementations(1)

hustvl/MoDAOfficial100%
MIT

An hardware-aware Efficient Implementation for "Mixture-of-Depths Attention".

2739Shell, PythonMar 16, 20266 months agoMIT

Similar Papers

Cite this paper

@article{zhu2026mixtureofdepths,
  title  = {Mixture-of-Depths Attention},
  author = {Lianghui Zhu and Yuxin Fang and Bencheng Liao and Shijie Wang and Tianheng Cheng and Zilong Huang and Chen Chen and Lai Wei and Yutao Zeng and Ya Wang and Yi Lin and Yu Li and Xinggang Wang},
  year   = {2026},
  eprint = {2603.15619},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2603.15619v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2603.15619.svg)](https://codeofpaper.com/paper/2603.15619)

Discussion