A hallucination is when a language model produces information that sounds right but is wrong or made up. In a chat with a consumer it is an annoyance. In a credit memo or a customer reply it is a real risk.
Why it happens
Language models generate the most likely next words based on patterns. They do not check facts unless the system is designed to make them do so. When they lack the right information, they may fill the gap.
How to contain it
- Ground answers in sources. Use retrieval so the model answers from approved documents, and require citations.
- Allow "I don't know". Instruct and test the system to say when the sources do not contain an answer.
- Narrow the task. A model asked to extract five fields from a document is far more reliable than one asked an open question.
- Use structured outputs. Ask for specific fields and formats that can be checked automatically.
- Check against systems of record. Verify numbers, names and dates against the source systems before use.
- Keep a person in the loop for consequential outputs.
Measure it
Include questions in your evaluation set where the correct answer is "not in the sources". Track how often the system answers anyway. Review a sample of live outputs regularly, focusing on cases where people corrected the AI.
Design the workflow around it
Assume the AI will sometimes be wrong. Design so that errors are caught before they cause harm: show sources next to answers, highlight low-confidence outputs, and make it easy for reviewers to correct and report mistakes.
The takeaway
Hallucinations are a design problem as much as a model problem. Grounding, narrow tasks, checks and human review together keep the risk within acceptable limits.