The Hallucination Gauge: Quantifying Drift Risk in Agent Sessions
Explores how drift risk can be measured continuously during agent execution rather than detected after the fact.
Introduction
Hallucination detection in current AI systems is predominantly a post-hoc activity. Output is generated, then evaluated for correctness. For short-lived interactions, this is workable. For long-running agentic systems, it is insufficient. By the time a hallucination is detected in output, the session may have already built subsequent decisions on fabricated foundations.
The Hallucination Gauge research direction proposes continuous runtime measurement of drift risk. The current implementation is narrower: deterministic read-only Gauge v0 scores available loaded workflow signals and recommends review actions without mutating state.
What Is Drift?
Drift, in the context of InvariantEngine, is the estimated distance between an agent session’s working state and the project’s approved, governed state. Drift accumulates through several mechanisms:
- Retrieval approximation: Memory retrieval returns related but not exact results, introducing subtle inaccuracies.
- Context window pressure: As the context window fills, earlier information is compressed or dropped.
- Session boundaries: When sessions restart, context must be reconstructed, and reconstruction is lossy.
- Unverified assumptions: The agent makes inferences that are not checked against durable memory.
Measuring Drift
The target Hallucination Gauge would evaluate multiple drift signals after each agent action:
- Memory alignment: Does the action’s content align with durable memory?
- Source grounding: Can the action’s claims be traced to approved evidence?
- Invariant compliance: Does the action violate any project constraints?
- Negative memory: Does the action reintroduce a rejected idea? Negative Memory is not implemented today.
- Internal consistency: Is the action consistent with earlier actions in the same session?
Each signal produces a component score. These are weighted and combined into a composite drift-risk score normalized between 0.0 (low estimated risk) and 1.0 (high estimated risk). This score is an operational signal, not a probability of hallucination or a truth certification.
Thresholds and Actions
The score maps to configurable thresholds:
- 0.0–0.2: Low risk. Session proceeds normally.
- 0.2–0.4: Moderate risk. Warnings are logged.
- 0.4–0.6: Elevated risk. Targeted repair or re-grounding may be triggered.
- 0.6–0.8: High risk. Session is escalated to human review.
- 0.8–1.0: Critical risk. Session is abandoned.
These thresholds are defaults. They should be tuned for specific project types and risk tolerances.
Continuous vs. Post-Hoc
The target design’s key distinction is timing: it would evaluate drift risk continuously and inform intervention before drift compounds. Gauge v0 is an on-demand deterministic review signal, not continuous agent-action monitoring or automatic intervention.
Conclusion
The Hallucination Gauge is not a hallucination detector. Implemented Gauge v0 is a deterministic operational risk score over available evidence, not a truth score. The broader continuous scoring and intervention model remains specified as future architecture in IE-002.