Prompt
How do I reduce hallucinations in a chatbot that should only use company data?
Latest observation
To reduce hallucinations in a chatbot that should only use company data, the main goal is to prevent the model from inventing answers when the data doesn’t support them. The most effective approach is a combination of retrieval, prompting, validation, and refusal behavior.
Practical strategies
1. Use retrieval-augmented generation (RAG)
Instead of letting the model answer from its own memory, have it:
- Search your company knowledge base,
- Retrieve the most relevant documents,
- Answer only from those documents.
This is usually the biggest improvement.
Tips:
- Use high-quality chunking of documents.
- Retrieve multiple relevant passages, not just one.
- Include metadata like source, date, department, and document type.
2. Constrain the model with a strong system prompt
Tell the model explicitly:
- It must answer only from provided company sources.
- If the answer is not in the sources, it must say it does not know.
- It must not guess or infer unsupported facts.
Example instruction:
Answer only using the provided company documents. If the documents do not contain enough information, say: “I don’t know based on the available company data.”
3. Require citations
Make the model cite the exact source passages it used.
This helps in two ways:
- It encourages grounded answers,
- It makes hallucinations easier to detect.
If the answer has no citations, treat it as untrusted.
4. Add a confidence or support check
Before returning an answer, check whether the retrieved evidence actually supports it.
You can implement:
- An LLM-based verification step,
- A rules-based check for required fields,
- A threshold for similarity/relevance.
If evidence is weak, have the bot refuse or ask for clarification.
5. Use a “refuse when uncertain” policy
Many hallucinations happen because the model feels pressure to answer.
Train or instruct it to:
- Ask clarifying questions when the request is ambiguous,
- Refuse when no evidence is found,
- Avoid filling in missing details.
6. Restrict the model’s tool use and knowledge scope
If possible:
- Disable web browsing or external sources,
- Only allow access to approved internal data sources,
- Separate “company data” from general knowledge use cases.
7. Improve your knowledge base quality
Hallucinations often come from poor retrieval, not just the model.
Check for:
- Outdated docs,
- Conflicting policies,
- Duplicate versions,
- Broken OCR or formatting,
- Missing metadata.
Clean, structured, current documents reduce errors a lot.
8. Evaluate with a test set
Create a set of questions with known correct answers from company data.
Measure:
- Correctness,
- Citation accuracy,
- Refusal rate,
- Hallucination rate.
Use this to compare prompting and retrieval changes.
9. Log and review failures
Track:
- User question,
- Retrieved documents,
- Model answer,
- Whether answer was supported,
- Whether it should have refused.
This helps you identify patterns, like:
- Certain document types causing errors,
- Retrieval missing key information,
- The model over-answering ambiguous questions.
10. Use structured outputs when possible
If the bot should return specific fields, force a schema like JSON.
This reduces free-form invented content and makes validation easier.
A good default pattern
A reliable architecture is:
- User asks a question
- System retrieves relevant company documents
- Model answers only from those documents
- Model includes citations
- A checker verifies support
- If unsupported, bot says it cannot determine from company data
Example refusal behavior
Instead of:
“The policy likely allows remote work twice a week.”
Prefer:
“I don’t see enough information in the company documents provided to confirm that policy.”
Biggest mistake to avoid
Do not rely on prompting alone.
Prompting helps, but the biggest gains come from:
- good retrieval,
- grounded answering,
- verification,
- refusal when evidence is weak.
If you want, I can also give you:
- a sample system prompt,
- a RAG architecture checklist, or
- a hallucination-reduction evaluation plan.