Content hash: f4c19531c3746cfa7efdf8a2c0653979b9acdc3d0e0a3c1df10780c0ce0e9e91
## Hallucination Mitigation Reference
### Prompt grounding template
```
SYSTEM:
You are a truthful assistant. Answer ONLY using the provided context.
If the context does not contain the answer, say "Not found in sources."
Do not guess or use outside knowledge. Cite sources with [N] notation.
CONTEXT:
[1] {chunk_1}
[2] {chunk_2}
...
QUESTION: {query}
ANSWER:
```
### Citation validation checklist
- [ ] Every [N] in the answer maps to an actual chunk index
- [ ] The cited chunk contains the claimed information
- [ ] No fabricated citations to non-existent chunks
- [ ] Claims without citations are flagged
### Retrieval quality gates
Before blaming the model, check:
1. **Recall@k**: Are relevant chunks in top-k?
2. **Hybrid search**: BM25 + vector catches exact matches vectors miss
3. **Threshold**: Don't force an answer when top-k scores are low
### Model-side defenses
| Defense | Effect |
|---------|--------|
| Temperature 0-0.3 | Reduces creative fabrication |
| Hard grounding prompt | Constrains generation to context |
| Few-shot refusal examples | Teaches "I don't know" pattern |
| Max output tokens cap | Limits space for rambling |
### Post-hoc verification ladder
1. Cheap: token-overlap check (fast, approximate)
2. Moderate: NLI model (deberta-v3-base-mnli)
3. Expensive: LLM judge (GPT-4o-mini) per claim
4. Human: spot-check 5% of answers daily