Accept Changes, Reject Attacks: Robust Memory Management for LLM Agents

Runze Zhao, Dongruo Zhou, Sumit Kumar Jha, Nathaniel D. Bastian, Ankit ShaharXiv 2026

TL;DR

LLM agents with long-term memory face a fundamental conflict: they must be open enough to update memory when facts change, yet defensive enough to reject malicious "poisoning" attacks. This paper introduces Evidence-Conditioned Accuracy (ECA), a metric that ensures agents use the right information for the right reasons, and a "one-shot" training recipe that significantly improves memory robustness across multiple model backbones.

What Problem Does This Paper Address?

As LLM agents move from simple chatbots to persistent personal assistants, they rely on long-term memory to store user preferences and past interactions. However, this memory is a double-edged sword.

The authors identify two primary failure modes that require diametrically opposed solutions:

  1. Outdated Memory: A user moves to a new city, but the agent keeps using the old address. To fix this, the agent must write new information to memory.
  2. Memory Poisoning: An attacker (e.g., via a malicious web page the agent reads) tries to inject harmful instructions or false facts. To prevent this, the agent must refuse to write the information.

Current memory systems usually focus on one problem at a time. A system that is "eager to learn" will update facts correctly but fall victim to every poisoning attack. Conversely, a highly defensive system might block attacks but fail to notice when a user’s legitimate information has changed. This paper seeks a "robust" middle ground.

Figure 1: Two cases a memory manager must handle: (a) outdated memory and (b) memory poisoning. Each panel shows an incorrect (red) and a correct (green) write, with the memory each write leaves (yellow).

Methods

The researchers propose a two-part solution: a better way to measure success and a better way to train models.

1. Evidence-Conditioned Accuracy (ECA)

Standard accuracy only checks if the agent gave the right answer. But an agent might get the right answer by luck or by relying on its internal pre-trained knowledge while its memory is actually a mess. ECA is a stricter metric: it only counts an answer as "correct" if the agent also retrieved the specific, updated, and attack-free memory records needed to justify that answer.

2. One-Shot Data Synthesis & SFT

Training a robust memory manager typically requires massive amounts of diverse data. The authors found a shortcut: One-Shot Synthesis.

  • They take a single base conversation and programmatically insert hundreds of "variants."
  • These variants include legitimate fact changes (e.g., "I quit my job"), "poisoned" turns with hidden instructions, and standard turns.
  • They then use Supervised Fine-Tuning (SFT) to train the memory manager to output specific actions (ADD, UPDATE, DELETE, or NOOP) in a structured JSON format.
Figure 2: One step t of the agent (Equations 1 and 2). Boxes are components; edge labels are the data passed between them. Only πθ (orange) is trained.

Datasets

The authors evaluated their approach using a mix of existing benchmarks and newly synthesized test sets:

  • LoCoMo: Used for standard conversational memory.
  • STALE: Used for testing updates to outdated facts.
  • PoisonedRAG & AgentPoison: Used to test resistance to malicious injections.
  • Generalization Benchmarks: The model was also tested on unseen datasets like LongMemEval, PerLTQA, BEAM-KU, and MAB-FC to ensure it learned general principles rather than just memorizing the training conversation.

Key Insights and Ideas

  • The "Write Rule" Paradox: There is no "fixed" rule (like "always write new facts") that can handle both updates and attacks. The memory manager must be an intelligent gatekeeper that evaluates every input's context.
  • Logic Over Diversity: You don't need a million different conversations to teach an LLM how to manage memory. Teaching it the logic of "if X changes, update Y; if Z looks like an attack, ignore it" can be done effectively using a single, highly-augmented conversation.
  • Retrieved Records Matter: By training the model to also predict the "role" of retrieved records (e.g., labeling a record as "outdated" or "evidence"), the authors improved the model's internal reasoning about its own memory.
Figure 3: Construction of the training data in four stages (Section 3.2). Green, red and blue mark inserted turns of the outdated, poisoning and standard categories, purple the LLM, orange the resulting data.

Key Results

The SFT-trained manager outperformed all existing baselines (like Mem0 and A-MemGuard) by being the only method to improve performance across all three categories (Standard, Outdated, and Poisoning).

  • Overall Performance: On the Qwen3-4B backbone, SFT more than doubled the overall ECA compared to the untuned model.
  • Robustness: While baselines often crashed in one category to gain in another (e.g., A-MemGuard improved poisoning resistance but hurt standard memory accuracy), the SFT approach raised the floor across the board.
  • Generalization: The model successfully applied its "memory logic" to eight different benchmarks, five of which were entirely unseen during training. For example, on the BEAM-KU benchmark, ECA rose from 6.2% to 35.0%.

Limitations and Future Work

  • Incomplete Robustness: While the SFT manager is much better, it’s not perfect. It still falls for some sophisticated attacks, and its Attack Success Rate (ASR), while lower, is still significant.
  • Scope: The study focused on conversational agents. The authors note that web-browsing agents or embodied robots might face different memory challenges that weren't covered here.
  • Future Directions: The authors suggest exploring Reinforcement Learning (RL) to further refine memory decisions and testing against even more aggressive, adaptive attackers.

Summary updated

BibTeX
@misc{zhao2026accept,
  author = {Runze Zhao and Dongruo Zhou and Sumit Kumar Jha and Nathaniel D. Bastian and Ankit Shah},
  title = {{Accept Changes, Reject Attacks: Robust Memory Management for LLM Agents}},
  year = {2026},
  eprint = {2610.41056},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.41056},
}
Figure