HackerPapers

arXiv:2211.15661cs.LG

What learning algorithm is in-context learning? Investigations with linear models

Ekin Akyürek, Dale Schuurmans, Jacob Andreas, Tengyu Ma, Denny Zhou

Abstract

Neural sequence models, especially transformers, exhibit a remarkable capacity for in-context learning. They can construct new predictors from sequences of labeled examples $(x, f(x))$ presented in the input without further parameter updates. We investigate the hypothesis that transformer-based in-context learners implement standard learning algorithms implicitly, by encoding smaller models in their activations, and updating these implicit models as new examples appear in the context. Using linear regression as a prototypical problem, we offer three sources of evidence for this hypothesis. First, we prove by construction that transformers can implement learning algorithms for linear models based on gradient descent and closed-form ridge regression. Second, we show that trained in-context learners closely match the predictors computed by gradient descent, ridge regression, and exact least-squares regression, transitioning between different predictors as transformer depth and dataset noise vary, and converging to Bayesian estimators for large widths and depths. Third, we present preliminary evidence that in-context learners share algorithmic features with these predictors: learners' late layers non-linearly encode weight vectors and moment matrices. These results suggest that in-context learning is understandable in algorithmic terms, and that (at least in the linear case) learners may rediscover standard estimation algorithms. Code and reference implementations are released at https://github.com/ekinakyurek/google-research/blob/master/incontext.

arXiv comments
ICLR2023 Camera Ready
Journal reference
DOI
Subjects
cs.LGMachine Learning cs.CLComputation and Language

On Hacker News

Linked by 6 identifiable commenters in 6 comments across 4 threads, from Feb 2023 to Apr 2023. Found in 2 HN submissions from Feb 2023 to Feb 2023. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments4 threads

    • Ah the good old "it's not me it's the test" argument. These systems are not just next token predictors, they learn complex algorithms and can perform general computation, its just so happens that by asking them to next-token predict the internet they learn a bunch of smart ways…

      tehf0xView on HNParent context

    • Related paper: “What learning algorithm is in-context learning? Investigations with linear models” https://arxiv.org/abs/2211.15661

      O__________OView on HNParent context

    • The author says: “Large Language Models don’t understand anything — and they can’t get better at something they can’t do.” Yet, LLM’s can understand (unless one claims that understanding requires consciousness): https://arxiv.org/abs/2101.06573 And, strangely enough, LLM’s can…

      dr_dshivView on HNParent context

    • The article doesn't understand large language models. It makes an assumption about how they work and uses that assumption to draw a conclusion. Most likely, as found in small models [0], large autoregressive transformers understand machine learning algorithms well enough to…

      benlivengoodView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.