LLM & Transformer Fundamentals·Question 59 of 109Advanced

There's a line of work claiming in-context learning is implicit gradient descent. What's the claim, what's the evidence, and does it change what you do?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

The claim: a forward pass over demonstrations can implement an optimisation algorithm over an implicit internal model, so "learning" from examples is literal learning, just inside activations instead of weights.

Full worked answer

The claim: a forward pass over demonstrations can implement an optimisation algorithm over an implicit internal model, so "learning" from examples is literal learning, just inside activations instead of weights.

The evidence is genuinely strong but narrow. It is constructive: von Oswald et al. and Akyurek et al. hand-built transformer weights whose attention layers implement one step of gradient descent per layer for linear regression, then showed transformers trained from scratch on such tasks converge to solutions matching GD or ridge-regression predictors layer by layer. Dai et al. drew a dual-form correspondence between attention and gradient-descent updates. On small, synthetic, well-specified function classes, trained transformers demonstrably behave like known learning algorithms.

What it does not support is the extrapolation people make from it: that a frontier LLM doing few-shot classification is running gradient descent internally. The mechanistic evidence in real LLMs points elsewhere. Induction heads (prefix-match then copy) explain a lot of the copying behaviour. Task vectors explain more of the rest: work from Hendel et al. and Todd et al. shows demonstrations get compressed into a single activation direction that names a task the model already knows, and you can extract that vector and inject it with no demonstrations present and recover much of the performance. Min et al.'s wrong-label finding is very hard to reconcile with genuine in-context fitting of a mapping, and easy to reconcile with task selection.

So my honest read: two different phenomena share a name. Small models on synthetic regression really do learn in context. Large models on natural tasks mostly retrieve and specify a capability they already have.

Why it matters practically, which is the part interviewers are fishing for. If demonstrations select rather than teach, then example count has fast-diminishing returns and example diversity and representativeness dominate. Spend context on a precise instruction plus a few well-chosen, format-correct, edge-case-covering examples, not fifty near-duplicates. And if the mapping is genuinely novel, not present anywhere in pretraining, expect ICL to be weak and reach for fine-tuning early rather than escalating prompt engineering.

What a good answer covers

  • The claim: a forward pass over demonstrations can implement an optimisation algorithm over an implicit…
  • The evidence is genuinely strong but narrow
  • It is constructive: von Oswald et al
  • Dai et al
  • On small, synthetic, well-specified function classes, trained transformers demonstrably behave like…

Interviewer follow-ups to expect

  1. How would you test whether a specific task is being selected versus genuinely learned in context?

  2. Does the task-vector view suggest anything about how to compress long system prompts?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep