Rango: Adaptive Retrieval-Augmented Proving for Automated Software Verification
Rango uses retrieval-augmented LLMs for automated proof synthesis, achieving 32% success rate, surpassing state-of-the-art by 29%.
Key Findings
Methodology
Rango employs a fine-tuned DeepSeek-Coder (1.3B parameters) combined with a retrieval mechanism using BM-25 and TF-IDF algorithms. At each proof step, it retrieves relevant proofs and lemmas from the current project, based on similarity of proof states, and feeds them into a decoder-only LLM to generate tactics. The system constructs the CoqStoq dataset with 2226 projects and 196,929 theorems for training and evaluation. The process involves iterative proof generation with a rollout search strategy, dynamically adapting to proof states.
Key Results
- On the CoqStoq benchmark, Rango proved 32.0% of the theorems, outperforming Tactician (29%) by 29%. In projects like CompCert and long-term maintained repositories, success rates reached 37.2% and 35.8%. Incorporating relevant proofs increased the proof success by 47%, confirming the importance of dynamic knowledge integration.
- Compared to Proverbot9001 and Graph2Tac, Rango demonstrated superior performance across all datasets, with proof counts exceeding by 66% and 29%, respectively. Ablation studies confirmed that combining proof and lemma retrieval significantly boosts proof synthesis effectiveness.
- The multi-modal retrieval approach (BM-25 and TF-IDF) enhances both proof accuracy and efficiency. The ablation results highlight that retrieval of proofs and lemmas together is crucial for optimal performance.
Significance
This work advances automated theorem proving by integrating dynamic knowledge retrieval into large language models, significantly improving proof success rates. It addresses longstanding bottlenecks in proof automation, making formal verification more accessible for industrial applications. The approach reduces manual effort and enhances software reliability, paving the way for broader adoption of formal methods in software engineering.
Technical Contribution
The key innovation lies in combining multi-modal retrieval algorithms with a fine-tuned LLM, enabling real-time, context-aware proof generation. The system dynamically incorporates project-specific proofs and lemmas at every step, unlike prior static retrieval methods. The creation of the CoqStoq dataset provides a valuable resource for future research, supporting large-scale training and benchmarking. The architecture demonstrates how to effectively leverage limited context to produce complex proofs, opening new avenues for AI-assisted formal verification.
Novelty
This is the first work to integrate continuous, step-by-step retrieval of relevant proofs and lemmas into an LLM-based proof synthesis pipeline, enabling adaptive, project-specific proof strategies. Unlike previous static retrieval approaches, Rango’s dynamic, multi-modal retrieval and proof adaptation represent a significant leap forward in proof automation technology.
Limitations
- The system’s performance diminishes with extremely large or complex proofs, especially when relevant lemmas are missing or proof chains are very long. The retrieval algorithms (BM-25, TF-IDF) may not capture semantic nuances, limiting effectiveness in cases with paraphrased or semantically similar but lexically different proofs. Additionally, the training process requires substantial computational resources, making deployment challenging for smaller labs or real-time applications.
Future Work
Future directions include exploring neural retrieval techniques for better semantic matching, expanding the dataset to include industrial-scale proofs, and integrating the system into continuous integration pipelines for real-time proof assistance. Improving model efficiency and scalability will also be prioritized to facilitate broader adoption.
AI Executive Summary
As software systems grow increasingly complex, ensuring their correctness and safety has become a critical challenge. Traditional formal verification methods, while highly reliable, are often prohibitively labor-intensive and require expert knowledge. Recent advances in AI, particularly large language models (LLMs), have opened new avenues for automating proof generation, but existing systems struggle with project-specific adaptations and long proof chains.
This paper introduces Rango, a novel system that combines retrieval-augmented techniques with fine-tuned LLMs to address these challenges. Rango dynamically retrieves relevant proofs and lemmas from the current project at each proof step, feeding this information into a deep learning model to generate tactics. This approach allows the system to adapt to the evolving proof state and project context, significantly improving proof synthesis success rates.
The core innovation is the integration of multi-modal retrieval algorithms—BM-25 for proof states similarity and TF-IDF for lemma relevance—within a reinforcement of a large-scale, curated dataset, CoqStoq. The dataset encompasses over 2,200 projects and nearly 200,000 theorems, providing a rich resource for training and benchmarking. Experimental results demonstrate that Rango achieves a proof success rate of 32%, surpassing the previous state-of-the-art Tactician by 29%. When relevant proofs are included in the context, the success rate increases by 47%, confirming the effectiveness of dynamic knowledge incorporation.
Compared to other leading tools like Proverbot9001 and Graph2Tac, Rango shows superior performance across diverse projects, especially in complex industrial scenarios like CompCert. The system’s ability to adapt proof strategies at each step marks a significant step forward in AI-assisted formal verification. Future work aims to incorporate more advanced retrieval techniques, expand the dataset, and integrate into industrial verification pipelines, promising a future where automated software correctness becomes routine and scalable.
Deep Analysis
Background
Formal verification has long been regarded as the gold standard for ensuring software correctness, especially in safety-critical systems. Early tools relied heavily on manual proof construction, which was time-consuming and required expert knowledge. The advent of interactive proof assistants like Coq, Isabelle, and Agda improved reliability but still depended on human intervention. Recent developments include integrating machine learning models to automate proof synthesis, exemplified by tools such as Tactician, Proverbot9001, and Graph2Tac. These systems utilize learned tactics and environment retrieval but often lack project-specific adaptability and struggle with complex proofs. The emergence of large language models (LLMs) like GPT-3 and Codex has further pushed the frontier, enabling more flexible proof generation. However, most approaches rely on static data or limited context, which hampers performance in real-world, large-scale projects. This paper situates itself within this evolution, proposing a dynamic, retrieval-augmented framework that leverages project-specific knowledge at every proof step.
Core Problem
Despite progress, current automated proof systems face significant limitations in handling complex, long proofs and project-specific variations. Static retrieval methods cannot adapt to the evolving proof state, leading to lower success rates in industrial-scale applications. Moreover, existing models often hallucinate or retrieve irrelevant information, reducing reliability. The core challenge is to develop a system capable of dynamically incorporating relevant proof knowledge, including similar proofs and lemmas, in real-time, while maintaining efficiency and accuracy. Addressing this gap is crucial for making formal verification practical and scalable in software engineering, especially for safety-critical systems where correctness is non-negotiable.
Innovation
The primary innovation is the integration of a multi-modal retrieval mechanism with a fine-tuned LLM, enabling real-time, proof-specific knowledge incorporation. Rango employs BM-25 to retrieve proofs with similar proof states, and TF-IDF to select relevant lemmas, both at each proof step. This dynamic retrieval feeds into a decoder-only LLM, which generates tactics conditioned on the current proof context, proof state, and retrieved resources. Unlike prior static approaches, Rango continuously adapts its proof strategy, effectively learning local proof tactics. The creation of CoqStoq, a large-scale dataset, supports this approach, providing diverse, project-specific proof data for training and benchmarking. The architecture demonstrates how to leverage limited context efficiently, significantly improving proof automation success rates.
Methodology
- �� Fine-tune DeepSeek-Coder (1.3B parameters) on CoqStoq dataset, using prompt-based supervised learning. • At each proof step, use BM-25 to compare current proof state with proof states in the proof bank, selecting top-k relevant proofs. • Use TF-IDF to score and retrieve the most relevant lemmas from the lemma bank based on current proof context. • Concatenate retrieved proofs, lemmas, theorem statement, proof script, and proof state into a prompt for the decoder-only LLM. • Generate the next tactic conditioned on this prompt, ensuring the model remains context-aware. • Employ rollout search, sampling tactics with temperature 1.0, executing tactics in Coq to verify correctness. • Iterate until proof completion or timeout, updating retrievals dynamically based on proof progress. • Optimize hyperparameters such as token limits, learning rate, and batch size for efficiency and accuracy.
Experiments
The model is trained on CoqStoq, comprising 2226 projects and nearly 200,000 theorems, with evaluation on a held-out benchmark including CoqGym, CompCert, and long-term projects. Baselines include Tactician, Proverbot9001, and Graph2Tac. Metrics include proof success rate, total proofs, and proof time. Hyperparameters involve a 10-minute timeout, batch size 16, learning rate 10^-3, and GPU acceleration. Ablation studies compare the impact of different retrieval algorithms and the inclusion of proofs versus only lemmas. The evaluation demonstrates Rango’s superior performance, especially in industrial and complex proofs, validating the effectiveness of dynamic, retrieval-augmented proof synthesis.
Results
Rango achieves a proof success rate of 32%, outperforming Tactician (29%) by 29%. In the CompCert project, success rate reaches 37.2%, surpassing previous tools. Incorporating relevant proofs increases proof count by 47%, confirming the importance of dynamic knowledge retrieval. Compared with Proverbot9001 and Graph2Tac, Rango proves 66% and 29% more theorems respectively. Ablation results show that combining proof and lemma retrieval yields the best performance, emphasizing the synergy of multi-modal retrieval. These results demonstrate the system’s robustness across diverse projects and proof complexities.
Applications
Rango can be integrated into industrial software verification pipelines, automating proof generation for critical components, reducing manual effort, and increasing reliability. It is suitable for formal verification in safety-critical domains like aerospace, automotive, and medical devices. The system can also serve as an intelligent assistant for proof engineers, providing suggestions and automating routine proofs. Long-term, it could enable fully automated verification workflows, significantly accelerating software development cycles and ensuring higher standards of correctness.
Limitations & Outlook
The system’s performance diminishes with very large or highly complex proofs, especially when relevant proofs or lemmas are missing. Its reliance on BM-25 and TF-IDF may limit semantic understanding, leading to retrieval errors in paraphrased or semantically similar cases. High computational costs for training and inference pose practical challenges, especially for smaller teams or real-time applications. Future work needs to address these issues by exploring neural retrieval methods and model compression techniques.
Plain Language Accessible to non-experts
想象你在厨房做饭,菜谱上写着很多步骤,但每次你做菜时,可能会忘记一些细节。于是,你会找一本类似的菜谱,看看别人是怎么做的,然后根据自己的情况调整。Rango就像这个厨房助手,它会在你做菜的每一步,帮你找出最相关的菜谱和技巧,告诉你下一步怎么做。它会不断从厨房里的所有菜谱中检索最合适的内容,帮你做出更好吃的菜。这样一来,即使你是新手,也能做出专业水平的菜肴。这个系统让复杂的证明变得像做菜一样简单,靠不断找灵感,逐步完成任务。
ELI14 Explained like you're 14
想象你在学校写作文,有时候不知道下一句话怎么写。你可以偷偷看看朋友之前写的好句子,或者找一些范例,借鉴他们的表达。Rango就像一个聪明的朋友,它会在你写作文时,帮你找到别人写过的精彩句子和段落,然后告诉你下一步怎么写。每次你写一点点,它都会帮你找出最相关的例子,帮你继续写下去。这样,你的作文就能变得越来越棒,不用担心写不出来。它就像一个会帮你搜集灵感的超级助手,让写作变得轻松又有趣。
Glossary
Proof Assistant (证明助手)
一种软件工具,用于帮助用户构建和验证数学证明,确保逻辑正确性。
论文中提到的Coq就是一种证明助手。
Large Language Model (大语言模型)
基于深度学习的预训练模型,能理解和生成自然语言,应用于自动证明生成。
Rango中的核心模型是微调的LLM。
Retrieval-Augmented Generation (检索增强生成)
结合信息检索技术与生成模型,提升内容的相关性和准确性。
Rango采用此技术增强证明生成。
BM-25
一种信息检索算法,用于衡量文本之间的相关性,常用于文档检索。
用于检索证明状态的相似性。
TF-IDF
一种文本特征提取方法,用于衡量词语的重要性,帮助检索相关引理。
用于引理的相关性评分。
Open Questions Unanswered questions from this research
- 1 如何进一步提升模型在长链复杂证明中的表现仍未解决,尤其在证明链较长或引理缺失时,模型的推理能力和检索机制需要优化。
Applications
Immediate Applications
工业软件验证
利用Rango自动生成软件关键部分的证明,降低人工成本,提升验证效率。
自动化测试辅助
结合证明自动化,增强软件测试的覆盖率和可靠性,适用于安全关键系统。
Long-term Vision
智能软件开发助手
未来可集成到开发环境中,实时辅助程序验证,推动自动化软件工程。
Abstract
Formal verification using proof assistants, such as Coq, enables the creation of high-quality software. However, the verification process requires significant expertise and manual effort to write proofs. Recent work has explored automating proof synthesis using machine learning and large language models (LLMs). This work has shown that identifying relevant premises, such as lemmas and definitions, can aid synthesis. We present Rango, a fully automated proof synthesis tool for Coq that automatically identifies relevant premises and also similar proofs from the current project and uses them during synthesis. Rango uses retrieval augmentation at every step of the proof to automatically determine which proofs and premises to include in the context of its fine-tuned LLM. In this way, Rango adapts to the project and to the evolving state of the proof. We create a new dataset, CoqStoq, of 2,226 open-source Coq projects and 196,929 theorems from GitHub, which includes both training data and a curated evaluation benchmark of well-maintained projects. On this benchmark, Rango synthesizes proofs for 32.0% of the theorems, which is 29% more theorems than the prior state-of-the-art tool Tactician. Our evaluation also shows that Rango adding relevant proofs to its context leads to a 47% increase in the number of theorems proven.