dafny-annotator: AI-Assisted Verification of Dafny Programs
Not on the map. Why?
Abstract (arXiv)
Formal verification has the potential to drastically reduce software bugs, but its high additional cost has hindered large-scale adoption. While Dafny presents a promise to significantly reduce the effort to write verified programs, users are often required to provide logical annotations to aid the verifier. Here, we explore using a combination of Large Language Models and search to build dafny-annotator: a tool that adds logical annotations to a Dafny method until the verifier can prove it correct. On a test set from the DafnyBench collection of programs, greedy search guided by LLaMa 3.1 8B successfully annotates only 15.7% of the methods. Since this data-driven approach is hindered by the lack of large-scale training data, we propose a method for open-ended synthesis of new Dafny programs in a flexible pipeline where LLMs formulate high-level ideas, implement them, and incrementally propose changes to existing programs, which Dafny validates. This gives us a synthetic dataset, DafnySynth, which we use to augment DafnyBench for training. Fine-tuning on both datasets boosts LLaMa 8B's success rate to 50.6% -- significantly better than the base model, or training on either dataset alone. Our results suggest a path towards capable AI assistants for languages that don't yet have large-scale human-generated examples. In turn, such assistants might reduce friction for users and ultimately drive adoption.
Key facts. Cited by 8 papers in the map (data through 14 Oct 2026). Builds on 9 of its 17 references that are in the map. First posted on arXiv 5 Nov 2024.
Builds on
9 of 17 references.
References · 9
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2022STaR: Bootstrapping Reasoning With Reasoningcited by 940
- 2024Lean-STaR: Learning to Interleave Thinking and Provingcited by 68
- 2024DafnyBench: A Benchmark for Formal Software Verificationcited by 57
- 2024Learning Formal Mathematics From Intrinsic Motivationcited by 45
- 2024Proof Automation with Large Language Modelscited by 22
- 2024miniCodeProps: a Minimal Benchmark for Proving Code Propertiescited by 18
Built on by
Citing papers per year: 2025: 5; 2026: 3.
8 papers.
- 2025VeriStruct: AI-assisted Automated Verification of Data-Structure Modules in Veruscited by 9
- 2025Local Success Does Not Compose: Benchmarking Large Language Models for Compositional Formal Verificationcited by 6
- 2025Inferring multiple helper Dafny assertions with LLMscited by 4
- 2025Can LLMs Enable Verification in Mainstream Programming?cited by 3
- 2025Proof2Silicon: Prompt Repair for Verified Code and Hardware Generation via Reinforcement Learningcited by 1
- 2026An Empirical Study of LLM-Generated Specifications for VeriFastcited by 0
- 2026Diversifying to Verify: When Task-Equivalent Programs Differ in Verifiabilitycited by 0
- 2026Partial Contracts Suffice: Sound, LLM-Inferred Regression Verificationcited by 0
- 2026Partial Contracts Suffice: Sound, LLM-Inferred Regression Verification11 Jul 2026
- 2026Diversifying to Verify: When Task-Equivalent Programs Differ in Verifiability10 Jul 2026
- 2026An Empirical Study of LLM-Generated Specifications for VeriFast25 Jun 2026
- 2025Inferring multiple helper Dafny assertions with LLMs31 Oct 2025
- 2025VeriStruct: AI-assisted Automated Verification of Data-Structure Modules in Verus28 Oct 2025
- 2025Local Success Does Not Compose: Benchmarking Large Language Models for Compositional Formal Verification27 Sep 2025
- 2025Proof2Silicon: Prompt Repair for Verified Code and Hardware Generation via Reinforcement Learning7 Sep 2025
- 2025Can LLMs Enable Verification in Mainstream Programming?18 Mar 2025