Vấn Đề Nguy Hiểm Nhất
Trong agentic systems, hallucination không chỉ là output sai - nó có thể trigger cascade failures.
Types of Agentic Hallucinations
1. Tool Hallucination
Agent bịa ra tool không tồn tại. Fix: Strict tool validation với whitelist.
2. Parameter Hallucination
Tool đúng, nhưng params sai (typo trong column name, etc.) Fix: Schema validation với Pydantic.
3. Result Hallucination
Agent nhớ nhầm observation. Fix: Force agent to quote observations exactly.
The Hallucination Detection Loop
Implement HallucinationGuard class check xem response có được grounded trong context không.
Production Mitigation Strategies
| Strategy | Implementation | Overhead |
|---|---|---|
| Tool Whitelisting | Strict enum validation | Low |
| Output JSON Mode | response_format type json | Low |
| Citation Requirement | Force quotes in prompt | Low |
| LLM-as-Judge | Second LLM validates | High |
| Human-in-the-loop | Approve risky actions | Very High |
⚠️ Hallucination trong agents nguy hiểm hơn trong chat vì chúng có thể trigger real actions với real consequences.
