Introduction
Formal verification represents the "gold standard" of software reliability, providing mathematical proof that code adheres to its specifications. However, the process is notoriously difficult, requiring specialized expertise to write "ghost code"—the proof annotations that verifiers need to function. While Large Language Models (LLMs) have revolutionized general code generation, they often struggle with the rigorous, pedantic logic required for formal proofs. AutoVerus is a novel research framework designed to bridge this gap by using a multi-agent LLM system to automatically generate proofs for Rust code within the Verus verification ecosystem.
The Challenge of Formal Verification in Rust
The authors target Verus, a state-of-the-art verifier for Rust that allows developers to write proofs and specifications directly in Rust syntax. Despite this familiar syntax, writing proofs remains challenging. Developers must provide "hints" to the underlying SMT solver, such as loop invariants and assertions, to guide complex reasoning.
For AI models, the challenge is twofold:
- Data Scarcity: Unlike general-purpose languages, there is very little "Verus proof code" available for LLMs to learn from.
- Rigidity: Formal verification is binary—a proof is either 100% correct or it fails. LLMs frequently make subtle syntax errors or miss edge cases that cause the verifier to reject the entire program.
The AutoVerus Framework
AutoVerus employs a "network of agents" designed to mimic a human expert's three-phase proof construction process: Generation, Refinement, and Debugging.
1. Generation Phase
In the initial phase, an LLM agent generates preliminary loop invariants. These serve as the foundation for the proof.
2. Refinement Phase
Specialized agents analyze the initial output for common "rookie" mistakes. This includes checking for missing constant propagation, incorrect array-length specifications, and quantifier issues.
3. Debugging Phase
This is the core of the system. If Verus reports an error, AutoVerus analyzes the specific error type (e.g., "arithmetic overflow" or "post-condition not satisfied") and invokes a specific Repair Agent tailored to that error.
To maintain correctness, the authors developed Lynette, an AST-level analysis tool. Lynette ensures the LLM does not modify the original code or specifications. It also handles candidate merging, where snippets from different "imperfect" LLM outputs are combined to form a single working proof. Finally, the Houdini algorithm is used to prune unnecessary annotations, ensuring the final proof is clean and efficient.
Evaluation and Results
To evaluate the system, the authors created Verus-Bench, a benchmark consisting of 150 non-trivial proof tasks translated from existing suites like MBPP (Python) and CloverBench (Dafny). These tasks range from simple array manipulations to complex algorithms like binary search and Fibonacci sequence generation.
AutoVerus demonstrated impressive performance:
- High Success Rate: It solved 137 out of 150 tasks (91.3%).
- Outperforming Baselines: A "naive" GPT-4o baseline using a single sophisticated prompt only solved 44.7% of the tasks.
- Efficiency: More than half of the successful proofs were generated in less than 30 seconds or required fewer than three LLM calls.
- Robustness: The framework worked consistently across different models, including GPT-4o, GPT-4-Turbo, and DeepSeek-R1.
Conclusion
AutoVerus demonstrates that while LLMs may not be "natural-born logicians," they can become highly effective proof assistants when embedded in a system that enforces formal rigor. By treating the verifier as a reward function and utilizing specialized repair agents, AutoVerus significantly lowers the barrier to formal verification for Rust developers. Future work will focus on scaling the system to handle complex inter-function dependencies and automating the generation of specifications themselves.
Summary updated