English

Finite-Time Analysis of Gradient Descent for Shallow Transformers

Machine Learning 2026-04-03 v2 Artificial Intelligence Optimization and Control

Abstract

Understanding why Transformers perform so well remains challenging due to their non-convex optimization landscape. In this work, we analyze a shallow Transformer with mm independent heads trained by projected gradient descent in the kernel regime. Our analysis reveals two main findings: (i) the width required for nonasymptotic guarantees scales only logarithmically with the sample size nn, and (ii) the optimization error is independent of the sequence length TT. This contrasts sharply with recurrent architectures, where the optimization error can grow exponentially with TT. The trade-off is memory: to keep the full context, the Transformer's memory requirement grows with the sequence length. We validate our theoretical results numerically in a teacher-student setting and compare Transformers with recurrent architectures on an autoregressive task.

Keywords

Cite

@article{arxiv.2601.16514,
  title  = {Finite-Time Analysis of Gradient Descent for Shallow Transformers},
  author = {Enes Arda and Semih Cayci and Atilla Eryilmaz},
  journal= {arXiv preprint arXiv:2601.16514},
  year   = {2026}
}

Comments

AISTATS 2026 camera-ready version

R2 v1 2026-07-01T09:16:55.802Z