English

How Transformers Get Rich: Approximation and Dynamics Analysis

Machine Learning 2025-01-30 v3 Optimization and Control Machine Learning

Abstract

Transformers have demonstrated exceptional in-context learning capabilities, yet the theoretical understanding of the underlying mechanisms remains limited. A recent work (Elhage et al., 2021) identified a ``rich'' in-context mechanism known as induction head, contrasting with ``lazy'' nn-gram models that overlook long-range dependencies. In this work, we provide both approximation and dynamics analyses of how transformers implement induction heads. In the {\em approximation} analysis, we formalize both standard and generalized induction head mechanisms, and examine how transformers can efficiently implement them, with an emphasis on the distinct role of each transformer submodule. For the {\em dynamics} analysis, we study the training dynamics on a synthetic mixed target, composed of a 4-gram and an in-context 2-gram component. This controlled setting allows us to precisely characterize the entire training process and uncover an {\em abrupt transition} from lazy (4-gram) to rich (induction head) mechanisms as training progresses.

Keywords

Cite

@article{arxiv.2410.11474,
  title  = {How Transformers Get Rich: Approximation and Dynamics Analysis},
  author = {Mingze Wang and Ruoxi Yu and Weinan E and Lei Wu},
  journal= {arXiv preprint arXiv:2410.11474},
  year   = {2025}
}

Comments

47 pages

R2 v1 2026-06-28T19:22:23.807Z