TruthLens: Real-Time Hallucination Mitigation
Status: Proposal · Created: 2025-12-02
Problem
A model can produce fluent text that is unsupported by the context supplied with the request. Application-specific checks can catch some failures, but implementing them in every client duplicates policy and makes behavior difficult to audit.
The router is a useful policy boundary because it can see the request, retrieved context, selected model, and response. It is not, however, a source of truth. A detector can estimate groundedness; it cannot prove that an open-domain statement is factually correct.
Proposal
TruthLens separates detection from response policy:
The detector should identify spans or claims as supported, unsupported, or contradicted when evidence is available. The policy then decides whether to annotate, retry, refine, block, or escalate.
Operating modes
The proposal groups policies into three operator-facing modes:
| Mode | Behavior | Main trade-off |
|---|---|---|
| Lightweight | Run one detector pass and expose the result or apply a simple action. | Lowest additional work, no automatic correction guarantee. |
| Standard | Ask a model to revise flagged claims, then run a bounded verification pass. | Additional latency and tokens; may repeat the same model's bias. |
| Cross-verification | Compare responses from independently selected models before synthesis or escalation. | Highest resource use and more complex failure handling. |
These are policy shapes, not benchmark tiers. A deployment should select actions from measured detector behavior and the consequence of false positives and false negatives.
Evidence contract
Each detection result should include:
- the response span or claim being evaluated;
- the relevant context span, when one exists;
- a detector score and configured threshold;
- a classification such as supported, unsupported, or contradicted;
- the detector version; and
- the action taken by policy.
The router should preserve this evidence in bounded diagnostics or replay metadata without exposing sensitive context in default response headers.
Policy boundaries
- Detection alone must not silently block traffic.
- A route chooses its action explicitly.
- Refinement and cross-verification use bounded attempts and model allowlists.
- Streaming responses require a declared policy because a response cannot be safely replaced after bytes have been committed.
- Detector failure follows an explicit skip, annotate, or block policy.
- Retrieved context and tool output remain untrusted input and must not be promoted to a system instruction.