An Explanation of In-context Learning as Implicit Bayesian Inference

By Sang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu Ma. 2021

1,108 citations recorded by the source corpus.

Large language models (LMs) such as GPT-3 have the surprising ability to do in-context learning, where the model learns to do a downstream task simply by conditioning on a prompt consisting of input-output examples. The LM learns from these examples without being explicitly pretrained to learn. Thus, it is unclear what enables in-context learning. In this paper, we study how in-context learning can emerge when pretraining documents have long-range coherence. Here, the LM must infer a latent document-level concept to generate coherent next tokens during pretraining. At test time, in-context learning occurs when the LM also infers a shared latent concept between examples in a prompt. We prove when this occurs despite a distribution mismatch between prompts and pretraining data in a setting where the pretraining distribution is a mixture of HMMs. In contrast to messy large-scale datasets used to train LMs capable of in-context learning, we generate a small-scale synthetic dataset (GINC) where Transformers and LSTMs both exhibit in-context learning. Beyond the theory, experiments on GINC exhibit large-scale real-world phenomena including improved in-context performance with model scaling (despite the same pretraining loss), sensitivity to example order, and instances where zero-shot is better than few-shot in-context learning.

Subfields: Artificial Intelligence, Large Language Models, Prompting & Reasoning

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Mohit Bansal
  2. Luke S. Zettlemoyer
  3. Percy Liang
  4. Jianfeng Gao
  5. Yoshua Bengio
  6. Quoc V. Le
  7. Yejin Choi
  8. Graham Neubig

In Large Language Models

  1. Luke S. Zettlemoyer
  2. Hannaneh Hajishirzi
  3. Wenhu Chen
  4. Percy Liang
  5. Antonia Creswell
  6. Ming Zhou
  7. Denny Zhou
  8. Jonathan Berant

In Prompting & Reasoning

  1. Luke S. Zettlemoyer
  2. Denny Zhou
  3. Wenhu Chen
  4. Hannaneh Hajishirzi
  5. Antonia Creswell
  6. Jonathan Berant
  7. Jason Wei
  8. Xinyun Chen

Citations in the corpus