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

面向真实世界软件的智能体式验证优化

Agentic Verified Optimization of Real-World Software

University of California, Berkeley(加州大学伯克利分校);Amazon Web Services(亚马逊云科技)

Zhe Ye, Udaya Ghai, Zhizhen Qin, Dawn Song, Soonho Kong

AI总结:

该研究提出智能体式验证优化方法,开发 Aqueduct 框架迁移多语言程序至 Lean 4,在 Verina 参考实现及真实应用上验证了该方法可生成更快的已验证程序,为软件优化提供了新路径。

摘要:

程序优化旨在提升性能同时保持行为一致性。编码智能体已能通过修改算法、数据结构和执行策略让程序运行更快,但现有等价性检查大多依赖测试,而研究表明智能体可利用测试漏洞,在不保留预期行为的情况下通过测试。我们提出智能体式验证优化,即智能体生成更快实现的同时,附带机器验证的与原有实现等价的证明。由于原有实现可作为规范,该任务避免了验证代码生成的规范编写瓶颈,且定理证明的近期进展使这类证明成为可能。我们在 Lean 4 中定义了函数级和仓库级的任务,Lean 4 中程序既可执行也可推理。由于极少真实应用用 Lean 编写,我们开发了 Aqueduct,这是一个智能体框架,可将 C、C++、Go 和 Rust 程序迁移为原生 Lean 代码,并通过与原程序的差异测试验证每次迁移。在 Verina 的 189 个参考实现中,智能体为 156 个生成了更快的已验证重写,包括将指数递归替换为动态规划等算法变更。在 17 个迁移应用中,其 92 个已验证重写使 51 个应用场景中的 47 个实现了加速。这些应用级增益小于函数级增益,因此选择待优化函数是一个重要问题。当前智能体已能对独立函数和从真实程序迁移的应用执行验证优化,我们讨论了剩余挑战及向生产环境验证优化迈进的步骤。

英文摘要:

Program optimization aims to improve performance while preserving behavior. Coding agents can already make programs faster by changing algorithms, data structures, and execution strategies. However, existing equivalence checks mostly rely on tests, which agents have been shown to exploit, passing the tests without preserving the intended behavior. We propose agentic verified optimization, in which an agent produces a faster implementation together with a machine-checked proof of equivalence to the existing one. Because the existing implementation serves as the specification, the task avoids the specification-writing bottleneck of verified code generation, and recent advances in theorem proving make the proofs attainable. We formulate the task at the function and repository levels in Lean 4, where programs can be both executed and reasoned about. Few real-world applications are written in Lean, so we develop Aqueduct, an agentic framework that migrates C, C++, Go, and Rust programs into native Lean, validates each port by differential testing against its original. On the 189 reference implementations in Verina, agents produce faster proved rewrites for 156, including algorithmic changes such as replacing exponential recursion with dynamic programming. On 17 migrated applications, their 92 proved rewrites speed up 47 of 51 application scenarios. These application-level gains are smaller than the function-level ones, making the choice of functions to optimize an important problem. Current agents can thus already carry out verified optimization on both standalone functions and applications migrated from real programs. We discuss the remaining challenges and the steps toward verified optimization in production.

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

↑