Contemporary large language model (LLM) agents are remarkably capable, but they still lack reliable safety controls and can produce unconstrained, unpredictable, and even actively harmful outputs. To address this, we introduce Reflection-Driven Control, a standardized and pluggable control module that can be seamlessly integrated into general agent architectures. Reflection-Driven Control elevates "self-reflection" from a post hoc patch into an explicit step in the agent's own reasoning process: during generation, the agent continuously runs an internal reflection loop that monitors and evaluates its own decision path. When potential risks are detected, the system retrieves relevant repair examples and secure coding guidelines from an evolving reflective memory, injecting these evidence-based constraints directly into subsequent reasoning steps. We instantiate Reflection-Driven Control in the setting of secure code generation and systematically evaluate it across eight classes of security-critical programming tasks. Empirical results show that Reflection-Driven Control substantially improves the security and policy compliance of generated code while largely preserving functional correctness, with minimal runtime and token overhead. Taken together, these findings indicate that Reflection-Driven Control is a practical path toward trustworthy AI coding agents: it enables designs that are simultaneously autonomous, safer by construction, and auditable.


翻译:当代大型语言模型(LLM)智能体已展现出卓越的能力,但仍缺乏可靠的安全控制机制,可能产生不受约束、不可预测甚至具有主动危害性的输出。为解决这一问题,我们提出反思驱动控制——一种标准化、可插拔的控制模块,能够无缝集成至通用智能体架构中。该框架将“自我反思”从一种事后修补机制提升为智能体推理过程中的显式步骤:在生成过程中,智能体持续运行内部反思循环,实时监控并评估自身的决策路径。当检测到潜在风险时,系统从动态演化的反思记忆中检索相关修复案例与安全编码规范,将这些基于证据的约束直接注入后续推理步骤。我们将反思驱动控制具体应用于安全代码生成场景,并针对八类安全关键编程任务进行系统评估。实验结果表明,反思驱动控制显著提升了生成代码的安全性与策略符合性,同时基本保持功能正确性,且运行时开销与令牌开销极低。综合而言,这些发现表明反思驱动控制是实现可信AI编码智能体的可行路径:它支持构建兼具自主性、内置安全性与可审计性的系统设计。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
VIP会员
相关基金
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
Top
微信扫码咨询专知VIP会员