JoMA: Demystifying Multilayer Transformers via JOint Dynamics of MLP and Attention

Yuandong Tian, Yiping Wang, Zhenyu (Allen) Zhang, Beidi Chen, Simon S. Du
2/12/2026

Official code: facebookresearch/luckmatters (306 stars, last commit 2025-10-19).

Abstract

We propose Joint MLP/Attention (JoMA) dynamics, a novel mathematical framework to understand the training procedure of multilayer Transformer architectures. This is achieved by integrating out the self-attention layer in Transformers, producing a modified dynamics of MLP layers only. JoMA removes unrealistic assumptions in previous analysis (e.g., lack of residual connection) and predicts that the attention first becomes sparse (to learn salient tokens), then dense (to learn less salient tokens) in the presence of nonlinear activations, while in the linear case, it is consistent with existing works that show attention becomes sparse over time. We leverage JoMA to qualitatively explains how tokens are combined to form hierarchies in multilayer Transformers, when the input tokens are generated by a latent hierarchical generative model. Experiments on models trained from real-world dataset (Wikitext2/Wikitext103) and various pre-trained models (OPT, Pythia) verify our theoretical findings. Code can be found in https://github.com/facebookresearch/luckmatters/tree/yuandong3.

View on arXivView PDF

Code Implementations(1)

Understanding Training Dynamics of Deep ReLU Networks

30631Shell, PythonJun 5, 20191 years agoNOASSERTION

Similar Papers

Cite this paper

@article{tian2026joma,
  title  = {JoMA: Demystifying Multilayer Transformers via JOint Dynamics of MLP and Attention},
  author = {Yuandong Tian and Yiping Wang and Zhenyu (Allen) Zhang and Beidi Chen and Simon S. Du},
  year   = {2026},
  eprint = {2310.00535},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2310.00535},
  journal = {ICLR 2023 2023}
}

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/2310.00535.svg)](https://codeofpaper.com/paper/2310.00535)

Discussion