Towards Repository-Level Program Verification with Large Language Models
Si Cheng Zhong, Xujie Si
TL;DR
This paper addresses the challenge of repository-level formal verification by introducing RVBench, a benchmark built from four Verus-based projects to capture cross-module dependencies and environmental interactions, and RagVerus, a retrieval-augmented framework that injects repository context and premises into LLM-based proof synthesis. RagVerus integrates repository indexing, few-shot and dependency retrieval, and proof generation with rigorous verification through the Verus compiler and Lynette, achieving a 27% relative improvement on RVBench and notable gains on function-level tasks. The work highlights both the potential of context-aware retrieval to scale verification and the remaining gaps in handling complex, multi-module proofs, suggesting directions for richer premise pools and specialized retrieval strategies. Overall, RVBench and RagVerus lay a scalable foundation for automated, real-world verification of large codebases, with implications for higher assurance software systems.
Abstract
Recent advancements in large language models (LLMs) suggest great promises in code and proof generations. However, scaling automated formal verification to real-world projects requires resolving cross-module dependencies and global contexts, which are crucial challenges overlooked by existing LLM-based methods with a special focus on targeting isolated, function-level verification tasks. To systematically explore and address the significant challenges of verifying entire software repositories, we introduce RVBench, the first verification benchmark explicitly designed for repository-level evaluation, constructed from four diverse and complex open-source Verus projects. We further introduce RagVerus, an extensible framework that synergizes retrieval-augmented generation with context-aware prompting to automate proof synthesis for multi-module repositories. RagVerus triples proof pass rates on existing benchmarks under constrained model inference budgets, and achieves a 27% relative improvement on the more challenging RVBench benchmark, demonstrating a scalable and sample-efficient verification solution.
