What is LLM hallucination? When you build a customer service chatbot, how do you reduce it?
Suggested answer
Hallucination is when a language model produces information that sounds plausible but is wrong, or isn't in the data it was given. For example, a customer asks "has order 1041 been delivered?", the request sent to the model contains no order data at all, and the model still answers "yes, your order has been delivered!".
The key point to get across is that the model only knows what is in the request plus the general knowledge it learned in training. It doesn't connect to your database by itself. So for data that keeps changing, such as an order's status, writing a better prompt is not the fix.
Ways to reduce it, from easiest to most reliable:
- Put the information it needs into the prompt (opening hours, prices) and tell it to "only use this information".
- Allow the model to say "I don't know", along with a concrete replacement answer. Anthropic's documentation lists this as the first basic technique.
- For dynamic data, let your code look up the real data and hand the result to the model, using tool calling or RAG.
- Add a code check for risky answers, with tests for that check.
Bonus points: say clearly that these techniques reduce hallucinations rather than eliminate them, so high-risk actions (money, promises to customers) still need a person to approve them.