Sub topic 7
When the Prompt Itself Leads the Model Astray
What this chapter assumes
You have used a chat assistant and read earlier chapters on next-token prediction and on what counts as a hallucination. You can read short Python. The earlier chapters covered errors that come from the model's own gaps. This chapter covers errors that come from the input: a question with a wrong assumption in it, or a document the model was given and then did not follow.
Two kinds of context failure
A context failure happens when the model has what it needs, either in its training or in your prompt, and still produces a wrong answer because of how the prompt is built. There are two common forms:
- False premise: the prompt asserts something untrue, and the model builds on it.
- Ignored or overridden source: the prompt includes reliable material, and the answer contradicts it or goes beyond it.
Both follow from how the model works. It continues the text in front of it with whatever is statistically plausible. A prompt is part of that text, so a confident false statement in the prompt shifts what counts as a plausible continuation.
False premises
Why the model goes along
Consider this question:
Why did Marie Curie win her third Nobel Prize in 1925?Curie won two Nobel Prizes, in 1903 and 1911. The question presupposes a third. A model that answers "Her 1925 prize recognised..." has treated the premise as background fact and produced a fluent explanation of something that never happened.
Several forces push the model toward accepting the premise:
- Text pattern. Most "Why did X do Y?" questions in training text are about things that did happen. A premise-challenging reply is rarer than a compliant one.
- Instruction tuning. Models are tuned to be helpful, and humans tend to rate answers that engage with the question above answers that dispute it. This tendency to agree with the user is called sycophancy.
- Weak recall of the real fact. The model may know Curie won two prizes. That knowledge competes with the pull of a question that sounds sure of itself.
Variants to watch for
| Variant | Example | What goes wrong |
|---|---|---|
| Invented event | "Summarise the 2019 merger of Company A and Company B." | The model writes a plausible merger story. |
| Wrong attribute | "Since Python is compiled to machine code, why is it slow?" | The answer accepts "compiled to machine code" and explains around it. |
| Loaded framing | "What are the three main flaws in this proof?" | The model finds three flaws, even if the proof is correct. |
| Embedded user belief | "I'm sure the answer is 42. Can you confirm?" | The model drifts toward agreement. |
| Fake entity | "What does the `--fast-merge` flag of `git commit` do?" | The model describes a flag that does not exist. |
The "three flaws" case is easy to miss. The number three is a premise too, and it asks the model to produce three items whether or not three exist.
Ignored or overridden sources
Supplying a document does not guarantee the answer follows it. The model has two sources of information. One is the knowledge stored in its weights from training. The other is the text in its context window. When they disagree, the model does not reliably prefer the context.
Prior knowledge wins
Suppose you paste a company policy that says refunds are allowed within 45 days. The model has seen thousands of policies saying 30 days. It may answer "30 days" because that value is a stronger pattern than your document. This is most likely when:
- the document's fact is unusual or contradicts common knowledge,
- the question is phrased the way common web text phrases it,
- the relevant sentence is short and surrounded by a lot of other text.
Position and length
Long contexts degrade retrieval. Models often use information at the start and end of a long prompt better than information in the middle. The effect varies by model and has shrunk in newer ones, but you should not assume it is absent. A fact on page 40 of a pasted report may simply not influence the answer.
Conflicting material
When two sources disagree, for example an old and a new version of a spec, the model often blends them or picks one without saying so. A blended answer can contain details that appear in neither source.
Going beyond the source
The most common grounding failure is partial. The answer starts from your document and then adds a detail that sounds right but is not in it. Suppose the document says a report "covers 2021 data" and the model writes "covers 2021 data from 12 regions". The twelve regions came from nowhere. Supporting text surrounds the invented detail, so it looks verified.
Detecting the problem
Check the premise first
Before reading an answer, read your own question as a list of claims. Ask which claims you stated as fact and whether you verified them. If the answer repeats a claim from your question without adding anything, the model may be echoing you and not confirming it.
Check numbers against the source
When the model summarises a document, compare the figures it gives with the figures in the document. This script flags numbers in an answer that never appear in the source.
import re
def unsupported_numbers(answer, source_text):
pattern = r"\d+(?:[.,]\d+)*"
in_source = set(re.findall(pattern, source_text))
return [n for n in re.findall(pattern, answer) if n not in in_source]
source = "The survey covered 1,200 households in 2021. Response rate was 64%."
answer = "The survey covered 1,200 households in 2022, with a response rate of 64%."
print(unsupported_numbers(answer, source))This prints ['2022']. The script is a coarse filter. It misses a correct number placed in the wrong sentence, and it flags legitimate derived values such as a sum the model computed. Treat its output as a list of places to look, not a verdict.
For quotations, the quote_supported check from the plan serves the same purpose. A quote that is not a substring of the source was either paraphrased or invented.
Test with a probe
Ask a question whose premise you know is false and see what happens. For example, ask about "the 2019 merger" of two companies that never merged. A model that plays along on a probe is likely to play along on a real question where you cannot tell.
Reducing context failures
You cannot remove these failures, but you can lower their rate.
- Phrase questions neutrally. Use "Did Curie win a third Nobel Prize?" or "What do you know about Curie's Nobel Prizes?" instead of presupposing the event.
- Give the model permission to reject the premise. Add a line such as "If the question assumes something that is not true, say so before answering."
- Remove numbers you do not need. "List the flaws, if any" beats "List three flaws."
- Tell the model to use only the supplied text. For example: "Answer only from the document below. If it does not say, reply 'Not stated'."
- Ask for quotes. Request the sentence from the document that supports each claim, then check those quotes mechanically.
- Keep context short. Paste the relevant section, not the whole file.
- Separate opinions from facts. Do not state your own belief as part of the question if you want an independent check.
Edge cases
- True but unusual premises. If you ask about a real but obscure event, a model with weak recall may wrongly "correct" you. A model that rejects a true premise is also a context failure. Check the claim yourself before accepting either response.
- Hypotheticals and fiction. "Suppose Curie won a third prize" is a legitimate premise. The task is to reason within it. Make clear in the prompt when you want that, so that you can distinguish deliberate pretence from an error.
- Multi-turn drift. An early wrong statement, from you or from the model, stays in the conversation and shapes later answers. If a chat goes wrong, starting a new one with a corrected prompt is often more reliable than arguing with the old one.
- Pushback flips answers. If you reply "Are you sure?" to a correct answer, some models change it. A changed answer after pushback is not evidence of the earlier answer being wrong.
- Tool and retrieval output. Text returned by a search tool also enters the context. If the retrieved page is wrong, outdated, or irrelevant, the model can repeat its errors with confidence.
Exercise
A user asks, "Why does the Python function list.sorted() return a new list instead of sorting in place?" Identify the false premise, describe what a model that accepts it would likely do, and rewrite the question so it does not presuppose the error.
Show answer
The premise is that list.sorted() exists. Python has the built-in function sorted(), which returns a new list, and the method list.sort(), which sorts in place. There is no list.sorted() method. A model that accepts the premise would explain a method that does not exist, probably by describing a design choice for it. A neutral rewrite is: "What is the difference between sorted() and list.sort() in Python?" You can also add: "If I've misnamed anything, tell me."
Exercise
You paste a one-page contract that gives a 14-day cancellation window. The model's summary says "You may cancel within 30 days." Name the most likely cause, then give two steps that would catch or prevent the error.
Show answer
The most likely cause is prior knowledge overriding the context: 30 days is a common figure in similar documents, so it outweighs the single sentence in your text. To catch it, run a number comparison such as unsupported_numbers and notice that 30 does not appear in the contract. To prevent it, instruct the model to answer only from the document and to quote the sentence that supports each figure, then check that the quote appears in the contract.