Overview

6 The reliability problem

The chapter explains that large language models can sound highly reliable while still producing answers that are only loosely tied to truth. Their outputs are generated by predicting likely text continuations from patterns in training data and current context, not by checking facts against a stable internal record of reality. This makes hallucination a structural risk: the model may remain fluent, detailed, and confident even when it lacks solid evidence, which can mislead users into trusting outputs that are not actually grounded.

It also shows that reliability problems are amplified by the way models are trained and prompted. Because training rewards plausible completion more than refusal, models are encouraged to answer even when uncertain, and weak or ambiguous prompts can push them into overgeneralization, fabrication, or jailbreak-like behavior. Small changes in wording, tone, formatting, or context can shift outputs in surprising ways, revealing that instruction-following is a statistical pattern rather than true rule enforcement. As a result, models can appear to break rules or become inconsistent whenever contextual cues compete or when the prompt pushes them beyond familiar territory.

The chapter concludes that reliability must be engineered around the model rather than assumed inside it. External context, retrieval-augmented generation, chain-of-thought and verification steps, uncertainty monitoring, filtering, and human oversight can all reduce errors, but none can eliminate them entirely. Because the model’s active context is limited and attention is uneven, even relevant information may be underused or misplaced, and retrieved evidence does not automatically guarantee grounding. The central lesson is that language models can be useful within carefully designed boundaries, but their outputs remain probabilistic and need validation when accuracy matters.

Models learn patterns from training data and extend them to new cases. In this example, animals associated with water are often labeled as fish. When no clear example is available, as with the dolphin, the model does not stop or admit uncertainty. It continues by extending the strongest available pattern, incorrectly classifying the dolphin as a fish rather than a mammal.
A model trained within a limited range learns a trend and generalizes by extending it beyond the observed data. When applied outside that range, the same mechanism produces confident yet unrealistic predictions. Hallucinations in language models arise in an analogous way, as extrapolation continues under insufficient constraint.
Reducing hallucination through external context. When model knowledge is incomplete or unreliable, relevant information can be introduced at generation time through the prompt. By incorporating external data, the model’s output is guided toward available evidence, reducing unsupported claims and increasing the likelihood of producing a grounded answer.
Structuring generation through reasoning and verification. In a direct approach, the model produces an answer in a single step. Chain-of-thought (CoT) prompting introduces intermediate reasoning steps that make the path to the answer explicit. Chain-of-verification (CoV) extends this process by adding a second stage in which the initial answer is checked against supporting conditions, reducing the likelihood of unsupported conclusions.
Uncertainty in token prediction. When a model assigns high probability to a single continuation, generation is stable and strongly constrained. When multiple alternatives have similar probabilities, the model operates under higher uncertainty, increasing the likelihood of unsupported or fabricated outputs.
Language generation as probabilistic continuation. Given a prompt, the model produces a probability distribution over possible next tokens based on patterns learned during training. The response emerges by selecting tokens from this distribution step by step, rather than by executing explicit rules.
Positional influence within the context window. Information placed near the beginning or end of the context tends to influence the model’s response more strongly than information located in the middle, illustrating that presence in the context window does not guarantee equal impact on the output.
Retrieval-augmented generation pipeline. A user query is transformed into an embedding, a vector representation used for similarity comparison against embedded documents in a knowledge base. The system ranks documents by semantic similarity and inserts only the top matches as text into the prompt before generation. The model’s response is thus conditioned on both its internal parameters and selectively retrieved external knowledge.

Summary

  • Hallucinations arise when language models generate outputs that appear coherent and confident but lack grounding in verifiable evidence, emerging from the statistical nature of language modeling, especially when relevant knowledge is sparse or ambiguous.
  • Structuring generation through intermediate reasoning and verification steps, such as chain-of-thought and chain-of-verification approaches, can improve performance by making assumptions explicit and reducing unsupported conclusions.
  • Monitoring uncertainty during generation can help identify outputs that may be unreliable, using internal signals as indicators of weak statistical support rather than as guarantees of correctness.
  • Providing reliable external information through the prompt can reduce hallucinations by grounding responses in identifiable sources, though no technique fully eliminates them within a purely predictive framework
  • Model behavior is governed by statistical regularities learned during training rather than by explicit rules or hard-coded directives.
  • Because generation follows probabilistic patterns, small differences in wording can shift responses substantially, and no universal prompt formulation guarantees optimal results.
  • Repeating or restructuring input within the prompt can reinforce the influence of relevant information, partially counteracting positional effects in the context window.
  • Safety alignment functions as a probabilistic influence rather than a categorical barrier, shaping model tendencies without enforcing absolute constraints.
  • Jailbreaks exploit the probabilistic nature of alignment by crafting prompts that shift the statistical balance toward patterns associated with compliance rather than refusal.
  • Various safeguards attempt to reduce undesirable behavior, including input filtering, output moderation, architectural constraints, structured prompting, and external monitoring.
  • Language models can only reason over information contained in their internal parameters and the material present within the current context window.
  • Even within that window, attention mechanisms distribute influence unevenly, so some information may dominate the response while other relevant signals are partially ignored.
  • Retrieval-augmented generation addresses the limited capacity of the context window by selectively injecting external knowledge into the model’s working context.

FAQ

```html
What is the reliability problem in language models?Language models can sound confident and coherent while still producing incorrect or unsupported answers. The reliability problem is that fluency does not guarantee grounding, so users may trust outputs that are only plausible continuations of text rather than verified facts.
Why do language models hallucinate?Hallucinations happen because models are trained to predict the next token based on patterns, not to verify truth. When the evidence is weak, ambiguous, or missing, the model may still continue generating a fluent answer instead of stopping or admitting uncertainty.
How is hallucination different from an ordinary mistake?An ordinary mistake is often easy to spot, like a wrong date or a missed instruction. Hallucination is harder to detect because the output remains polished, detailed, and confident even when it lacks real support.
Why do models answer even when they are uncertain?Training and evaluation often reward giving an answer more than refusing to answer. That creates an incentive to continue generating plausible text under uncertainty rather than to withhold a response.
What makes weak prompts more likely to produce bad answers?Weak prompts can imply facts, premises, or references that the model has not actually verified. Instead of challenging those assumptions, the model may extend familiar patterns and produce a locally plausible but globally unreliable answer.
How can hallucinations become a real-world risk?When generated text enters professional workflows, errors can spread into legal, business, or customer-facing documents. A fabricated citation, statistic, or policy statement may be reused and treated as legitimate, causing operational and reputational harm.
Can chain-of-thought or verification reduce hallucinations?Yes, but only partially. Chain-of-thought adds intermediate reasoning steps, and chain-of-verification adds a checking stage, both of which can surface errors earlier. However, they do not guarantee correctness because the model can still repeat or rationalize the same mistake.
Why do context limits matter for reliability?The model can only use information inside its context window at the moment of generation. If relevant details are outside that window, or placed in weak positions, the model may ignore them or fail to use them effectively.
What is retrieval-augmented generation, and does it solve the problem?Retrieval-augmented generation, or RAG, brings in external documents at generation time so the model can answer using more relevant evidence. It improves grounding, but it does not guarantee reliability because the model can still ignore, misread, or go beyond the retrieved sources.
How do jailbreaks relate to the reliability problem?Jailbreaks show that model behavior depends on a balance of statistical cues rather than hard rules. By changing framing, examples, or added text, attackers can sometimes push the model toward outputs that safety systems were meant to prevent.
```

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Machines that Think ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Machines that Think ebook for free