Agentic Verified Optimization of Real-World Software
Abstract
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.
Create a lesson
Metadata
- Categories
- cs.SE, cs.AI, cs.LG, cs.LO, cs.PL
Related papers
DVBench: End-to-End Benchmark for Real-World UVM Design Verification Agents
Shared title terminologycs.SEJiaru Qian, Jiawei Li, Xiaolong Hu et al.
WEAVE: Weaving Real-World Code Evolution into Dependency-Structured Tasks for Benchmarking and Training Code Agents
Shared title terminologycs.SEWeihao Li, Zihang Xu, Zhongqiu Wang et al.
How Developers Configure LLM Inference: A Large-Scale Study of Real-World Practices
Shared title terminologycs.SENada Zine, Matias Martinez, Romain Rouvoy et al.
Who Verifies the Builder? Toward Independent Assurance for Agent-Produced Software
Shared title terminologycs.SESion Israel Sion, Alain April
What Should a Software Team Spend on Agents? Simulation-Based Cost Optimization of Mixed AI-Human Teams
Shared title terminologycs.SESteffen Herbold
SatMend: LLM Agents for Automated Software Repair in Satellite Constellations with Intermittent Ground Contact
Shared title terminologycs.SEPengcheng Luo, Zenghui Zhang, Genke Yang et al.