为大模型智能体记忆设计主动防御系统,防恶意记忆干扰
A-MemGuard: A Proactive Defense Framework for LLM-Based Agent Memory
- 通过多记忆比对发现异常推理路径
- 用双记忆结构存储教训,切断错误循环
- 无需改架构,可随经验提升防御能力
大型语言模型(LLM)智能体依赖记忆实现自主规划与决策,但内存易被攻击者注入看似无害的记录,从而在特定上下文中触发恶意行为。此类攻击具有双重特性:其影响仅在特定情境下激活,孤立审计难以发现;一旦触发,错误结果会作为新记忆留存,形成自我强化的错误循环,且逐步降低未来攻击门槛。为此,我们提出A-MemGuard——首个针对LLM智能体记忆的主动防御框架。核心思想是让记忆具备自检与自纠能力。A-MemGuard不修改智能体核心架构,结合两项机制:(1) 基于共识的验证,通过比较多个相关记忆推导出的推理路径识别异常;(2) 双记忆结构,将检测到的失败转化为独立存储的“教训”,在后续决策前调用,打破错误循环并实现适应性防御。多基准测试表明,该框架可使攻击成功率降低95%以上,同时带来极小的性能损耗。本工作将记忆安全从静态过滤转向主动、经验驱动的防御模式,防御能力随时间增强。代码已开源。
原文摘要 · Abstract (English)
Large Language Model (LLM) agents use memory to learn from past interactions, enabling autonomous planning and decision-making in complex environments. However, this reliance on memory introduces a critical security risk: an adversary can inject seemingly harmless records into an agent's memory to manipulate its future behavior. This vulnerability is characterized by two core aspects: First, the malicious effect of injected records is only activated within a specific context, making them hard to detect when individual memory entries are audited in isolation. Second, once triggered, the manipulation can initiate a self-reinforcing error cycle: the corrupted outcome is stored as precedent, which not only amplifies the initial error but also progressively lowers the threshold for similar attacks in the future. To address these challenges, we introduce A-MemGuard (Agent-Memory Guard), the first proactive defense framework for LLM agent memory. The core idea of our work is the insight that memory itself must become both self-checking and self-correcting. Without modifying the agent's core architecture, A-MemGuard combines two mechanisms: (1) consensus-based validation, which detects anomalies by comparing reasoning paths derived from multiple related memories and (2) a dual-memory structure, where detected failures are distilled into ``lessons'' stored separately and consulted before future actions, breaking error cycles and enabling adaptation. Comprehensive evaluations on multiple benchmarks show that A-MemGuard effectively cuts attack success rates by over 95% while incurring a minimal utility cost. This work shifts LLM memory security from static filtering to a proactive, experience-driven model where defenses strengthen over time. Our code is available in https://github.com/TangciuYueng/AMemGuard
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。