Research Papers 论文研究 6h ago Updated 1h ago 更新于 1小时前 49

Look Before You Leap: Pre-Action Verification for LLM Agents 三思而后行:LLM Agent的预动作验证

Pre-action verification using cheap deterministic checks before LLM agent actions execute can effectively prevent silent failures that produce plausible but incorrect effects A static verifier for shell commands (9,930 commands, 482 tools) catches 95.8% of invalid commands at 10.0% false-positive rate, with syntax/binary checks being oracle-exact Code edit benchmarks reveal a critical format split: content-anchored formats (search/replace, diff) fail cleanly, while location-anchored formats (lin LLM Agent的错误行动常产生"静默失败"——看似合理但实际错误,传统错误检测机制难以发现 提出预行动验证框架,在shell命令和代码编辑两种模态下通过确定性检查捕获无效操作 Shell命令验证器在9930个命令和482个工具上捕获95.8%无效命令,误报率仅10.0% 代码编辑中位置锚定格式(行号/函数名)极易静默失败:行号偏移一行损坏99.1%文件,函数名编辑12.7%命中错误函数 "拒绝不确定"策略将静默失败转化为可恢复问题,锚定验证应用器在8320次试验中仅1次静默误应用(0.01%)

65
Hot 热度
75
Quality 质量
70
Impact 影响力

Analysis 深度分析

TL;DR

  • Pre-action verification using cheap deterministic checks before LLM agent actions execute can effectively prevent silent failures that produce plausible but incorrect effects
  • A static verifier for shell commands (9,930 commands, 482 tools) catches 95.8% of invalid commands at 10.0% false-positive rate, with syntax/binary checks being oracle-exact
  • Code edit benchmarks reveal a critical format split: content-anchored formats (search/replace, diff) fail cleanly, while location-anchored formats (line numbers, function names) fail silently—line numbers corrupt 99.1% of files under a one-line shift
  • A "refuse-when-unsure" policy converts silent failures into recoverable ones, achieving 0.958 recall at 7.0% false positives with selective grounding
  • The authors release both benchmarks, verifiers, and guards as open resources

Why It Matters

This work addresses a critical reliability gap in LLM agents: silent failures that produce incorrect but plausible results without raising errors, which are far more dangerous than loud failures. For AI practitioners building agentic systems, it provides a practical, low-cost oversight mechanism that can be integrated before action execution. The findings also offer concrete guidance on action format selection, showing that content-anchored formats dramatically outperform location-anchored ones for reliability.

Technical Details

  • Shell command verification: A static verifier analyzes commands against tool help-text and binary signatures. Syntax and binary checks are oracle-exact (zero false positives, catching ~50% of errors), while flag checks are bounded by help-text coverage and account for all false positives
  • Code edit benchmark: 640 edits across 224 files isolating the apply step, comparing content-anchored formats (search/replace, diff) against location-anchored formats (line numbers, function names)
  • Anchor-and-verify applier: Records only 1 silent misapplication in 8,320 trials (0.01%), demonstrating near-perfect reliability when verification is applied before execution
  • Refuse-when-unsure policy: A tunable abstention mechanism that trades applicability for safety, with selective grounding reaching 0.958 recall at 7.0% false positives
  • Open release: Both benchmarks, verifiers, and guards are publicly released for community use

Industry Insight

  • Agent frameworks should prioritize content-anchored action formats (search/replace, diffs) over location-anchored ones (line numbers) to minimize silent failure risk in production systems
  • Pre-action verification should become a standard component in agentic pipelines, offering high recall at modest false-positive costs—particularly valuable in high-stakes domains where silent corruption is unacceptable
  • The "refuse-when-unsure" paradigm offers a practical safety valve: rather than attempting potentially incorrect actions, agents can abstain and escalate, enabling recoverable failure modes that preserve system integrity

TL;DR

  • LLM Agent的错误行动常产生"静默失败"——看似合理但实际错误,传统错误检测机制难以发现
  • 提出预行动验证框架,在shell命令和代码编辑两种模态下通过确定性检查捕获无效操作
  • Shell命令验证器在9930个命令和482个工具上捕获95.8%无效命令,误报率仅10.0%
  • 代码编辑中位置锚定格式(行号/函数名)极易静默失败:行号偏移一行损坏99.1%文件,函数名编辑12.7%命中错误函数
  • "拒绝不确定"策略将静默失败转化为可恢复问题,锚定验证应用器在8320次试验中仅1次静默误应用(0.01%)

为什么值得看

本文揭示了LLM Agent执行层面一个被忽视的关键风险——静默失败,为构建更可靠的Agent系统提供了实用的验证框架。研究提出的预行动验证机制以低成本实现了高覆盖率,对Agent工程化落地具有重要参考价值。

技术解析

  • 核心思路:通过"构造性修正"在executor运行前固定行动的正确效果,使验证器可直接测量静默失败,并在不确定时选择拒绝而非猜测
  • Shell命令验证:静态验证器包含语法检查、二进制检查和flag检查三层机制,其中语法和二进制检查为oracle-exact(零误报),flag检查受help-text覆盖度限制
  • 代码编辑基准:640个编辑操作覆盖224个文件,隔离apply步骤进行评测,揭示内容锚定格式(search/replace、diff)与位置锚定格式(行号、函数名)的可靠性差异
  • 选择性接地策略:在召回率0.958和误报率7.0%之间取得平衡,锚定验证应用器实现0.01%静默误应用率
  • 开源贡献:发布两个基准数据集、验证器和防护机制代码

行业启示

  • Agent系统安全设计应从"事后纠错"转向"事前预防",预行动验证是性价比极高的可靠性保障手段
  • 推动Agent输出格式标准化,优先采用内容锚定而非位置锚定的编辑格式,可显著降低静默失败风险
  • 建立"拒绝-重试"机制而非强行执行不确定操作,是Agent工程化落地的关键实践路径

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

LLM 大模型 Agent Agent Research 科学研究 Security 安全 Evaluation 评测