Exposure Bias
Exposure bias is the mismatch between how an autoregressive language model is trained and how it is used. During standard teacher-forced training, every next-token prediction is conditioned on a prefix copied from the training text. During generation, every prediction is conditioned on a prefix the model wrote itself. That objective does not directly train or score continuation from the model’s own earlier mistake; sequence-level training and scheduled sampling can expose it to its own predictions.
Where the mismatch comes from
Maximum-likelihood training, usually called teacher forcing, minimizes the loss on each position given the true previous tokens:
\[ \mathcal{L}(\theta) = -\sum_{t=1}^{n} \log p_\theta(y_t \mid y_{<t}^{\text{gold}}, x) \]
Here \(x\) is the input or prompt, \(y_t\) is the token at position \(t\), and \(y_{<t}^{\text{gold}}\) is the true prefix from the corpus. At generation time the model computes \(p_\theta(\hat y_t \mid \hat y_{<t}, x)\), where \(\hat y_{<t}\) are tokens it sampled earlier. If those tokens ever differ from anything natural in the training text, the model is asked to predict from a context that was rare or absent in training. The name “exposure bias” comes from this: the model is exposed only to gold prefixes during training. Ranzato et al. used the term in their sequence-level training work, and Bengio et al. described the same train/test discrepancy and proposed scheduled sampling, which gradually feeds the model its own predictions during training.
Why errors compound
A small calculation shows why the mismatch matters more for long outputs. Take a hypothetical model that, given a correct prefix, gets each token wrong with probability 0.01. For a 100-token output the chance that every token is right is \(0.99^{100} \approx 0.366\), so even with no mismatch, long outputs are likely to contain at least one slip. Exposure bias adds a second effect: after a slip the model may be worse than 0.01 per token, because it is now in a context it was not trained on.
A short script that iterates the recurrence below gives the expected number of wrong tokens in 100 positions when the per-token error rate is 0.01 before the first slip and a higher rate after it (all rates are assumptions, not measurements):
| rate after the first slip | expected wrong tokens in 100 |
|---|---|
| 0.01 (no compounding) | 1.00 |
| 0.05 | 2.46 |
| 0.20 | 7.95 |
The first row is simply \(100 \times 0.01\). The other rows come from iterating the recurrence “probability the prefix is still clean, times 0.01, plus probability it is not clean, times the post-slip rate”. The numbers are not a prediction for any real model. They show the structure: a single early slip changes the rate for everything after it, so a higher post-slip rate increases errors at every later position. In this recurrence the expected number of errors is linear in that rate; the additional errors accumulate over the positions remaining after the slip.
What it does and does not explain
Exposure bias is a hypothesis about a mechanism, and the evidence for how large the effect is in modern large language models is mixed. Some outputs go wrong for other reasons: the model lacks the fact, the prompt is ambiguous, or the decoding procedure picks a low-probability token. A model also does not always get worse after an error; a strong model can notice a contradiction in its own text and recover. When an output degrades, the diagnosis needs a test such as comparing behavior on gold prefixes against self-generated prefixes, not just the label.
It is also not the same as the following neighbors:
- Hallucination. A fabricated fact can appear in the first token of an answer, where the prefix is entirely gold. That is a knowledge or calibration failure, not a prefix mismatch.
- Distribution shift in the data. Shift concerns the inputs \(x\) differing between training and deployment. Exposure bias concerns the prefix \(\hat y_{<t}\) differing even when \(x\) is identical.
- Sampling randomness. Greedy decoding has no randomness and can still suffer exposure bias, because its prefixes are the model’s own.
Mitigations and trade-offs
Scheduled sampling mixes model-generated tokens into the training prefix. Sequence-level objectives, such as optimizing a task metric on whole generated outputs with reinforcement learning, train on the model’s own samples directly. Both pay a cost: the training signal becomes noisier or more expensive than the one-pass teacher-forced loss, which is why teacher forcing remains the default for pre-training. At inference time, verifying or re-sampling an output, or cutting generation short when a check fails, limits how far one slip can propagate.
References
- Ranzato et al., Sequence Level Training with Recurrent Neural Networks โ https://arxiv.org/abs/1511.06732
- Bengio et al., Scheduled Sampling for Sequence Prediction with Recurrent Neural Networks โ https://arxiv.org/abs/1506.03099
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
