What a hallucination actually is
A language model hallucinates when it produces something that sounds confident and well-formed but is not true. A fake citation. An invented function in a library. A meeting that did not happen. A statistic with no source.
It is not the model "lying" — there is no intent. The model is producing the most plausible next sequence of words given the prompt and its training. When plausibility is high but truth is low, you get a hallucination. The dangerous part is that hallucinations look exactly like correct answers. Fluent, structured, sometimes annotated. There is no built-in signal saying "this part is invented."
This article walks through where hallucinations come from and the practical techniques that actually reduce them.
Three kinds of hallucination worth distinguishing
Treating all hallucinations as one problem leads to wrong fixes. Separating them helps:
1. Knowledge gaps. The model does not know the answer and fills the gap. Common with niche topics, recent events, or unusual API surfaces. Fix: provide the source material in the prompt rather than relying on the model's memory.
2. Confidence inflation. The model knows part of the answer but extrapolates beyond what it should. Common in technical questions where the right answer is "it depends on X" but the model commits to one branch. Fix: ask the model to identify what it does not know before answering.
3. Format pressure. The model is asked to fill a structured output (a JSON schema, a citation list) and invents content to fit the shape. Common with citation generation, contact info, or "list 5 examples" prompts. Fix: allow the model to return fewer items, or an explicit null.
Almost every hallucination falls into one of these. Misdiagnosing which type you are seeing is the most common reason fixes do not stick.
Why bigger models do not solve it on their own
It is tempting to assume hallucinations are a "small model problem" that will go away with the next release. Bigger and more capable models do hallucinate less on common topics. They do not eliminate the problem. On the edges — niche domains, very recent information, anything outside the training distribution — even frontier models invent confidently.
The improvement from scale is asymmetric: hallucinations become rarer but harder to spot, because the surrounding text is more polished. A model that hallucinates poorly is easier to catch than one that hallucinates fluently.
The techniques that actually help
1. Ground the model in source material.
The single largest gain comes from not asking the model to recall facts at all. If the answer should be drawn from a document, paste the document into the prompt and ask the model to answer "based only on the text provided." This is the foundation of retrieval-augmented generation (RAG) and works the same way for ad-hoc prompts.
The instruction matters: "based only on the provided text" reduces hallucination more than "use the provided text." Modern models follow the stronger phrasing more reliably.
2. Give an explicit way to say "I don't know."
By default, the model is biased toward producing an answer. Counteract this:
> "If the source material does not contain the answer, reply with exactly the string NOT_FOUND and stop. Do not infer."
This single line eliminates a large fraction of confidence-inflation hallucinations. The model is much happier to say it does not know when given permission to.
3. Ask for citations to specific lines.
For document-grounded tasks: "For each claim in your answer, quote the exact sentence from the source it is based on." This adds visible accountability. If the model cannot quote, it usually cannot answer.
Be aware: when a model is forced to cite and does not have a source, it may invent the quote too. The next defence layer is verifying the quotes exist in the original — a quick string search catches most fabricated citations.
4. Verify against external sources for high-stakes claims.
For anything that will be published or acted on, do not trust unverified output. The model is good at proposing answers; it is not good at being the final reviewer of its own facts. A 30-second check in a search engine or against a primary source resolves most uncertainty.
5. Lower temperature for factual tasks.
Higher temperature increases hallucination rates because it allows the model to sample less-likely tokens that drift away from learned facts. For extraction, citation, and fact-heavy outputs, run at temperature 0 to 0.2.
6. Decompose questions that mix recall and reasoning.
"What did X say about Y in 2024, and is that argument logically sound?" stacks recall and reasoning in one prompt. The recall errors propagate. Split it: first ask for the exact quote, verify it exists, then ask for analysis of that quote. Each step is easier to verify independently.
Patterns that make hallucinations worse
A handful of habits silently increase hallucination rates:
- Asking for "5 examples" or "10 references." Round numbers pressure the model to invent to reach the count. Ask for "as many as exist, up to 5" instead.
- Asking about very recent events. Knowledge cutoffs matter. The model may answer anyway, especially if the prompt is confident.
- Mixing the model's voice and the user's questions. "What do you think about X?" invites speculation that gets phrased as fact. "What evidence exists for X?" invites grounded retrieval.
- Long, unfocused prompts. When the instructions are vague, the model fills the gaps with its priors. Tight prompts hallucinate less.
When to accept some hallucination
Some workflows are robust to hallucination because the human is in the loop and corrections are cheap. Brainstorming, first-draft generation, code suggestions in an IDE — in all of these, the cost of a wrong suggestion is small, and the speed gain from accepting some errors is large.
Other workflows are not robust: medical or legal advice, financial calculations, anything that gets published without review. The same model in the same conversation can be acceptable for one and dangerous for the other. Knowing which side of that line your use case sits on is the most important judgement call you make.
The takeaway
Hallucinations are a property of how language models work, not a defect of one model or one release. They are dramatically reduced — though not eliminated — by grounding the model in source material, giving it permission to refuse, asking for citations, and verifying claims that matter. None of these techniques are exotic. The teams that ship reliable AI features use them as defaults; the teams whose AI features keep embarrassing them usually have not adopted any of them yet.