Sub topic 14
Limitations: hallucination, knowledge cutoffs, and sensitivity to prompts
This chapter assumes you have read the earlier chapters on the next-token objective, decoding and sampling, and post-training. You should be comfortable reading short Python and thinking about probability distributions. Each limitation below follows from how the model is built and trained.
Why the limitations follow from the design
A language model is trained to minimize cross-entropy on the next token. It is rewarded for assigning high probability to text that looks like its training data. It is not rewarded for being true. Decoding then turns those probabilities into one token at a time, with no built-in step that checks facts.
Hallucination
A hallucination is fluent output that is false or unsupported. It happens because the model picks tokens that are plausible given the context, even when it has no reliable fact to draw on.
Typical causes:
- Rare facts. A detail seen only a few times in training may leave a weak, blurry trace. The model still produces a confident-sounding answer.
- Pressure to continue. The model must emit some token at every step. A made-up citation looks, token by token, like a real one.
- Post-training incentives. Preference tuning can reward answers that sound helpful and complete, which discourages saying "I don't know."
- Compounding. Each generated token becomes input for the next. An early wrong detail makes later wrong details more likely.
You can see the mechanism in the distribution. When the model is uncertain, probability spreads across several candidates, and sampling may pick a wrong one.
import numpy as np
def softmax(logits):
z = np.exp(logits - np.max(logits))
return z / z.sum()
# Candidate next tokens after "The capital of Australia is"
tokens = ["Canberra", "Sydney", "Melbourne", "Perth"]
logits = np.array([2.0, 1.6, 1.0, 0.2])
probs = softmax(logits)
for t, p in zip(tokens, probs):
print(f"{t:10s} {p:.2f}")
rng = np.random.default_rng(1)
draws = rng.choice(tokens, size=1000, p=probs)
wrong = np.mean(draws != "Canberra")
print(f"Wrong answer in {wrong:.0%} of samples")Even though the correct answer has the highest probability, more than half of the samples are wrong. Lower temperature or greedy decoding reduces this, but it cannot fix a case where the highest-probability token is itself wrong.
Knowledge cutoffs
Model weights are fixed after training. The model knows nothing about events after its training data ends. Two details matter:
- The effective cutoff is often earlier than the stated one, because recent events have less coverage in the data than older events.
- The model has no clock. Unless the date is in the prompt, it may assume the present is close to its cutoff.
The usual fixes supply information at inference time. You can paste documents into the context window, or connect the model to search or a database. The model then reads the facts from its input instead of recalling them from its weights.
Sensitivity to prompts
The prompt is the only thing that conditions the output, so small changes can shift the distribution.
- Wording. Two paraphrases of the same question can produce different answers.
- Order and format. The order of examples or options can bias the result. Models often favor items near the start or end of a long context.
- Framing. A leading question ("Why is X true?") can make the model go along with a false premise.
- Sampling. With temperature above 0, the same prompt gives different outputs on different runs.
Practical habits that help:
- Ask for sources or quotes from supplied text, then check them.
- Test important prompts on several paraphrases and compare the answers.
- Put key instructions clearly and avoid burying them in the middle of long inputs.
- Use low temperature for factual tasks, and verify outputs that matter.
Exercise
A user asks a model about a product released after its training data ended, and the model gives a detailed but wrong description. Name the limitation, and give one way to reduce the problem.
Show answer
This is a knowledge cutoff combined with hallucination: the model has no data about the product, so it generates plausible text. One fix is to supply the product's documentation in the prompt, or to connect the model to a search tool, so it answers from provided text instead of from its weights.