NeFut Logo NeFut
Admin Login

[CS.AI] ConsistencyGate: Preventing Memory Contamination in LLM Agents

Published at: 2026-07-29 22:00 Last updated: 2026-07-30 03:24
#AI #Machine Learning #Open Source

Abstract

LLM agents operate over many turns, accumulating facts in an external memory store and reusing them as premises for downstream reasoning. A hallucinated fact written at one step persists as a false premise for every subsequent step, leading to a failure mode we refer to as memory contamination. Existing memory management primarily addresses retrieval and capacity but fails to ensure 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 queries the LLM K times for a soft support score before committing a candidate fact m extracted from context c, admitting m only when the average exceeds a threshold. This 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, complemented by 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 only stated implicitly in the source context. We release all three benchmarks along with the gate implementation.

Blogger's Review: The introduction of ConsistencyGate presents an innovative solution for memory management in LLMs, effectively mitigating the risks of memory contamination through a write-time admission mechanism. This approach enhances the reasoning accuracy of models and can adapt to various architectures without requiring fine-tuning, showcasing its broad application potential.

Original Source: https://arxiv.org/abs/2607.22962

[h] Back to Home