acceptodds
Under review as a conference paper at ICLR 2027

Formal Disco: Scalable Open-Ended Generation of Formally Verified Programs

Abstract

The cost of producing code is rapidly decreasing with increasingly capable AI agents, but quality assurance has not kept pace. Formal verification can provide strong correctness guarantees on generated code, but languages supporting verification are still challenging for coding models due to the scarcity of available examples of programs in those languages. To tackle this issue, we propose Formal Disco: a scalable system for coordinated LLM-based workers that can be easily applied to open-ended synthetic data generation at scale. We use Formal Disco to share tasks and programs between three classes of workers: "initiators", which read random READMEs from open-source repositories and documentation snippets to sketch a short related verified program, "fixers" which resolve issues given compiler/verifier feedback, and "extenders" that propose patches to expand working programs. Formal Disco records and uses agent traces both for initial distillation from a stronger model and for self-improvement. To prevent diversity collapse, we propose a simple principle of maximum entropy for synthetic program generation, and use entropy maximization via iterative supervised fine-tuning to learn to generate increasingly diverse programs over time. We release large datasets of synthetic verified programs in three languages - Dafny, Verus, and Frama-C -,and fine-tune Qwen-2.5 Coder 32B for verification-relevant tasks, matching Claude Opus 4.5 on a Verus annotation task and closing much of the gap in all other cases. Overall, our work offers a path to using synthetic verified programs at scale to overcome the long-standing data barrier in AI-assisted verified programming.

Primary area:
neurosymbolic & hybrid AI systems (physics-informed, logic & formal reasoning, etc.)
Keywords:
formally verified programs, discovery, low-resource languages, dafny, verus, frama-c

Reviews

Among:
Shape:
1234this paper, Bottom 27%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.00 over 3 reviews, above 27% of the others.
Reviewer_FHC3OpenReview ↗
Rating
3
Confidence
4(+1)
Informativeness
3
Presentation
3
Soundness
2
Read review
Paper summary

This paper proposed a framework called FormalDisco, which use iterative loop to improve LLM's ability in generating verified code, by synthesizing formally verified programs with verifiers. FormalDisco leverages three types of agents (Initiator for initializing program with spec/doc, Fixer for fixing failed program with verifier feedback, and Extender for adding functions into verified code). It reports over 100k synthesized verified programs and demonstrated gain on downstream tasks.

Critical strengths

I really like this paper and feel even with such a clean and simple paradigm, it elegantly tackled a core issue in verified code generation and has potential to be applied to broader use cases or even adopted in industry deployment. The critical strengths:

  1. The logic chain of initializing, fixing and extending is reasonable (especially extender): This loop efficiently leveraged the verification signals to generate program that can pass formal verification, and it increases the complexity of programs (i.e., programs with longer LOC due to the multiagent collaboration). This additive design is both intuitive and efficient. This is the foundation of my positive overall assessmenet,

  2. It's inherently a plug-in styled data filtering/selection process: The authors are aware of potential diversity collapse and use program-feature entropy to make it tangible, which paves the way for filtering data in SFT. This incorporate diversity into a part of model training, making it more flexible in potential applications, and the authors have extensive experiments and downstream tasks (i.e., the Qwen Pass@1 results on multiple benchmarks) to validate it too. This consolidate my overall assessment as it supports the claims.

Critical weaknesses

While this paper has genuine value and advantage, there are some potential issues that may weaken its contribution:

  1. There is no independent analysis of the specification quality of verified programs: This pipeline can theoretically generates specifications, implementations and proofs at the same time, but if there is no separate validation process, it cannot guanrantee the quality of generated specifications (i.e., they can be insignificant, off-track, or lack of constraints, etc). The current adopted metrics, like program length or complexity/entropy are a bit shallow and not directly relevant to spec quality. This wont harm the assessment but also constraint the positiveness to be weak acceptance.

  2. Despite the performance gain, the evaluation has potential to be improved: Currently the authors adopted Dafny and Verus, but there is no claimed downstream result on Frama-C. In addition, some minor results issues include (1) Qwen has different sampling budget than Claude Opus so their results are not directly comparable, (2) in lemma proving the performance can be further improved, and (3) the lack of diversity/semantic analysis of the 100k data, etc. These minor issues also constraint the work to be weak acceptance.

Questions for authors
  1. Since the specifications are generated, how do you make sure their quality is actually good (i.e., is the constraint strong enough, or actually functional as expected, etc)? Any spec quality assessment during the autospec process?

  2. Is it possible to compare the performance of entropy-based filtering and random filtering and SFT given same data and budget, to show the independent advantage of entropy maximization?

  3. Any results on Frama-C (since Dafny and Verus results were in place, but claimed Frama-C result is missing)?

1 comment

Thank you for the detailed and positive review! We address your questions below.

Since the specifications are generated, how do you make sure their quality is actually good (i.e., is the constraint strong enough, or actually functional as expected, etc)? Any spec quality assessment during the autospec process?

Our current pipeline does not directly guarantee or maximize specification strength, though the diversity encouraged by some of the feature entropies (e.g., logical annotation templates) encourages specifications to not be trivial (since Z3 can generally prove trivial specs without help). While we can’t claim any intrinsic guarantees on the specs, the downstream evaluations show that they are at least extrinsically useful.

Is it possible to compare the performance of entropy-based filtering and random filtering and SFT given same data and budget, to show the independent advantage of entropy maximization?

Yes, thanks for the suggestion. We completed a full run on Dafny, starting from the same Claude seed runs and repeating 5 iterations of self-improvement without the entropy filter (taking a random subset of the same fraction of the examples in each iteration, and training for the same number of SFT steps). We found that removing the entropy maximization makes the discovered Dafny programs markedly simpler, across all metrics we tracked. For instance, during the run, programs from the entropy-maximizing runs grow from 123 to 154 non-comment lines on average (median 96 -> 129) and from 6.8 to 12.0 assertions on average. The noent runs grow less, reaching 139 lines (median 107) and 9.6 assertions. Loop invariants rise from to 2.9 per program on average with entropy maximization, but this stays flat at about 1.2 per program without, so they contain roughly 2.5x fewer invariants by the last iteration. The noent workers also succeed more often, with initiator and extender success rates around 9-10% higher than without entropy maximization (fixer is also ahead but by a narrow margin, around 2%). This is consistent with the entropy term pushing workers toward harder and more novel tasks, whereas without it they settle on simpler programs they can already write/verify. The effect on downstream performance on DafnyBench is smaller, however. When we SFT a fixer on each agenda set and evaluate on DafnyBench, overall pass@32 is comparable: 42.2% vs 44.2% (with vs without). The two differ slightly more at pass@1 (22.4% without vs 25.8% with). Entropy maximization therefore gives richer programs and a model that is more often right immediately, while pass@k for high k largely hides the difference on DafnyBench at least. We will repeat this comparison for Verus and add both to the paper.

Any results on Frama-C (since Dafny and Verus results were in place, but claimed Frama-C result is missing)?

For Frama-C, despite being an active framework with industrial use, we could not find any existing suitable downstream evaluations in prior work (such as an equivalent "'FramaCBench"), so we only reported intrinsic evaluations on it. If the reviewer has suggestions of a downstream evaluation that would be informative here, we'd be happy to try our best on it before the rebuttal period ends.

Thank you again! We'd be happy to engage further if the reviewer has other questions.

Reviewer_26NYOpenReview ↗
Rating
1
Confidence
4
Informativeness
1
Presentation
1
Soundness
1
Read review
Paper summary

The authors present Formal Disco, where three types of LLM workers write, fix, and extend programs in 3 Dafny, Verus, and Frama-C. An Initiator writes a small starting program from a random GitHub README and language documentation snippets, a Fixer repairs programs that fail, and an Extender grows working programs into more complex ones. Claude generates the first round of data, Qwen2.5-Coder-32B is fine-tuned on the successful examples, and Qwen then keeps generating and retraining on its own data over multiple iterations. To keep the data diverse, the authors use the entropy of program features such as loop shapes, and train on the examples that are rare on those features. The result is a released dataset of over 100k verified programs.

Critical strengths

Verification languages have less human-written code (as compared to general-purpose code), and the paper releases over 100k verified programs. While this is useful, beyond this contribution, the reported gains are hard to credit to the paper’s method. Improvements over other Verus datasets are within a few problems on a 149-program benchmark, and the larger gains over base Qwen do not isolate the usefulness of the entropy measure as defined by the authors or the generation design.

Critical weaknesses
  • Figure 2 is not a controlled comparison. The paper never says Claude and Qwen are scored on the same tasks. Section 3.2 says each run schedules workers for up to K attempts on its own agenda, and the caption only says the dashed line is the "seed Claude workers" while the solid lines are Qwen after SFT. Success rate is therefore a per-run yield, not a test on a fixed set, so "Qwen matches or outperforms Claude" (Section 4.1) is not supported. The Fixer line also stays level with Claude at best, around 0.11 to 0.12 in Dafny, which sits below the claim "across all worker tasks and languages."
  • The entropy filter is never isolated. The Figure 2 caption says "SFT always uses entropy maximization, including on iteration 1," and Table 3 lists it as the only training setting. There is no unfiltered or random-subset SFT control, so gains in success, diversity (Figure 3) and downstream accuracy (Figures 4 and 5) cannot be attributed to entropy maximization rather than distillation or more data. The downstream experiments also never compare filtered against unfiltered corpora.
  • The definition of f is circular and inconsistent with the implementation. Section 3.1 defines f as a function to "an enumerable set of possible values that f(p) can take," which constrains almost nothing, since any function on a finite dataset takes finitely many values. It assumes one value per program, but Appendix G computes multisets pooled across methods, so a program with 20 methods counts 20 times, and the per-program surprisal and msr ranking in Section 3.3 are left undefined for multisets. The paper never shows that higher entropy on these four hand-picked features predicts downstream usefulness.
  • The comparisons with other datasets and baselines are weak. On VerusBench (149 programs, Section 4.3) the 43.0% vs 40.9% Pass@1 gap against SAFE is about three problems, and the 59.1% vs 54.5% Pass@32 gap against VeruSyn is about seven. These are single runs with no seeds, and the bootstrapped CIs in Figure 4 cover only benchmark sampling noise, not training variance, yet the text concludes that the data yields "more diverse and representative repairs." The paper’s claim of "matching Claude Opus 4.5" is a potential overclaim. On VerusBench the Pass@1 tie (43% vs 43%) is within the overlapping confidence bands of Figure 4, and on DafnyBench the match requires Qwen at Pass@16 against Opus at Pass@1. At equal k, Opus’s curves in Figure 4 rise above Qwen’s (it is only plotted to Pass@4), and on lemma proving Opus leads by a wide margin (61.6% vs 25.5% Pass@1). The authors note that Opus uses chain-of-thought while the SFT models do not, but this means the comparison is not like-for-like, and the evidence supports "approaches Opus at higher sampling budgets," not "matches" or "outperforms."
  • The writing and reporting contain visible errors. Section 4.2 says the longest Dafny method is "96 vs. 95 lines," while Table 5 says 154 vs 95. Appendix C opens with a broken "Figure ??". Table 3 says "mrr" where the text says "msr."
  • Verification is treated as a quality signal without checking specification strength. A program verifies against whatever spec the LLM wrote, so weak or vacuous specs pass. The paper’s own showcase examples in Appendix H.0.3 show this: the Verus cookie serializer only ensures the output length equals key + 1 + value, and its lemma proves key_len + 1 + value_len > key_len (commented "Trivial arithmetic proof"), while the Dafny HelloWorld lemmas verify with empty bodies.
Questions for authors
  1. Figure 2 baseline: The dashed Claude line is flat across all SFT iterations. Is it a single measurement from one seed run, and if so, why is it drawn as a constant across the x-axis? Was Claude’s success rate measured on the same tasks (same READMEs, same programs for repair and extend) as the Qwen runs? If not, how should the reader compare the two?
  2. Entropy control: Could you report an SFT run without the entropy filter (and one on a random subset of the same size) for the same iterations and downstream tasks? Without it, how do you attribute gains to entropy maximization rather than distillation or more data?
  3. Definition of f: Section 3.1 defines f as a function to "an enumerable set of possible values that f(p) can take," but Appendix G computes multisets pooled across methods. How is the per-program surprisal S(f, p, D) and the msr ranking in Section 3.3 defined when a program has many observations per feature?
2 comments

We thank the reviewer for the thorough comments! We respond to each of the questions below.

Figure 2 baseline: The dashed Claude line is flat across all SFT iterations. Is it a single measurement from one seed run, and if so, why is it drawn as a constant across the x-axis? Was Claude’s success rate measured on the same tasks (same READMEs, same programs for repair and extend) as the Qwen runs? If not, how should the reader compare the two?

The goal of the experiment in Figure 2 is to evaluate whether Formal Disco is a scalable system for generating new, diverse, correct synthetic verified programs. Claude and Qwen are not scored on the same programs, but they are both running as workers in the same system, and we wanted to evaluate whether Qwen, after distillation and self-improvement, can serve as a much cheaper but still productive worker for generating, repairing and extending programs. Section 4.1 shows that we can generate programs at scale with Qwen (with better yield than the initial Claude model after self-improvement), and 4.2 shows that they are diverse. The Claude line is flat because we cannot train Claude ourselves, so it is the performance of the initial Claude runs we used for distillation for Qwen.

Entropy control: Could you report an SFT run without the entropy filter (and one on a random subset of the same size) for the same iterations and downstream tasks? Without it, how do you attribute gains to entropy maximization rather than distillation or more data?

Yes, thanks for the suggestion. We completed a full run on Dafny, starting from the same Claude seed runs and repeating 5 iterations of self-improvement without the entropy filter (taking a random subset of the same fraction of the examples in each iteration, and training for the same number of SFT steps). We found that removing the entropy maximization makes the discovered Dafny programs markedly simpler, across all metrics we tracked. For instance, during the run, programs from the entropy-maximizing runs grow from 123 to 154 non-comment lines on average (median 96 -> 129) and from 6.8 to 12.0 assertions on average. The noent runs grow less, reaching 139 lines (median 107) and 9.6 assertions. Loop invariants rise from to 2.9 per program on average with entropy maximization, but this stays flat at about 1.2 per program without, so they contain roughly 2.5x fewer invariants by the last iteration. The noent workers also succeed more often, with initiator and extender success rates around 9-10% higher than without entropy maximization (fixer is also ahead but by a narrow margin, around 2%). This is consistent with the entropy term pushing workers toward harder and more novel tasks, whereas without it they settle on simpler programs they can already write/verify. The effect on downstream performance on DafnyBench is smaller, however. When we SFT a fixer on each agenda set and evaluate on DafnyBench, overall pass@32 is comparable: 42.2% vs 44.2% (with vs without). The two differ slightly more at pass@1 (22.4% without vs 25.8% with). Entropy maximization therefore gives richer programs and a model that is more often right immediately, while pass@k for high largely hides the difference on DafnyBench at least. We will repeat this comparison for Verus and add both to the paper.

Definition of f: Section 3.1 defines f as a function to "an enumerable set of possible values that f(p) can take," but Appendix G computes multisets pooled across methods. How is the per-program surprisal S(f, p, D) and the msr ranking in Section 3.3 defined when a program has many observations per feature?

Thanks for pointing this out: our actual implementation of S(f, p, D) is indeed more general than the formalization in Section 3.1 since it handles features with many values per program (e.g., proof length of all lemmas). If f(p) is a multiset, we essentially max-pool the surprisal of all the individual values observed in that program to compute S(f, p, D). If the feature is unobserved (eg, a program with no lemmas for the proof length feature), max-pooling returns -infinity for that feature (so pp will be at the bottom of the ranking for ff). More precisely, we compute the multiset of values f(p), then compute the surprisal of each value v in f(p) in the corpus D, and use the maximum surprisal as S(f, p, D) (from there the rankings and msr definitions work unchanged). The values in f(p) all count individually to the counts of this feature in D. Our intuition here was that observing one surprising value of a particular feature (e.g., one logical annotation template never seen elsewhere in the dataset) makes the program surprising.

If the reviewer has additional questions, we'll try our best to address them before the end of the rebuttal period.

Thank you for your honest response. The rebuttal confirms most of the concerns I raised and didn't address all the weaknesses I listed.

  • The authors admit that "Claude and Qwen are not scored on the same programs". None of the extra argument presented in the rebuttal thereafter supports their (over)claim that "Qwen outperforms Claude".
  • The gap is a couple of points on one single run with no seeded reruns, so it is not strong evidence that entropy maximization drives downstream gains.
  • They admit the implementation differs from Section 3.1. Max-pooling also favors programs with many observations, since more values give more chances to hit a rare one. The paper still needs to be revised to state this.
  • They mention nothing about: weak specifications (a very important concern), statistical significance and seeds on VerusBench, the Opus like-for-like comparison, whether entropy predicts usefulness, and the inconsistencies (96 vs 154, “mrr” vs “msr”, “Figure ??”)

Based on the rebuttal, I'm even more convinced about my score (clear reject). Thank you!

Reviewer_txRQOpenReview ↗
Rating
2
Confidence
3
Informativeness
1
Presentation
2
Soundness
1
Read review
Paper summary

FORMAL DISCO uses three types of LLM workers (initial generation, error repair, and extension) to automatically synthesize verified programs under verifier feedback, and distills Claude 4.5 into Qwen2.5-Coder-32B for multi-round self-improvement to scale up; to counter diversity collapse, it proposes an entropy maximization principle over program features, filtering training samples by rarity (msr). Contributions: a language-agnostic generation system (Dafny/Verus/Frama-C) and an entropy-maximization diversity framework. Evaluation: worker success rates, entropy and complexity curves, component ablations, etc.

Critical strengths

Strengths: the verifier-in-the-loop design. The verifier's objective pass/fail signal makes distilled samples self-labeled and downstream data deterministically extractable, without reward models or human annotation,

Critical weaknesses

Overall, this is a data synthesis paper that is not quite up to standard in terms of novelty and engineering effort.

  1. The paper spends most of its space constructing an entropy theory and uses it to assess the quality of the synthesized data. However, there is no justification for the reliability of this entropy theory, nor any comparison with other data-quality evaluation methods; the reliability of the entropy theory remains to be investigated.
  2. In evaluating data quality, the paper trains separate models on the synthesized data and on other data sources and benchmarks them to judge data quality; however, the number of trained models is small and the models are outdated. I do not think this supports the conclusion that the synthesized data is of high quality.
Questions for authors
  1. What specific question is Section 4.1 intended to answer? The conclusion that SFT fine-tuning a student model on data filtered by a stronger model improves the success rate on specific tasks is fairly obvious; what new information does this section provide relative to existing work?
  2. Why does the training data not clearly improve the fixer? Could the authors provide an analysis of the underlying reasons? This would be an important way to assess data quality.
  3. The granularity of the ablation study is too coarse: comparing the three-worker framework directly against a single agent cannot isolate the roles of the fixer and the extender. Could the authors provide separate ablation results for the fixer and the extender?
  4. The models used in the paper (Claude 4.5 and Qwen2.5) are now somewhat outdated. Could the authors provide results on more recent models to validate the main conclusions?
1 comment

We thank the reviewer for the comments and suggestions! We respond to each of the questions below.

What specific question is Section 4.1 intended to answer? The conclusion that SFT fine-tuning a student model on data filtered by a stronger model improves the success rate on specific tasks is fairly obvious; what new information does this section provide relative to existing work?

The goal of the paper is to obtain a scalable method for generating new, diverse, correct synthetic verified programs. What we establish in Sections 4.1 and 4.2 is that our pipeline, after distillation from Claude and self-improvement iterations, works well with an open model – Section 4.1 shows that we can generate programs at scale with Qwen (with better yield than the initial Claude model after self-improvement), and 4.2 shows that they are diverse.

Why does the training data not clearly improve the fixer? Could the authors provide an analysis of the underlying reasons? This would be an important way to assess data quality.

The fixer does improve steadily in all 3 languages, albeit slower than for the other tasks, but Qwen ends up matching Claude at the end as a fixer worker in success rate (or outperforming, for Frama-C). The absolute improvement is indeed much smaller than the other tasks. However, we believe that is a reflection of the fact that the program distribution is also shifting towards more complex programs as the system runs. As the complexity metrics show (e.g., in Figure 3), the programs are increasing in diversity over time, so fixing them also becomes more challenging.

The granularity of the ablation study is too coarse: comparing the three-worker framework directly against a single agent cannot isolate the roles of the fixer and the extender. Could the authors provide separate ablation results for the fixer and the extender?

Thanks for this suggestion! We agree this is more informative than the full ablation we have. Thus, we ran separate ablations in Verus for the fixer and extender, with the same models we had already trained and the same budget, but now split across two agent types (initiator + one other agent type) rather than all three.

Removing the extender has the largest effect across the program features we measured: in particular, final programs become much smaller. For instance, median length (in lines of code) falls from 183 to 118 lines, and the 90th percentile falls from 388 to 149 lines. Other more semantic/complexity metrics also see a large drop: the median number of specification and proof annotations, for instance, goes from 22 to 13. Removing the fixer again results in smaller and simpler programs overall, since errors in the more complex programs now cause them to just be discarded. Median goes down to 131 lines, 17 annotations). In both ablations, nearly all complexity metrics shift downward, and the shifts are statistically significant (Mann–Whitney, p < 10⁻⁴; the only exception is the number of proof functions without the fixer, p ≈ 0.05). Diversity also drops: at a matched sample size, distinct logical annotation templates fall by about 25% (12.2k to 9.0k and 9.1k) and distinct loop structures from 18 to 11 (no extender) and 12 (no fixer). Thus, the full system therefore produces both larger and more varied programs than either ablation.

The models used in the paper (Claude 4.5 and Qwen2.5) are now somewhat outdated. Could the authors provide results on more recent models to validate the main conclusions?

Thanks for this suggestion as well! Re-running our experiments with Claude would have a prohibitive cost at this point, but we re-ran our downstream SFT experiments for the fixer on Dafny and Verus on three new models: Qwen 3.8 27B, Gemma 4 31B, and Mistral's Devstral-2 24B. The results are as follows:

BenchmarkModelPass@1Pass@16Pass@32
VerusBench (149)Qwen3.8-27B base12.138.349.7
Qwen3.8-27B SFT35.649.051.7
Devstral-2-24B base4.79.49.4
Devstral-2-24B SFT22.827.527.5
DafnyBench (554)Qwen3.8-27B base11.661.269.7
Qwen3.8-27B SFT37.054.959.0
Devstral-2-24B base1.87.010.3
Devstral-2-24B SFT21.526.927.8

Overall, we find our data generally still improves substantially (with the only exception of Qwen 3.8 for Dafny at higher Pass@K, since the newer base model seems good on Dafny already). Due to the time constraints, we have not tuned any hyperparameters here, reusing the exact same setting we had previously for Qwen 2.5 Coder, so the SFT results can likely be improved further with some tuning (especially Qwen 3.8). We will include these new results in the paper shortly.

We'd be glad to clarify further any additional questions the reviewer might have, and we'll post new results and updates to the paper as we have them.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.