arXiv:2605.05704cs.CRcs.AI2026-05中稿 · ICML被引 1

通过动态记忆机制精准划分大模型代理的安全边界

SafeHarbor: Defining Precise Decision Boundaries via Hierarchical Memory-Augmented Guardrail for LLM Agent Safety

论文配图:SafeHarbor: Defining Precise Decision Boundaries via Hierarchical Memory-Augmented Guardrail for LLM Agent Safety
图 1 · 摘自论文原文
  • 用分层记忆系统动态注入上下文感知的防御规则
  • 在GPT-4o上实现63.6%良性任务成功率,有害请求拒绝率超93%
  • 无需训练,可插即用,适合需高安全性的自主代理场景

大模型代理已从被动对话系统演变为具备推理与工具执行能力的自主实体,但这也带来了安全风险,攻击者可能诱使其执行有害行为。现有防御策略常在安全与实用性间难以平衡,导致过度拒绝合法请求。为此,我们提出SafeHarbor框架,通过增强型对抗生成提取上下文感知的防御规则,构建局部分层记忆系统实现动态规则注入,提供免训练、高效且可即插即用的解决方案。进一步设计基于信息熵的自进化机制,通过动态节点分裂与合并持续优化记忆结构。大量实验表明,SafeHarbor在模糊良性任务和明确恶意攻击下均达最优表现,尤其在GPT-4o上实现63.6%的峰值良性利用率,同时对有害请求拒绝率超过93%。源代码公开于https://github.com/ljj-cyber/SafeHarbor。

原文摘要 · Abstract (English)

Recent advances in foundation models have transformed LLMs from passive conversational systems into autonomous agents capable of reasoning and tool execution. While these capabilities unlock substantial practical value, they also introduce new security risks, as adversaries can manipulate agents into performing harmful actions in real-world environments. Existing defense strategies mitigate such threats but frequently struggle to balance safety and utility, resulting in over-refusal of benign user requests. To mitigate this trade-off, we propose SafeHarbor, a novel framework designed to establish precise decision boundaries for LLM agents. Unlike static guidelines, SafeHarbor extracts context-aware defense rules through enhanced adversarial generation. We design a local hierarchical memory system for dynamic rule injection, offering a training-free, efficient, and plug-and-play solution. Furthermore, we introduce an information entropy-based self-evolution mechanism that continuously optimizes the memory structure through dynamic node splitting and merging. Extensive experiments demonstrate that SafeHarbor achieves state-of-the-art performance on both ambiguous benign tasks and explicit malicious attacks, notably attaining a peak benign utility of 63.6\% on GPT-4o while maintaining a robust refusal rate exceeding 93\% against harmful requests. The source code is publicly available at https://github.com/ljj-cyber/SafeHarbor.

大模型安全代理防御动态记忆决策边界

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。