Abstract
Existing language models (LMs) struggle with proof-oriented programming due to extreme data scarcity. This scarcity manifests in two ways: a lack of sufficient corpora for languages like F, and the absence of large-scale, project-level implementations that demonstrate intricate reasoning. We present a novel synthetic data augmentation approach for project-level proof-oriented programming, focusing on both generation and repair. Our method addresses scarcity by synthesizing basic problems, incorporating diverse coding data for reasoning elicitation, and creating new proofs within existing repositories. We introduce PoPilot*, a 14B parameter model that exceeds the performance of models outperforming GPT-4o by a 64% relative margin in project-level tasks. Furthermore, PoPilot improves GPT-4o's performance by 54% by repairing its outputs, significantly surpassing GPT-4o's self-repair capabilities.
Introduction
In mission-critical software domains—such as kernel development, blockchain protocols, and cloud infrastructure—software bugs can lead to catastrophic failures. Proof-oriented programming offers a solution by allowing developers to write code alongside mathematical proofs that formally verify correctness. Languages like F* and Dafny are at the forefront of this paradigm. However, these languages are notoriously difficult for both human developers and artificial intelligence.
For Large Language Models (LLMs), the primary obstacle is the "data desert." F* code accounts for a mere 0.002% of common code datasets like Stack v2. Without a dense corpus of examples, general-purpose models fail to grasp the complex, context-dependent reasoning required to satisfy formal solvers. This paper introduces PoPilot, a model designed to bridge this gap through specialized synthetic data generation.
Methodology: The Data-Centric Post-Training Recipe
To build PoPilot, we implemented a three-pronged strategy designed to maximize reasoning capabilities despite the lack of native F* data.
1. Diverse Code Pre-training
Rather than narrowing the focus exclusively to F*, we trained the model on a wide variety of programming languages and tasks. This approach builds general "code-reasoning" and instruction-following capabilities. By exposing the model to diverse logic structures, we elicit the underlying reasoning muscles necessary for formal verification tasks.
2. Synthetic Function-Level Tasks and the Verify-Repair Loop
We utilized LLMs to generate basic F programming problems and property-proving tasks. The core innovation here is the Verify-Repair Loop. We used the F solver itself to verify the generated solutions. When a solution failed, the resulting error message was captured and paired with the original code to create a "repair" training example. This process teaches the model not just how to write code, but how to interpret compiler feedback and fix semantic errors.
3. Project-Level Augmentation
Real-world software is rarely self-contained. To handle industrial complexity, we synthesized repository-level data. This involved generating proofs that depend on external modules, lemmas, and type invariants across multiple files. This mimics the inter-dependency found in professional software development, moving beyond simple "snippet-level" generation.
Datasets and Experimental Setup
Our training mixture combined existing and synthesized data:
- Seed Data: 30,000 existing F* repository-level definitions and proofs.
- Synthetic F* Data: Between 54,000 and 93,000 newly generated tasks, including natural language-to-code, code completion, and repair scenarios.
- Cross-Language Data: To bolster reasoning, we included CodeAlpaca (general instructions), Evol-Instruct (complex coding), Deepseek-Prover-V1 (Lean 4 proof data), and RunbugRun (program repair).
- Evaluation: Models were tested on a hold-out benchmark of 1,000 repository-level definition-proof problems.
Key Results
PoPilot (14B) demonstrates that specialized training can overcome the limitations of model scale.
Superior Performance over GPT-4o
In project-level proof generation, PoPilot achieved a 64% relative margin over GPT-4o. This suggests that for niche, high-reasoning domains, a well-tuned 14B parameter model can significantly outperform general-purpose giants.
The "Co-Pilot" Repair Effect
One of the most striking findings was PoPilot's ability to act as a repair agent. When tasked with fixing the failed outputs of GPT-4o, PoPilot improved GPT-4o’s success rate by 54%. This performance notably exceeded GPT-4o’s own ability to self-repair, highlighting the value of the Verify-Repair Loop training.
Benchmarking against Open-Source Models
PoPilot also outperformed other leading open-source models, including Qwen-2.5-Coder-32B and DeepSeek-V3, on F*-specific benchmarks, establishing a new state-of-the-art for the language.
Discussion and Insights
Our research yields several key insights into the future of AI-assisted formal verification:
- Niche Specialization: High-quality synthetic data allows smaller models to dominate specialized domains.
- The Power of Repair: Training on "incorrect code + error message" pairs is more effective than training on correct code alone, as it teaches the model the underlying constraints of the language.
- Cross-Language Transfer: Including data from other formal languages (like Lean 4) helps the model internalize the logic of theorem proving, regardless of syntax.
Conclusion and Future Work
PoPilot demonstrates a viable path for developing AI tools in data-scarce environments. By leveraging synthetic data and automated verification loops, we can create models capable of handling the rigors of formal software verification. Future work will involve expanding this "synthetic recipe" to other low-resource formal languages like Dafny and further automating the management of complex, multi-repository dependencies.
Summary updated