arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2512.20660cs.LGcs.AIcs.SE
收藏

双状态架构用于可靠的LLM代理

The Dual-State Architecture for Reliable LLM Agents

Independent Researcher(独立研究者)

Matthew Thompson

AI总结:

本文提出双状态动作对DSAP,通过结合随机生成与确定性后置条件验证,提升LLM代理在软件工程中的可靠性,实验表明在1.2-2.1倍基准成本下可靠性提升达66个百分点。

摘要:

部署为代码生成代理的大型语言模型表现出随机行为,与软件工程所需的确定性保证不兼容。我们正式化了双状态动作对(DSAP),一种执行原语,将随机生成与确定性后置条件验证相结合。守护函数作为传感动作,将不透明的LLM输出投影到可观察的工作流状态,实现双状态分解:有限的、确定性的S_workflow与无限的、随机的S_env。我们证明,对于能够处理epsilon的生成器,失败概率P(fail) <= (1-epsilon)^R_max -> 0。为防止多步骤工作流中朴素的O(R^K)重试爆炸,我们引入三级恢复层次:上下文细化(在步骤内重试)、有意识回溯(停滞检测与级联无效化和上下文注入到上游步骤)以及人工升级。在13个LLM(1.3B-15B参数)上三个诊断探针的实验验证中,可靠性提升达66个百分点,基准成本为1.2-2.1倍。对99个SWE-Bench Pro实例-臂对(Qwen3-Coder-Next)的恢复机制评估显示,100%的上下文注入有效性(所有71个升级事件中上游输出均发生变化),具有步骤特定的恢复不对称性——测试生成37.5% vs. 修补生成0%——以及0%的端到端修补生产,确立了执行架构与计划合成之间的边界:执行恢复是必要的但不足以实现自主软件工程。

英文摘要:

Large Language Models deployed as code generation agents exhibit stochastic behavior incompatible with the deterministic guarantees required by software engineering. We formalize the Dual-State Action Pair (DSAP), an execution primitive that couples stochastic generation with deterministic post-condition verification. Guard functions act as sensing actions that project opaque LLM outputs onto observable workflow state, enabling a dual-state decomposition: finite, deterministic S_workflow paired with infinite, stochastic S_env. We prove that for epsilon-capable generators, failure probability P(fail) <= (1-epsilon)^R_max -> 0. To prevent naive O(R^K) retry explosion across multi-step workflows, we introduce a three-level recovery hierarchy: context refinement (retry within step), informed backtracking (stagnation detection with cascade invalidation and context injection to upstream steps), and human escalation. Experimental validation across 13 LLMs (1.3B-15B parameters) on three diagnostic probes demonstrates reliability gains of up to 66 percentage points at 1.2-2.1x baseline cost. Recovery mechanism evaluation on 99 SWE-Bench Pro instance-arm pairs (Qwen3-Coder-Next) demonstrates 100% context injection effectiveness (upstream output changed in all 71 escalation events) with step-specific recovery asymmetry -- 37.5% for test generation vs. 0% for patch generation -- and 0% end-to-end patch production, establishing the boundary between execution architecture and plan synthesis: execution recovery is necessary but not sufficient for autonomous software engineering.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑