A customer-facing chatbot that invents an answer is worse than no chatbot. It is confident, it is wrong, and the customer believes it — which means you now have a commitment you did not make.

The problem cannot be eliminated entirely, because producing plausible text is what these models do. It can be managed down to the point where it is a rare, detectable event rather than a routine risk.

Why it happens

A language model predicts likely text. Asked something it has no information about, it produces what an answer to that question would plausibly look like. There is no internal mechanism distinguishing "I know this" from "this seems like the right shape".

That framing explains why the fixes work. You are not teaching the model to be honest. You are arranging things so it has the right information, and so that admitting a gap is an available and acceptable action.

1. Ground answers in retrieved content

The foundational technique. Rather than asking the model what your returns policy is, search your documents for the relevant passage, supply it, and ask the model to answer using that.

This moves the question from "what do you know" to "what does this text say", which is a task models do far more reliably.

Done well, this removes the majority of invention. What remains is usually not the model making things up — it is retrieval returning the wrong passage and the model faithfully answering from it. Which means that past a certain point, improving retrieval is improving accuracy.

2. Instruct explicitly, and mean it

The system prompt should be unambiguous:

Answer only using the provided context. If the context does not contain the answer, say that you do not have that information and offer to connect the customer with a person. Never guess, infer or fill gaps from general knowledge.

Two details matter. State what to do instead of answering, not just what not to do — models follow positive instructions better. And repeat the constraint near the end of the prompt, since instructions at the boundaries carry more weight than those buried in the middle.

3. Make refusal a good outcome

This is the part teams get wrong, and it is cultural as much as technical.

Models are trained to be helpful, and a refusal feels unhelpful. If your evaluation rewards answering and penalises refusal, you will optimise straight into confident invention.

Score refusals as correct when the content genuinely does not contain the answer. Include questions in your test set that should produce "I don't know", and treat a confident answer to those as a failure.

A bot that says "I don't have that in our documentation — let me put you through to someone who will" is doing its job perfectly.

4. Cite sources

Show where each answer came from — the document, the section, a link.

Two benefits. The user can verify, which converts a potential wrong answer into a checkable one. And in practice, requiring a citation constrains the model: it is harder to invent when the output format demands you name the source.

5. Add deterministic checks

Some things should never be left to the model:

  • Prices and availability — read from the live system, inserted into the response, not generated
  • Order and account details — looked up by ID, never recalled
  • Dates and deadlines — computed, not reasoned about
  • Anything with a number that matters — retrieved and validated

The pattern is to let the model handle language and let code handle facts. A response template with model-generated phrasing and system-supplied values is far safer than asking the model to produce both.

6. Constrain scope

A narrow bot hallucinates less, simply because there is less room to wander.

A bot that handles order status, returns and delivery, and politely declines everything else, is more reliable than one attempting to answer anything about the business. Decline is not a limitation here; it is the mechanism.

7. Build an evaluation set that includes failures

Collect real questions with known correct answers — support tickets are the best source. Then deliberately add:

  • Questions your content cannot answer, where the correct response is a refusal
  • Questions with misleading phrasing that invites a wrong match
  • Questions about things that do not exist — a product you do not sell, a policy you do not have
  • Edge cases with unusual wording

Run the whole set on every change. The second category is the one that catches invention, and it is the one most teams omit, because building it requires deliberately thinking about failure.

8. Watch it in production

Testing has a ceiling. Real users ask things you did not imagine.

  • Log every conversation with the retrieved context, so you can see what the model was working from
  • Flag low-retrieval-confidence answers for review
  • Make it easy to report a wrong answer, and read the reports
  • Sample conversations weekly rather than relying on complaints

The weekly read is the highest-value habit. Patterns show up quickly, and most are fixed by adding content rather than changing the model.

What does not work

Fine-tuning on your documents. The most common misconception. It teaches the model to write in the style of your content without improving factual accuracy, and removes any ability to cite. If you want accurate answers from your material, that is retrieval.

Telling it to be accurate. "Be factual and do not hallucinate" in the prompt achieves close to nothing on its own.

A bigger model. Better models hallucinate somewhat less, and the difference is modest compared to grounding. A well-grounded small model beats a poorly grounded large one.

The realistic target

You will not reach zero. The honest goal is a system where invention is rare, detectable when it happens, and bounded in consequence — because the bot does not make commitments, does not quote prices it generated, and hands over anything it is unsure about.

That is achievable, and it is a very different thing from a chatbot that occasionally promises a refund policy you do not have.

If you have a bot in production and want it audited for this, get in touch.