Understanding unsupported language-model answers probabilistically

← Back to Blog & Articles

A hallucination is a model output that is fluent, confident in presentation, and factually incorrect — a fabricated citation, an invented biographical detail, a plausible-sounding but wrong numerical answer.

A hallucination is a model output that is fluent, confident in presentation, and factually incorrect — a fabricated citation, an invented biographical detail, a plausible-sounding but wrong numerical answer. Treating this as a mysterious or exotic failure mode obscures a fact that follows directly from the training objective covered in the companion book and the companion book: hallucination is a predictable, structural consequence of maximum-likelihood training on a next-token prediction objective, not an incidental bug layered on top of an otherwise fact-checking system.

Recall the objective directly. Pretraining minimizes 𝔼x∼p[−logpθ(xt∣x<t)]\mathbb{E}_{x \sim p}\big[-\log p_\theta(x_t \mid x_{<t})\big] — the expected negative log-probability the model assigns to the token that actually appears next in real training text, averaged over the training distribution. This objective rewards pθp_\theta for concentrating probability mass on tokens that are likely to occur next in fluent, well-formed continuations of the kind seen during training, and it does so identically regardless of whether the resulting continuation happens to state a true fact or a false one. Consider a prompt asking for a specific, low-frequency factual detail — the middle name of a minor historical figure, the exact publication date of an obscure paper, a citation for a claim. If the correct answer appeared rarely (or not at all, in the precise form asked for) in the training corpus, the model has little or no direct evidence pinning down pθp_\theta at that position; what it does have, by construction of the objective, is strong pressure to produce some fluent, syntactically well-formed, topically appropriate continuation, because fluency and topical appropriateness are exactly what the vast majority of training gradient signal reinforces. Nothing in the cross-entropy loss, evaluated at training time, distinguishes “the model assigned high probability to the true continuation because it has reliable evidence for it” from “the model assigned high probability to a plausible-sounding but false continuation because plausible-sounding completions of that syntactic shape were common in training.” Both cases look identical to the loss function: a single scalar, the log-probability assigned to whatever token sequence happened to follow in the training example being processed at that step. There is no token-level training signal of the form “this specific claim is false, penalize confident assertion of it” — the objective only ever sees one realized continuation per training example, drawn from whatever text existed, never a labeled contrast between a confidently-correct and confidently-incorrect version of the same claim. This is the precise sense in which hallucination is rooted in the objective rather than the architecture: a model trained to maximize the likelihood of its training distribution has every incentive to be fluent and topically coherent, and only an indirect, statistically diffuse incentive to be factually correct at the specific token positions where correctness and fluency come apart.

Calibration as the relevant technical concept. The question this framing raises — does the model’s expressed confidence track its actual correctness rate? — has a standard name and a precise definition: calibration. A model is well-calibrated if, among all the times it assigns probability (or confidence) pp to an answer being correct, that answer is in fact correct approximately a fraction pp of those times, for every value of pp. Formally, for a model that outputs a confidence score p̂\hat p alongside a prediction, calibration requires Pr(correct∣p̂=p)≈p\Pr(\text{correct} \mid \hat p = p) \approx p for all p∈[0,1]p \in ; a calibration curve plots the empirical accuracy of predictions binned by their stated confidence against the diagonal y=xy=x that perfect calibration would trace, and systematic deviation above or below the diagonal identifies under- or over-confidence respectively. Calibration is a strictly narrower property than correctness — a model can be perfectly calibrated while still being frequently wrong (as long as it correctly reports low confidence when it is likely to be wrong), and a model can be highly accurate while being poorly calibrated (as long as its confidence scores do not track which specific answers are the wrong ones) — which is exactly why it is the right concept for hallucination specifically: the practical harm of a hallucination is not merely that the model was wrong, but that it was wrong while presenting the claim with the same fluent, unhedged confidence it uses for claims it has strong evidence for, giving a reader no signal to distinguish the two cases.

Kadavath, Conerly, Askell, et al. (2022) study this question directly and find a genuinely two-sided result. Using the raw token-level probabilities a pretrained model assigns to answer options in a multiple-choice or true/false format, they find that larger models are reasonably well-calibrated — the model’s own probability of an answer correlates well with that answer’s actual correctness rate, when confidence is read off this format-matched way. They further show models can be trained to predict a self-evaluation score, “P(True),” for their own previously generated answers with encouraging calibration that generalizes partially, though not perfectly, across tasks — a meaningfully positive finding: the token-level probabilities produced by the mechanism above are not simply noise with respect to truth. It is also narrower than it first appears: calibration measured this way is a property of the raw next-token distribution over short, pre-specified answer options, not a guarantee that carries over to open-ended, free-form generation, where there is no fixed small set of options to assign probability mass across, and where the “confidence” a user infers from a fluent, hedge-free answer has no well-defined numerical counterpart to check calibration against in the first place.

The effect of RLHF and DPO on calibration. The picture becomes more complicated, not simpler, once a model passes through the preference-based alignment stage covered in the companion book. Ouyang, Wu, Jiang, et al. (2022), introducing the InstructGPT RLHF recipe, document what the field has since called an “alignment tax”: adaptation for helpfulness and instruction-following can trade off against other measured properties of the base model, even as it clearly improves the properties it directly targets. On calibration specifically, OpenAI’s GPT-4 technical report (OpenAI, 2023) presents a directly relevant, documented comparison: measuring calibration on a multiple-choice evaluation before and after RLHF post-training, the pretrained base model’s stated confidence tracks its accuracy closely (a calibration curve close to the diagonal), while the same model after RLHF shows markedly worse calibration — systematic overconfidence relative to actual accuracy. The likely mechanism is not hard to state: RLHF and DPO optimize toward human (or AI) preference judgments over complete responses (the companion book derives the Bradley–Terry preference model and the resulting reward-maximization and DPO objectives in full), and human raters tend to prefer confident, hedge-free answers over answers that appropriately express uncertainty, especially when the rater cannot easily verify the claim — so an optimization process faithfully maximizing preference-model reward has a real incentive to suppress exactly the hedging language that would otherwise signal low confidence, independent of whether the model’s underlying, pre-alignment uncertainty actually decreased. This is a documented empirical finding, not a fully solved one: pretraining-stage calibration is not automatically preserved through adaptation, whether a given alignment procedure improves or degrades it is an empirical question to be measured rather than assumed, and no training recipe is currently known to deliver both strong instruction-following and provably preserved calibration simultaneously.

Continue with the book

Explore the full treatment, worked examples, and exercises in LLMs Derived.


Companion article for LLMs Derived, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.

Scroll to Top