Understanding Prompt Tuning and In-Context Learning via Meta-Learning
Tim Genewein Kevin Wenliang Li Jordi Grau-Moya · 2025
Read Understanding Prompt Tuning and In-Context Learning via Meta-Learning by Tim Genewein Kevin Wenliang Li Jordi Grau-Moya (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2505-17010.txt.
Introduction
Tim Genewein and co-authors explain prompt tuning and in-context learning through the lens of meta-learning. They view a trained model as a kind of odds based predictor. A prompt then acts like new facts that shift what the model expects next in a clear way.
That view sets clear limits on what prompts alone can do. Some tasks need weight changes instead. Small tests with two kinds of networks back the claims. They also show soft prompts, made of number lists not words, can steer even untrained nets in ways word prompts cannot.
Catalog record
| CREATOR | Tim Genewein Kevin Wenliang Li Jordi Grau-Moya |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 62 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2505-17010
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Understanding Prompt Tuning and In-Context Learning via Meta-Learning Tim Genewein Kevin Wenliang Li Jordi Grau-Moya 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. Keywords: prompting, prefix-tuning, in-context learning, meta-learning, Bayes, frontier models 1 Introduction Perhaps the most impressive feature of today’s frontier models is their ability to swiftly adapt their behavior to a wide range of contexts. Given relatively few tokens—whether from a user input, a system prompt, or a number of in-context examples—models often rapidly infer the task at hand and produce good continuations without any weight adaptation (in-context learning, Lampinen et al. 2024 ). From a meta-learning perspective, rapid in-context adaptation is expected to arise: log loss minimization with a parametric sequential predictor (like a neural network) over a distribution of stochastic data generators leads to a Bayesian predictor for the pretraining distribution ( Ortega et al. 2019 ) . The hallmark feature of such a predictor (Bayes-optimality) is most rapid in-context adaptation and least (cumulative) prediction error on average. Accordingly, prompting, that is conditioning of the Bayesian predictor, can be used to data-efficiently adapt the pretrained model to a target task. An important question is: under which conditions is it possible to find a prompt such that the prompted pretrained predictor becomes (near-) Bayes-optimal on a target task? We refer to this as optimal prompting , which is possible in theory if the target task is one of the tasks covered by the meta-distribution. If this is not the case, then optimal prompting may not be possible for an ideal predictor, and weight adaptation may be necessary. (a) Top: Performance of different tuning methods on Transformers, measured as excess log loss, i.e., regret ( Equation 10 , lower is better). See bar plots for color legend. Top-right: Detailed Transformer results for last step within the tuning sequence length {N_{\text{tune}}} and the last evaluation step {N_{\text{eval}}} . Right: Like above but for LSTM. Figure 1 : Models pretrained on sequences from coins with uniform random bias (length {N_{\text{train}}=100} ) are fine-tuned to the target task of a single coin with bias 0.2 (tuning sequence length {N_{\text{tune}}=50} ). Plots show prediction performance for tuned Transformers and LSTMs on the target task for different prefix- and weight-tuning methods. For both network types Soft Prompting (‘SoftPT’) is the only prefix-tuning method that leads to optimal performance. This holds up to the tuning sequence length, and degradations are only minor up to {N_{\text{eval}}=200} steps. The corresponding soft prefix of length =6 outperforms even the best hard token prefix of the same length (‘HardPF’). Most weight-tuning methods also perform very well in this setting. See Section 4 for details on methods. Thick lines and bars show the median over 10 tuning repetitions, thin lines individual repetitions, and shaded areas/bars show 25\%,75\% quantiles. See Figure 2 for a visualization of models’ internal dynamics. Regret curves for the LSTM, similar to top-left panel, are shown in Figure A5 . The goal of prompt tuning for a target task is to produce prompts that, when consumed by the model, inject maximal information (up to statistical sufficiency) about the target task into the predictor’s internal state. In practice, prompt optimization is often done by tuning soft prefixes, which are sequences of real-valued input vectors instead of hard tokens. As we show, the corresponding off-distribution inputs can exploit neural circuitry to inject substantially more information compared to even the best hard token sequence of the same length, without breaking subsequent internal dynamics. In this paper, we investigate prefix-tuning, where a short prompt prefix is tuned to maximize prediction accuracy over the subsequent tokens. We consider prefix search over hard tokens, and three soft prefix-tuning methods, including ‘Soft Prompting’, ( Lester et al. 2021 ) . The code to reproduce all our experiments is available at: https://github.com/google-deepmind/thunnini . Our main contributions are: • We discuss how prompting can be understood as steering a Bayesian sequential predictor via its pretrained in-context adaptation mechanism that arises from meta-training, see Section 2 . • We analyze theoretical conditions for the relationship between pretraining distribution and target task under which optimal prompting is and is not possible, see Section 3 . • We confirm these theoretical conditions empirically via a series of educational experiments, and show that in the negative case weight-based fine-tuning can succeed. See Section 4.2 . • We investigate mechanistic aspects of prompting LSTMs and Transformers, with experiments on both pretrained and untrained networks. In all cases, Soft Prompting can be much more effective than any hard token sequence of equal length, particularly for Transformers, where Soft Prompts can even cause untrained networks to behave as well-performing sequential predictors. See Section 4.2 . Limitations and Scope. As with any conceptual principle, the Bayesian view cannot exhaustively describe all in-context learning phenomena at (frontier model) scale: limited data and model expressivity, suboptimal optimization, out-of-distribution generalization, and other mechanistic aspects will have additional impact. Having said that, there are a number of recent investigations at LLM scale supporting the plausibility of the Bayesian view, such as Chan et al. 2022a who argue that distributional properties of natural language can easily give rise to a meta-learning setting. The simplicity of our experimental setup allows to carefully control the data statistics, and compare neural predictors against exact Bayes-optimal predictors—both of which is not true for LLM-scale experiments. Additionally, it allows us to focus on fundamental aspects of prompting that arise even in idealized settings, and thus hold at any scale. We believe that this lays important fundamental groundwork, which will help future research to isolate and more effectively investigate additional, non-idealized, aspects of in-context learning and prompt tuning at frontier scale. We do not propose improved prompt tuning methods in this work since our aim is to study and understand existing ones. 2 Background: Memory-Based Meta-Learning In this section we review how memory-based meta learning leads to Bayesian sequential predictors. Under this view, the role of prompt tuning is to facilitate the inference process of the target task. Tasks. Let an alphabet \mathcal{A} be a finite set of tokens (with one-hot encoding) and {x_{1:N}\in\mathcal{A}^{N}} be