TL;DR
This paper challenges the prevailing explanation of language model (LM) intelligence as implicit Bayesian inference (IBI). Through experiments with Transformers on compositional tasks, the authors demonstrate that LMs exhibit behaviors on out-of-distribution (OOD) prompts that go beyond what IBI predicts, suggesting LMs can generalize compositionally in ways not captured by Bayesian frameworks.
What Problem Does This Paper Address?
A common narrative in the field is that autoregressive language models (LMs) exhibit intelligent behaviors like in-context learning (ICL) due to implicit Bayesian inference (IBI). The idea is that LMs, trained on diverse data, learn to infer latent concepts and make predictions consistent with a Bayesian posterior. However, Bayesian inference is known to struggle with out-of-distribution (OOD) data due to model misspecification. This paper investigates whether this IBI explanation holds up when LMs are tested on OOD prompts, particularly in compositional tasks where combining learned rules is crucial. The core question is: can LMs truly generalize compositionally beyond what a strict Bayesian interpretation of their training data would allow?
Methods
The authors train small-scale decoder-only Transformers on carefully constructed datasets designed to probe their behavior on OOD prompts. They compare the Transformer's predictions to several models of behavior:
- Implicit Bayesian Inference (IBI): The baseline, representing predictions consistent with a Bayesian posterior over the training data mixture.
- Extrapolated Bayesian Inference: Assumes the model continues to perform IBI on OOD data.
- Generalized Bayesian Inference: A more flexible framework that allows for deviations from strict Bayesian posteriors, including tempered Bayesian inference and generalist models that capture broader patterns.
They specifically design experiments using coinflip data and formal Dyck languages to test different aspects of generalization, including interpolation, extrapolation, and compositional rule learning.
Datasets
The experiments utilize two main types of synthetic datasets:
- Coinflip Data: Mixtures of Bernoulli distributions with varying success probabilities (e.g., 0.1 and 0.6). Test prompts are drawn from distributions that are either interpolations or extrapolations of these training probabilities, or from a Markov chain.
- Dyck Languages: Formal languages consisting of matched and nested parentheses and brackets (e.g., Dyck-1, Dyck-2, Dyck-3). Training data consists of mixtures of simpler Dyck languages, and test data consists of more complex, OOD Dyck languages that require compositional generalization.
Key Insights and Ideas
- Transformers "temper" Bayesian inference: The paper suggests that Transformers, unlike strict Bayesian models, are less prone to collapsing into a single mixture component when faced with OOD data. This "implicit tempering" allows them to maintain more balanced predictions, which is advantageous under model misspecification.
- Compositionality beyond Bayesian limits: Transformers demonstrate an ability to generalize compositionally to OOD tasks, even when the Bayesian posterior is undefined or when the task requires combining rules in ways not explicitly present in any single training component.
- Information sharing is key: The authors highlight that "information sharing" between the learned components within a Transformer is crucial for successful OOD generalization, particularly in compositional tasks. This suggests that individual attention heads might learn specialized aspects of the training data, and their combined effect allows for more robust extrapolation.
Key Results
- Coinflip Experiments: Transformers closely matched tempered Bayesian inference on OOD coinflip tasks. They were able to extrapolate better than explicit Bayesian inference within the convex combination of training probabilities but performed slightly below Bayesian inference outside this range.
- Dyck Language Experiments: Transformers showed strong performance on compositional rule-learning tasks, outperforming generalized Bayesian models, especially when the OOD task required combining rules from different training components. This suggests they can generalize compositionally by effectively combining information from their learned components.
- Ablation Studies: Knockout experiments (disabling individual attention heads) revealed that Transformers' generalization capabilities are distributed across multiple heads, supporting the idea of information sharing.
Limitations and Future Work
- Small-scale experiments: The authors acknowledge that their analysis is based on small-scale Transformers and datasets, which limits the generalizability of their findings. They suggest that training much larger models for longer durations might reveal qualitatively different behaviors.
- Future work: The paper opens avenues for future research into building more generalist models by understanding and leveraging information sharing between components. Further investigation into how Transformers learn and combine rules for compositional generalization is also suggested.
Summary updated