Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspective

Fabian Falck, Ziyu Wang, Chris Holmes
6/2/2024
stat.MLcs.LG

No official code found. Best implementation: meta-inf/bayes_icl (3 stars, MIT, last commit 2024-06-21).

Abstract

In-context learning (ICL) has emerged as a particularly remarkable characteristic of Large Language Models (LLM): given a pretrained LLM and an observed dataset, LLMs can make predictions for new data points from the same distribution without fine-tuning. Numerous works have postulated ICL as approximately Bayesian inference, rendering this a natural hypothesis. In this work, we analyse this hypothesis from a new angle through the martingale property, a fundamental requirement of a Bayesian learning system for exchangeable data. We show that the martingale property is a necessary condition for unambiguous predictions in such scenarios, and enables a principled, decomposed notion of uncertainty vital in trustworthy, safety-critical systems. We derive actionable checks with corresponding theory and test statistics which must hold if the martingale property is satisfied. We also examine if uncertainty in LLMs decreases as expected in Bayesian learning when more data is observed. In three experiments, we provide evidence for violations of the martingale property, and deviations from a Bayesian scaling behaviour of uncertainty, falsifying the hypothesis that ICL is Bayesian.

View on arXivView PDF

Code Implementations(1)

meta-inf/bayes_iclCommunity100%
MIT

Code for the paper "is In-Context Learning in Large Language Models Bayesian? a Martingale Perspective"

31PythonJun 1, 20242 years agoMIT

Similar Papers

Cite this paper

@article{falck2024incontext,
  title  = {Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspective},
  author = {Fabian Falck and Ziyu Wang and Chris Holmes},
  year   = {2024},
  eprint = {2406.00793},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2406.00793v1},
  journal = {ICML 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2406.00793.svg)](https://codeofpaper.com/paper/2406.00793)

Discussion