NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

AutoVerus: Automated Proof Generation for Rust Code

Chenyuan Yang, X. Li, Md Rakib Hossain Misu, Jianan Yao, Weidong Cui, Yeyun Gong, Chris Hawblitzel, Shuvendu K. Lahiri, Jacob R. Lorch, Shuai Lu, Fan Yang, Ziqiao Zhou, Shan Lu

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:

  1. Data Scarcity: Unlike general-purpose languages, there is very little "Verus proof code" available for LLMs to learn from.
  2. 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.

The three-phase workflow of AutoVerus: 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

BibTeX
@misc{yang2024autoverus,
  author = {Chenyuan Yang and X. Li and Md Rakib Hossain Misu and Jianan Yao and Weidong Cui and Yeyun Gong and Chris Hawblitzel and Shuvendu K. Lahiri and Jacob R. Lorch and Shuai Lu and Fan Yang and Ziqiao Zhou and Shan Lu},
  title = {{AutoVerus: Automated Proof Generation for Rust Code}},
  year = {2024},
  eprint = {2409.13082},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.13082},
}
Figure