Understanding Prompt Tuning and In-Context Learning via Meta-Learning
Tim Genewein, Li Kevin Wenliang, Jordi Grau-Moya, Anian Ruoss, Laurent Orseau, Marcus Hutter
TL;DR
This work frames prompting as Bayesian conditioning of a memory-based meta-learned predictor, arguing that optimal prompting exists when the target task lies within the pretraining meta-distribution and that meta-trained networks implement Bayes-optimal in-context adaptation via their activations. It formalizes prefix-tuning and characterizes conditions under which prompt-based adaptation can reach Bayes-optimal performance, highlighting two failure modes: multimodal target distributions and genuinely novel atomic tasks. Through educational experiments on LSTMs and Transformers using coin-flip data, it shows that soft prefixes can nearly achieve Bayes-optimal predictions for single-task targets and can even influence untrained networks, whereas prefix prompting struggles with task mixtures and weight-tuning can overcome these limits. The results provide a principled understanding of in-context learning, quantify fundamental prompting limits, and offer guidance on when to favor weight-tuning or soft prompts in practice.
Abstract
Prompting is one of the main ways to adapt a pretrained model to target tasks. Besides manually constructing prompts, many prompt optimization methods have been proposed in the literature. Method development is mainly empirically driven, with less emphasis on a conceptual understanding of prompting. In this paper we discuss how optimal prompting can be understood through a Bayesian view, which also implies some fundamental limitations of prompting that can only be overcome by tuning weights. The paper explains in detail how meta-trained neural networks behave as Bayesian predictors over the pretraining distribution, whose hallmark feature is rapid in-context adaptation. Optimal prompting can be studied formally as conditioning these Bayesian predictors, yielding criteria for target tasks where optimal prompting is and is not possible. We support the theory with educational experiments on LSTMs and Transformers, where we compare different versions of prefix-tuning and different weight-tuning methods. We also confirm that soft prefixes, which are sequences of real-valued vectors outside the token alphabet, can lead to very effective prompts for trained and even untrained networks by manipulating activations in ways that are not achievable by hard tokens. This adds an important mechanistic aspect beyond the conceptual Bayesian theory.
