Introduction
Proof-oriented programming languages like F, Dafny, and Lean represent the gold standard for software reliability, allowing developers to co-write functional code alongside formal mathematical proofs. However, the steep learning curve and labor-intensive nature of formal verification have limited their adoption. While Large Language Models (LLMs) offer a potential solution as verification assistants, they are severely hampered by the extreme data scarcity of formal languages. F code, for instance, constitutes less than 0.002% of standard training datasets like Stack-v2.
To address this, we present PoPilot, a 14B-parameter model fine-tuned specifically for F*. By utilizing a novel synthetic data pipeline and leveraging the compiler as an automated judge, PoPilot achieves a 64% relative improvement over GPT-4o in project-level proof synthesis.
The Challenge of Data Scarcity
Current LLMs struggle with formal verification not just because of low data volume, but because real-world verification requires complex, project-level reasoning. Most existing datasets focus on isolated functions, whereas production-grade F* code involves intricate dependencies across multiple files, type invariants, and shared assumptions. PoPilot bridges this gap through a data-centric post-training recipe that moves beyond simple function-level generation.
The PoPilot Methodology
The PoPilot training process involves a multi-stage data-centric pipeline designed to build both general reasoning and specialized verification skills:
- General Capability Enhancement: Initial training on diverse coding tasks in common languages to establish baseline reasoning and instruction-following skills.
- Function-Level Synthesis: Generating basic F* problems where the compiler acts as a flawless, automated judge. Any code that compiles is kept as positive training data.
- Project-Level Augmentation: Extracting context from existing F* repositories to create new, context-aware definitions and proofs that reflect real-world repository structures.
- Synthetic Repair Training: Creating datasets of broken proofs paired with compiler error messages. This includes both rule-based AST mutations and actual LLM-generated failures, which better capture the semantic misunderstandings models struggle with.
Data Curation and Synthesis
A critical insight of this work is that the compiler is a "free, perfect judge." Unlike general coding tasks that require flaky LLM-based evaluation or extensive test suites, F's strict type-checking provides an absolute correctness guarantee. PoPilot was trained on a mixture of 30K existing repository-level proofs and 90K synthetic examples. Notably, the authors found that cross-lingual transfer works: mixing in high-quality instruction-tuning data from languages like Python or Lean significantly improves performance on the low-resource target language, F.
Performance Evaluation
PoPilot (based on Qwen2.5-Coder-14B) was evaluated against industry leaders like GPT-4o and Llama-3.1-70B. On project-level tasks, PoPilot achieved a total success rate of 39.4% (comprising 33.0% initial generation and 6.4% subsequent repair). This represents a 64% relative improvement over GPT-4o’s 23.9% total success rate.
Beyond its own performance, PoPilot excels as a specialized "co-pilot" for other models. When used to repair GPT-4o's failed attempts, it boosted the larger model's overall performance by 54% compared to GPT-4o's own self-repair attempts. This suggests that specialized 14B models can effectively act as debuggers for massive general-purpose models in niche domains.
Conclusion
PoPilot demonstrates that specialized, smaller models can outperform general-purpose giants in low-resource domains through intelligent data synthesis and compiler-in-the-loop training. By lowering the barrier to formal verification, PoPilot paves the way for more secure and reliable critical infrastructure. Future work will explore extending this pipeline to other proof-oriented languages like Dafny and Lean, where project-level evaluation suites are still maturing.
Summary updated