Transformers Learn to Achieve Second-Order Convergence Rates for In-Context Linear Regression
Deqing Fu, Tian-Qi Chen, Robin Jia, Vatsal Sharan

TL;DR
This paper reveals that Transformers perform in-context linear regression by approximating second-order optimization methods, specifically Newton's method, achieving faster convergence than first-order methods like Gradient Descent.
Contribution
The paper demonstrates that Transformers learn to implement second-order optimization, matching Newton's method's convergence rate, and provides theoretical proof of their ability to simulate multiple iterations with few layers.
Findings
Transformers' predictions closely match Newton's method iterations.
Transformers converge exponentially faster than Gradient Descent.
They can handle ill-conditioned data where GD struggles.
Abstract
Transformers excel at in-context learning (ICL) -- learning from demonstrations without parameter updates -- but how they do so remains a mystery. Recent work suggests that Transformers may internally run Gradient Descent (GD), a first-order optimization method, to perform ICL. In this paper, we instead demonstrate that Transformers learn to approximate second-order optimization methods for ICL. For in-context linear regression, Transformers share a similar convergence rate as Iterative Newton's Method, both exponentially faster than GD. Empirically, predictions from successive Transformer layers closely match different iterations of Newton's Method linearly, with each middle layer roughly computing 3 iterations; thus, Transformers and Newton's method converge at roughly the same rate. In contrast, Gradient Descent converges exponentially more slowly. We also show that Transformers can…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
Taxonomy
TopicsDomain Adaptation and Few-Shot Learning · Machine Learning and Algorithms · Sparse and Compressive Sensing Techniques
MethodsMulti-Head Attention · Attention Is All You Need · Linear Layer · Label Smoothing · Residual Connection · Byte Pair Encoding · Adam · Position-Wise Feed-Forward Layer · Dropout · Layer Normalization
