🤖 AI Summary
This work addresses the problem of external memory contamination in large language model (LLM) agents caused by the injection of hallucinated facts during multi-turn interactions. To mitigate this issue, the authors propose a write-time admission control mechanism that evaluates candidate facts before committing them to memory. Specifically, the method computes a soft self-consistency support score by querying the model multiple times and permits writing only if the average score exceeds a predefined threshold. This approach introduces, for the first time, a fine-tuning-free, model-agnostic self-consistency verification at the memory write stage, and further offers a log-probability variant suitable for low-latency deployment. Evaluated across four mainstream LLMs and three newly constructed benchmarks featuring controllable contamination and synthetic dialogues, the method significantly reduces memory pollution rates, particularly excelling at filtering out unreliable facts merely implied—rather than explicitly stated—in the source context.
📝 Abstract
LLM agents that operate over many turns accumulate facts in an external memory store and reuse them as premises for downstream reasoning. A hallucinated fact written at one step therefore persists as a false premise for every subsequent step, a failure mode we call memory contamination. Existing memory management addresses retrieval and capacity but not write-time correctness; this admission problem cannot be solved by utility- or recency-based criteria, and uncontrolled contamination compounds across long trajectories. We propose ConsistencyGate, a write-time admission gate that, before committing a candidate fact m extracted from context c, queries the LLM K times for a soft support score and admits m only when the average exceeds a threshold. The mechanism is model-agnostic, requires no fine-tuning, and reduces to a single forward pass in a log-probability variant for latency-sensitive deployments. To measure the effect on natural data, we construct two real-conversation benchmarks (LoCoMo-Contam and MSC-Contam) by planting controlled single-detail corruptions in long-term conversations from LoCoMo and MSC, and complement them with a structured synthetic corpus (MemContam) that isolates a near-oracle upper bound. Across four LLM backbones, ConsistencyGate reduces contamination on every benchmark relative to a write-everything baseline, with the cost concentrated on facts that are stated only implicitly in the source context. We release all three benchmarks together with the gate implementation.