AgentSpec:面向安全可靠大语言模型智能体的可定制运行时约束实施框架
AgentSpec: Customizable Runtime Enforcement for Safe and Reliable LLM Agents
AI总结:
针对大语言模型智能体的安全风险,研究提出轻量级领域特定语言AgentSpec,支持自定义运行时安全规则,在多领域验证了高防护效果与低开销,还实现了基于LLM的规则自动生成。
摘要:
基于大语言模型(LLM)构建的智能体正被越来越多地部署在各个领域,用于自动化执行复杂决策和任务。然而,其自主性带来了安全风险,包括安全漏洞、违法违规行为以及意外的有害操作。现有的缓解方法,如基于模型的安全防护机制和早期约束实施策略,在鲁棒性、可解释性和适应性方面均存在不足。为应对这些挑战,我们提出了AgentSpec——一种用于指定和实施LLM智能体运行时约束的轻量级领域特定语言。借助AgentSpec,用户可定义包含触发器、谓词和约束实施机制的结构化规则,确保智能体在预设的安全边界内运行。我们在代码执行、具身智能体、自动驾驶等多个领域实现了AgentSpec,验证了其适应性和有效性。评估结果显示,AgentSpec在超过90%的代码智能体场景中成功阻止了不安全执行,在具身智能体任务中消除了所有危险操作,在自动驾驶车辆(AVs)场景中实现了100%的合规率。尽管具备强大的安全保障能力,AgentSpec的计算开销仍保持在毫秒级,十分轻量。通过兼具可解释性、模块化和高效性,AgentSpec为在各类应用中实施LLM智能体安全约束提供了实用且可扩展的解决方案。我们还利用LLM实现了规则的自动化生成并评估了其效果。评估表明,OpenAI o1生成的规则在具身智能体场景下达到了95.56%的精确率和70.96%的召回率,成功识别出87.26%的风险代码,并在8个自动驾驶场景中有5个成功阻止了车辆违法。
英文摘要:
Agents built on LLMs are increasingly deployed across diverse domains, automating complex decision-making and task execution. However, their autonomy introduces safety risks, including security vulnerabilities, legal violations, and unintended harmful actions. Existing mitigation methods, such as model-based safeguards and early enforcement strategies, fall short in robustness, interpretability, and adaptability. To address these challenges, we propose AgentSpec, a lightweight domain-specific language for specifying and enforcing runtime constraints on LLM agents. With AgentSpec, users define structured rules that incorporate triggers, predicates, and enforcement mechanisms, ensuring agents operate within predefined safety boundaries. We implement AgentSpec across multiple domains, including code execution, embodied agents, and autonomous driving, demonstrating its adaptability and effectiveness. Our evaluation shows that AgentSpec successfully prevents unsafe executions in over 90% of code agent cases, eliminates all hazardous actions in embodied agent tasks, and enforces 100% compliance by autonomous vehicles (AVs). Despite its strong safety guarantees, AgentSpec remains computationally lightweight, with overheads in milliseconds. By combining interpretability, modularity, and efficiency, AgentSpec provides a practical and scalable solution for enforcing LLM agent safety across diverse applications. We also automate the generation of rules using LLMs and assess their effectiveness. Our evaluation shows that the rules generated by OpenAI o1 achieve a precision of 95.56% and recall of 70.96% for embodied agents, successfully identify 87.26% of the risky code, and prevent AVs from breaking laws in 5 out of 8 scenarios.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。