Pith. sign in

REVIEW 9 cited by

Transformers learn in-context by gradient descent

Not yet reviewed by Pith; the record is open.

This paper has not been read by Pith yet. Machine review is queued; the pith claim, tier, and objections will appear here once it completes.

SPECIMEN: schema-true, not a live event

T0 review · schema-true

One-sentence machine reading of the paper's core claim.

pith:XXXXXXXX · record.json · timestamp

arxiv 2212.07677 v2 pith:I5IS4VBM submitted 2022-12-15 cs.LG cs.AIcs.CL

classification cs.LGcs.AIcs.CL
keywords transformerslearningin-contextdescentgradientlearnregressionconstruction
verification ladder T0 review T1 audit T2 compute T3 formal
0 comments
read the original abstract

At present, the mechanisms of in-context learning in Transformers are not well understood and remain mostly an intuition. In this paper, we suggest that training Transformers on auto-regressive objectives is closely related to gradient-based meta-learning formulations. We start by providing a simple weight construction that shows the equivalence of data transformations induced by 1) a single linear self-attention layer and by 2) gradient-descent (GD) on a regression loss. Motivated by that construction, we show empirically that when training self-attention-only Transformers on simple regression tasks either the models learned by GD and Transformers show great similarity or, remarkably, the weights found by optimization match the construction. Thus we show how trained Transformers become mesa-optimizers i.e. learn models by gradient descent in their forward pass. This allows us, at least in the domain of regression problems, to mechanistically understand the inner workings of in-context learning in optimized Transformers. Building on this insight, we furthermore identify how Transformers surpass the performance of plain gradient descent by learning an iterative curvature correction and learn linear models on deep data representations to solve non-linear regression tasks. Finally, we discuss intriguing parallels to a mechanism identified to be crucial for in-context learning termed induction-head (Olsson et al., 2022) and show how it could be understood as a specific case of in-context learning by gradient descent learning within Transformers. Code to reproduce the experiments can be found at https://github.com/google-research/self-organising-systems/tree/master/transformers_learn_icl_by_gd .

Discussion (0). Sign in to comment.

Forward citations

Cited by 9 Pith papers

Reviewed papers in the Pith corpus that reference this work. Sorted by Pith novelty score. Full citation record

  1. Partition, Prompt, Aggregate: Statistical Self-Consistency in Language Models

    cs.CL 2026-07 conditional novelty 7.0 of 10

    LLM probability estimates violate the law of total probability across partitions, and subgroup-aggregated estimates often beat direct population-level estimates (the macro fallacy).

  2. Bayesian Wind Tunnels for Model Selection

    cs.LG 2026-07 conditional novelty 6.0 of 10

    A 2.8M-parameter transformer matches Bayesian model-selection posteriors to 0.01-bit entropy error on relational function classes, while failing completely on arithmetic classes with opaque tokens.

  3. Transformers with RL or SFT Provably Learn Sparse Boolean Functions, But Differently

    cs.LG 2025-11 conditional novelty 6.0 of 10

    Under hand-designed masks and task-specific activations, RL fine-tuning learns a k-sparse Boolean reasoning chain in one gradient update while SFT learns it one CoT step per update.

  4. Sample Complexity and Representation Ability of Test-time Scaling Paradigms

    cs.LG 2025-06 conditional novelty 6.0 of 10

    Best-of-n sampling provably needs about 1/Δ samples versus 1/Δ² for self-consistency, and a constructed Transformer can route among experts using verifier feedback to reach near-optimal final responses.

  5. Entangled by Design: Spurious Intra-Variable Signal Routing in Tabular In-Context Learners

    cs.AI 2026-07 conditional novelty 5.0 of 10

    In-context learners route predictions through a spurious component inside a composite feature whenever that component correlates with the label, and the routing persists as context grows.

  6. A Theoretical Study of (Hyper) Self-Attention through the Lens of Interactions: Representation, Training, Generalization

    cs.LG 2025-06 conditional novelty 5.0 of 10

    Single-layer linear self-attention can represent, train on, and length-generalize pairwise interaction functions under data-versatility and exact-realizability assumptions, and the paper introduces higher-order HyperA...

  7. Context-Adaptive Inference: A Unified Statistical and Foundation-Model View

    stat.ML 2026-07 conditional novelty 4.0 of 10

    Under linear, squared-loss assumptions, explicit context adaptation and in-context learning both reduce to kernel ridge regression on joint input-context features.

  8. In-context learning of closed form solution to simple linear regression task using transformer with linear self-attention

    cs.LG 2026-07 conditional novelty 4.0 of 10

    A two-layer linear-attention transformer can approximate the closed-form least-squares solution by using layer normalization for division, and one l1-regularized training run mostly reproduces this construction.

  9. Thinking About Thinking: SAGE-nano's Inverse Reasoning for Self-Aware Language Models

    cs.AI 2025-06 reject novelty 3.0 of 10

    A 4B-parameter model is claimed to explain its own reasoning through inverse attention analysis, but the paper offers no consistent evidence or artifacts.

Pith tools