SpecBridge: Learning Natural-Language Formalization Plans for the Formal Specification Synthesis Task
Wenjie Zhang, Yun Lin, Zining He, Meiqi Wu, Jin Song Dong
NeurIPS 2026
TL;DR. SpecBridge turns natural language programming requirements into Lean specifications using explicit intermediate plans and feedback from executable tests and proof checks, improving held-out results over direct few-shot prompting.
Abstract. Software requirements are usually written in natural language, which is essential for human communication but insufficient as a target for machine-checked correctness. While natural-language descriptions can state intended functionality, verification requires formal specifications with explicit types, relations, quantifiers, guards, witnesses, and edge cases. To bridge this divide, we study the Formal Specification Synthesis task: given a natural-language programming requirement and fixed formal signatures, synthesize a proof-assistant specification for the intended input-output relation. This task is difficult for two primary reasons. First, a large representation gap separates informal natural language from the rigorous structures needed by a proof assistant. Second, generated formal specifications are notoriously hard to evaluate, as proving full equivalence between specifications is often too complex to serve as routine feedback. To address these intertwined challenges, we propose SpecBridge, a reconstruction-guided formalization framework. At its core, SpecBridge introduces a Natural-Language Formalization Plan (NLFP), a semi-structured, readable intermediate representation that captures key formalization choices before decoding to a target specification language. Through reconstruction-guided pattern mining, SpecBridge learns these NLFPs by reconstructing formal specifications to discover reusable patterns, ultimately transferring them to improve natural-language task generation. Furthermore, to tackle the evaluation bottleneck, we introduce a multi-layer evaluation protocol for formal-specification correctness. This protocol utilizes LLM Specification Alignment as an LLM-based judge, alongside Validation Feedback and Verification Feedback, which approximate "running" testcases on formal specifications by translating propositions into executable pre/post checks and proving testcase obligations in Lean. In our experiments, SpecBridge outperforms the few-shot + CoT baseline by 6.1, 15.2, and 28.4 percentage points on LLM Specification Alignment, Computable Validation Pass Rate, and Proof Validation Pass Rate, respectively. These results show improved specification quality under our evaluation protocol.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 3 reviews · OpenReview
Updated 25 Nov 2026, 03:49 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
The paper presents SpecBridge, a framework for synthesizing Lean formal specifications from natural-language programming requirements. The key idea is to introduce the Natural-Language Formalization Plan (NLFP), an intermediate representation that captures formalization choices (relation shape, guards, collection semantics) before code generation. NLFP schemas are learned via a reconstruction-based auto-encoding stage and transferred to natural-language input, with prompts refined against a multi-layer evaluation protocol based on LLM-as-a-judge and test cases. The experimental evaluation uses the CLEVER benchmark (161 problems). SpecBridge improves over a few-shot CoT baseline by 6.1% on alignment, 15.2% on computable validation, and 28.4% on proof validation, consistently across three LLM backends.
All three reviewers view the problem, i.e., faithful formalization of natural-language requirements, as important and a real bottleneck for verified code generation (23gd, uP5N, WZ3N). The NLFP intermediate representation is seen as reasonable, interpretable, and potentially generalizable beyond Lean (23gd, uP5N); the multi-layer evaluation protocol is appreciated (uP5N, WZ3N); and gains are strong and consistent across metrics and backends, with ablations that isolate component contributions (WZ3N).
For the paper to be strongly considered, please focus on the following prioritized questions:
- Baseline isolation of the NLFP contribution (all three reviewers; the key issue). Comparing only against few-shot + CoT leaves open whether gains come from NLFP specifically or from generic decomposition/refinement. Please provide at least one or two stronger baselines under the same budget, e.g., iterative self-refinement/reflection without the NLFP representation, or a Plan-and-Solve/Self-Planning-style decomposition or, failing that, a compelling analysis of why the existing ablations already isolate the NLFP effect.
- Clarity of the learning algorithm (uP5N questions). The roles of E_theta and G_psi, whether refinement is per-sample or batched, and the dependency between the two prompt-refinement steps are unclear. Please clarify what a learned schema concretely looks like and how a synthesized NLFP is validated against it.
- Generalization beyond CLEVER (uP5N, WZ3N, 23gd). Are learned schemas CLEVER-specific, or transferable to other programs of comparable complexity (or across LLMs — e.g., learn schemas with a strong model, deploy with a cheaper one)? Some preliminary cross-dataset or cross-model evidence, plus a candid discussion of scope (single-function, pure I/O specs vs. state, loops, concurrency), would help.
- Evaluation circularity (WZ3N). The Python checks and Lean proof scripts used for feedback and evaluation are themselves LLM-generated. Please bound or estimate how often translation errors could inflate pass rates, beyond the single XOR case discussed.
- Failure-mode analysis (uP5N). A characterization of where and how the technique systematically fails on CLEVER would round out the evaluation.
Guidance for the author response: I would explicitly de-prioritize solving the inherent NL-ambiguity problem (23gd's second weakness): the semantic gap between informal and formal statements is a field-level limitation, and I ask only for a thoughtful discussion of how ambiguity is handled, not a solution. Concerns not listed above need not be the focus of the authors' response.
Final justification
All reviewers become positive about this work following the authors' responses. The questions summarized in the initial meta-review have been properly addressed. Furthermore, Reviewer uP5N, who had raised several concerns earlier, confirmed their concerns have been largely resolved.
Read meta-review
Meta-review
The paper presents SpecBridge, a framework for synthesizing Lean formal specifications from natural-language programming requirements. The key idea is to introduce the Natural-Language Formalization Plan (NLFP), an intermediate representation that captures formalization choices (relation shape, guards, collection semantics) before code generation. NLFP schemas are learned via a reconstruction-based auto-encoding stage and transferred to natural-language input, with prompts refined against a multi-layer evaluation protocol based on LLM-as-a-judge and test cases. The experimental evaluation uses the CLEVER benchmark (161 problems). SpecBridge improves over a few-shot CoT baseline by 6.1% on alignment, 15.2% on computable validation, and 28.4% on proof validation, consistently across three LLM backends.
All three reviewers view the problem, i.e., faithful formalization of natural-language requirements, as important and a real bottleneck for verified code generation (23gd, uP5N, WZ3N). The NLFP intermediate representation is seen as reasonable, interpretable, and potentially generalizable beyond Lean (23gd, uP5N); the multi-layer evaluation protocol is appreciated (uP5N, WZ3N); and gains are strong and consistent across metrics and backends, with ablations that isolate component contributions (WZ3N).
For the paper to be strongly considered, please focus on the following prioritized questions:
- Baseline isolation of the NLFP contribution (all three reviewers; the key issue). Comparing only against few-shot + CoT leaves open whether gains come from NLFP specifically or from generic decomposition/refinement. Please provide at least one or two stronger baselines under the same budget, e.g., iterative self-refinement/reflection without the NLFP representation, or a Plan-and-Solve/Self-Planning-style decomposition or, failing that, a compelling analysis of why the existing ablations already isolate the NLFP effect.
- Clarity of the learning algorithm (uP5N questions). The roles of E_theta and G_psi, whether refinement is per-sample or batched, and the dependency between the two prompt-refinement steps are unclear. Please clarify what a learned schema concretely looks like and how a synthesized NLFP is validated against it.
- Generalization beyond CLEVER (uP5N, WZ3N, 23gd). Are learned schemas CLEVER-specific, or transferable to other programs of comparable complexity (or across LLMs — e.g., learn schemas with a strong model, deploy with a cheaper one)? Some preliminary cross-dataset or cross-model evidence, plus a candid discussion of scope (single-function, pure I/O specs vs. state, loops, concurrency), would help.
- Evaluation circularity (WZ3N). The Python checks and Lean proof scripts used for feedback and evaluation are themselves LLM-generated. Please bound or estimate how often translation errors could inflate pass rates, beyond the single XOR case discussed.
- Failure-mode analysis (uP5N). A characterization of where and how the technique systematically fails on CLEVER would round out the evaluation.
Guidance for the author response: I would explicitly de-prioritize solving the inherent NL-ambiguity problem (23gd's second weakness): the semantic gap between informal and formal statements is a field-level limitation, and I ask only for a thoughtful discussion of how ambiguity is handled, not a solution. Concerns not listed above need not be the focus of the authors' response.
Final justification
All reviewers become positive about this work following the authors' responses. The questions summarized in the initial meta-review have been properly addressed. Furthermore, Reviewer uP5N, who had raised several concerns earlier, confirmed their concerns have been largely resolved.
2 comments
This comment continues our response to the shared and prioritized concerns. Following our discussion of ambiguity in the preceding comment, we address the remaining concerns below.
1. Baseline isolation of the NLFP contribution
We added four controlled baselines using the same GPT-5.4 backend, testcase artifacts, Lean environment, and evaluation pipeline.
| Method | Alignment | Computable | Proof |
|---|---|---|---|
| Few-shot + CoT | 0.61 | 0.76 | 0.58 |
| Free-form Plan-then-Spec | 0.65 | 0.85 | 0.76 |
| Best-of-5 Validation Reranking | 0.60 | 0.83 | 0.50 |
| Direct Lean Feedback Refinement | 0.54 | 0.85 | 0.80 |
| NLFP without Forward Feedback | 0.52 | 0.78 | 0.43 |
| SpecBridge | 0.65 | 0.90 | 0.89 |
These baselines control for generic planning, sampling, feedback without NLFPs, and NLFP learning without forward refinement. Free-form planning confirms that decomposition helps; Direct Lean Feedback improves certifiability but not Alignment; Best-of-5 shows that sampling alone is insufficient; and NLFP without Forward Feedback shows that NLFP alone is insufficient. We therefore attribute the gains to combining reconstruction-guided NLFP learning with forward validation feedback.
2. Clarity of the learning algorithm
SpecBridge uses iterative prompt refinement, not gradient-based training. Reconstruction failures refine and ; the resulting guidance is transferred to , while forward semantic, computable, and proof feedback further refine and .
The learned “schema” is prompt-encoded guidance, not a runtime object. At deployment, only and are used. We will revise Figure 2 and add pseudocode.
3. Generalization beyond CLEVER
We added preliminary cross-dataset and cross-model transfer experiments. Frozen CLEVER-trained prompts improve Alignment/Computable/Proof on a compatible VERINA subset from 0.56/0.61/0.83 to 0.89/0.74/0.94. GPT-5.4-refined prompts also transfer to DeepSeek-v3.2, improving over DeepSeek-refined prompts from 0.424/0.910/0.688 to 0.580/0.910/0.780.
These results suggest that the guidance is not specific to one dataset or backend. We will report subset details and limit the claim to pure, single-function input-output specifications.
4. Evaluation separation and evaluator reliability
We use 5-fold cross-validation, refining prompts only on training folds and freezing them before held-out evaluation, preventing train-test feedback leakage.
We also added three evaluator-fidelity checks. Full Consistency, requiring executable validation, Lean compilation, and Lean proof to agree, is 0.45/0.70/0.74 for Few-shot + CoT, Direct Lean Feedback, and SpecBridge. Auditing 16 successful SpecBridge artifacts found faithful Python translations, testcase polarities, and Lean obligations in all cases; 15/16 were semantically correct, while the remaining case had an untested specification error rather than an evaluator error. Increasing positive and negative testcases from 10 to 100 reduced Proof from 0.89 to 0.85.
5. Failure-mode analysis
We analyzed 10 randomly sampled failures. The dominant categories were guard/precondition scope (3) and semantic underconstraint (3), followed by collection/ordering mismatch, overconstraint, Lean-specific helper/type mismatch, and other errors.
- Rating
- 4/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
SpecBridge is a framework for synthesizing Lean formal specifications from natural-language programming requirements. It introduces the Natural-Language Formalization Plan (NLFP), an intermediate representation that explicitly captures formalization choices—like relation shape, guards, and collection semantics—before final code generation, learned via a reconstruction-based auto-encoding stage that's then transferred to natural-language input. To evaluate specifications without relying on full equivalence proofs, the authors propose a multi-layer protocol combining LLM-based semantic judgment, executable Python pre/post-condition checks, and Lean-based proof validation on test cases. On the CLEVER benchmark, SpecBridge improves over a few-shot chain-of-thought baseline by 6.1% on specification alignment, 15.2% on computable validation pass rate, and 28.4% on proof validation pass rate, with consistent gains across multiple LLM backends.
Strengths and weaknesses
Strengths:
- Multi-layer evaluation (LLM judge + executable checks + Lean proof validation)
- Strong, consistent gains across all three metrics and across three different LLM backends
- Ablations clearly isolate which component drives which improvement
Weaknesses:
- Evaluated on only one benchmark (CLEVER), limited to small, single-function, pure I/O specs
- Evaluation partly relies on LLM-generated Python/Lean artifacts, raising some circularity concerns
- Only one baseline (few-shot + CoT); unclear if simpler refinement methods could achieve similar gains
Questions
-
Have you evaluated SpecBridge on any benchmarks beyond CLEVER, or do you have evidence (even preliminary) suggesting the NLFP approach would transfer to multi-function APIs or specifications involving state/mutation?
-
Since the Python pre/post-condition checks and Lean proof scripts used for feedback and evaluation are themselves LLM-generated, how do you bound or estimate the rate at which these translation errors could inflate reported pass rates (beyond the single XOR case discussed)?
-
Did you test simpler baselines beyond few-shot + CoT—for example, iterative self-refinement or reflection without the NLFP intermediate representation—to isolate how much of the improvement is specifically attributable to the NLFP structure versus the general benefit of iterative prompt refinement?
Limitations
See weaknesses and questions.
Final justification
The rebuttal addressed most of my concerns. I will maintain my score.
Formatting concerns
N/A
2 comments
Rebuttal
We are truly grateful for the reviewer's encouraging assessment of our multi-layer evaluation and consistent gains across LLM backends. Their thoughtful concerns directly motivated our new cross-dataset transfer experiment, stronger controlled baselines, and systematic evaluator-reliability analysis.
Q1. Does SpecBridge generalize beyond CLEVER to richer specification settings?
We added a preliminary cross-dataset transfer experiment on a compatible subset of VERINA. The SpecBridge prompts are refined using only CLEVER examples and frozen before evaluation on VERINA. No VERINA reference specification or validation feedback is used for additional prompt refinement.
| Method | LLM Spec. Alignment | Computable Pass Rate | Proof Pass Rate |
|---|---|---|---|
| Few-shot + CoT | 0.56 | 0.61 | 0.83 |
| SpecBridge, CLEVER VERINA transfer | 0.89 | 0.74 | 0.94 |
The transferred guidance improves all three metrics on the target subset. Because both methods use the same model on the same tasks, these differences measure the benefit of reusing guidance learned from CLEVER rather than a difference in inference backend.
We will report the exact task count, inclusion and exclusion criteria, interface normalization, and all denominators for the compatible VERINA subset in the revised paper.
We interpret these results as preliminary transfer evidence within SpecBridge’s requirement-centered setting. Further evaluation is limited by the scarcity of comparable benchmarks, as many Dafny- or ACSL/C-based datasets instead follow an implementation-centered route; supporting richer behaviors such as global state, I/O, heaps, concurrency, and multi-function interactions within our setting is future work.
Q2. Could LLM-generated Python and Lean evaluation artifacts inflate the reported pass rates?
We agree that Lean kernel checking alone does not guarantee that an LLM-generated evaluator faithfully represents the natural-language requirement. A proof certifies the constructed Lean proposition, but the proposition, testcase polarity, or executable translation may itself be incorrect. We therefore examine this risk through shared controls, cross-channel consistency, a manual audit of successful artifacts, testcase-budget sensitivity, and task-level failure analysis.
Shared evaluation controls
All methods use the same testcase inputs, canonical outputs, corruption procedures, evaluator prompts, Lean environment, and proof settings. This ensures controlled comparison across methods, although it cannot rule out a systematic error shared by all methods.
Full Consistency
We report Full Consistency, which requires the executable checker to return the expected result, the corresponding Lean obligation to compile, and Lean to prove the expected positive or negative proposition.
| Method | Full Consistency |
|---|---|
| Few-shot + CoT | 0.45 |
| Direct Lean Feedback Refinement | 0.70 |
| SpecBridge | 0.74 |
This conjunction prevents a permissive Python checker alone, or an isolated successful proof artifact alone, from determining success. It still cannot eliminate correlated errors shared by both translations, so we treat it as stronger combined evidence rather than proof of semantic equivalence.
Manual audit of successful artifacts
We manually audited 16 successful SpecBridge artifacts drawn from 16 distinct CLEVER problems. All 16 faithfully translated the generated specification into Python, used the correct testcase polarity, and constructed the intended Lean obligation; 15/16 were also semantically consistent with the task. The remaining artifact faithfully evaluated the candidate on the inspected testcase but the candidate itself contained an untested boundary-case defect. Thus, the audit found no translation-induced false pass, while also illustrating that successful sampled evaluation cannot establish universal correctness.
Testcase-budget sensitivity
Keeping the generated specifications fixed, we increased the evaluation budget from 10 positive and 10 negative cases to 100 positive and 100 negative cases per problem. The aggregate proof-obligation pass rate changes only slightly, from 0.89 to 0.85. This tenfold increase reveals additional failures but does not materially change the aggregate result. It remains sampled evidence rather than proof of full equivalence.
Task-level failure analysis
We also randomly sampled 10 failed CLEVER tasks and classified the primary semantic error in each generated specification.
| Task-level specification failure type | Count |
|---|---|
| Collection, multiplicity, or ordering mismatch | 1 |
| Incorrect guard or precondition scope | 3 |
| Semantic underconstraint | 3 |
| Semantic overconstraint | 1 |
| Lean-specific type or helper mismatch | 1 |
| Other | 1 |
The most common errors involve guard scope and semantic underconstraint. Examples include placing parsing conditions inside an existentially quantified implication, which permits a vacuously true relation, and replacing the predicate connecting a parsed value to the input withTrue, which permits outputs unrelated to the input. Other cases mishandle empty tokens, introduce synthetic helper values, or strengthen approximate numerical requirements to exact equality.
Together, these analyses directly assess evaluator translation errors, cross-channel agreement, sampled-coverage sensitivity, and semantic generation failures, while making clear that none alone proves equivalence to the natural-language requirement.
Q3. How much of SpecBridge’s improvement comes from NLFP rather than generic refinement?
We added controlled baselines covering additional sampling, unstructured planning, direct specification-level refinement, and NLFP generation without forward feedback. All results below use the same CLEVER evaluation subset, GPT-5.4 backend, testcase artifacts, Lean environment, and evaluation implementation.
| Method | LLM Spec. Alignment | Computable Pass Rate | Proof Pass Rate |
|---|---|---|---|
| Few-shot + CoT | 0.61 | 0.76 | 0.58 |
| Best-of-5 Validation Reranking | 0.60 | 0.83 | 0.50 |
| Free-form Plan-then-Spec | 0.65 | 0.85 | 0.76 |
| Direct Lean Feedback Refinement | 0.54 | 0.85 | 0.80 |
| NLFP without Forward Feedback | 0.52 | 0.78 | 0.43 |
| SpecBridge | 0.65 | 0.90 | 0.89 |
These baselines isolate several alternative explanations. Best-of-5 Validation Reranking tests whether additional sampling and validation-based selection are sufficient. Free-form Plan-then-Spec tests generic decomposition without learned NLFP guidance. Direct Lean Feedback Refinement tests downstream refinement without reconstruction-guided planning. NLFP without Forward Feedback tests whether reconstruction-guided planning alone is sufficient without adapting the forward-generation path.
Generic planning and direct feedback refinement both improve over Few-shot + CoT, but SpecBridge achieves the highest Computable and Proof Pass Rates and ties Free-form Plan-then-Spec for the highest Alignment. The weak result without forward feedback also shows that the intermediate representation alone is insufficient. The evidence supports the combination of reconstruction-guided prompt learning, semi-structured NLFP generation, target-language decoding, and downstream specification-level feedback.
Thank you for addressing most of my concerns. I will maintain my score.
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 4/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
The authors present SpecBridge, a novel technique to synthesize specifications for code given a natural language description of the task. They introduce an intermediate representation called NLFP, and use prompt refinement techniques to find the ideal prompt to learn the correct NLFP schema given a training dataset, which can then be used at deployment time to synthesize LEAN specs. The authors evaluate this technique against CoT prompting and show significant improvements.
Strengths and weaknesses
Strengths
- The paper tackles an important problem, which is how to encode natural language specification in a formal language. The contribution is strong and has a potential to form a framework that can be generalized across target formal specification languages beyond simply LEAN.
- The paper also proposes a fine-grained evaluation technique that evaluates both the semantic alignment of the synthesized specification, as well as whether the specification compiles and is syntactically valid, and trains the prompts based on all 5 metrics.
Weaknesses
-
The learning algorithm is a bit unclear. I don't fully understand multiple aspects, such as where does E_theta factor in, is this done sample-by-sample or over a batch of samples, are both E_theta and G_psi refined in the same step or is there a dependency between the prompts, etc. Ideally you would have an explicit algorithm in the main body of the paper defining the individual steps.
-
As for evaluation, while the metrics are much appreciated, it would be nice to contrast them with the traditional metrics used to evaluate formal specification synthesis tools. Also the evaluation is lacking a comparison with other autoformalization techniques: simply comparing against CoT is a bit weak for a thorough evaluation and doesn't let me understand how impactful these results are in the space of synthesis techniques.
-
I would also appreciate an evaluation or a discussion about how generalizable the synthesized NLFP schemas are to the CLEVER dataset. In short, can I expect to train over CLEVER and then deploy the generation side of the technique on arbitrary programs of equivalent complexity? Or are the schemas learned only useful over CLEVER? Ideally this would involve another autoformalization dataset, and learning the schemas over CLEVER and generating specs over the second dataset.
-
I would like a thorough discussion of the failure modes of your technique. Is there a systemic way your technique fails, or are there patterns across the tasks in CLEVER that the technique failed to synthesize?
If the authors can clarify these concerns, I will be glad to bump my score up to 5.
Questions
-
How are the individual NLFPs abstracted into general schemas? What does a schema even look like? How do you validate a synthesized NLFP given the schema?
-
Figure 2 makes it seem like E_theta and G_psi both generate the NLFP. Shouldn't the learned schema from E_theta be input into G_psi?
-
Can we use the learned schemas across LLMs? For example, use a powerful model like GPT 5 to learn the schemas, but then use a cheaper model to synthesize the specs at inference time?
Limitations
Yes.
Final justification
The authors addressed most of my concerns, so I have adjusted my score accordingly.
Formatting concerns
None
3 comments
Rebuttal
We are sincerely grateful for the reviewer's encouraging assessment of SpecBridge's broader potential and fine-grained evaluation. Their detailed questions helped us clarify the learning algorithm and motivated new analyses of stronger baselines, transferability, and failure modes. Given the response-length limit, we present the key findings below and will include the full algorithmic details and expanded analyses in the revised paper and appendix.
Q1. How are individual NLFPs abstracted into general schemas, and how are they validated?
SpecBridge learns prompts governing NLFP extraction, generation, and decoding, rather than a fixed schema object or individual NLFP instances. These prompts encode reusable guidance about which formalization decisions should be explicit and preserved in Lean.
The Formal Encoder converts reference Lean specifications into task-specific NLFPs, and the Formal Decoder reconstructs Lean from them. An LLM analyzes recurring reconstruction and forward-generation failures, such as omitted guards, incorrect collection semantics, or information lost during decoding, and refines the prompts of , the NLFP Generator , and .
An NLFP is a semi-structured natural-language plan covering task interpretation, the input-output relation, and Lean representations such as types, binders, predicates, and witnesses. Refinement can add guidance for recurring issues including multiplicity, ordering, guard scope, and collection semantics.
NLFPs are validated through their decoded Lean specifications using type checking, semantic alignment, executable testcases, and positive and negative proof obligations. Errors in the NLFP should therefore surface downstream and guide later refinement.
Q2. Should the learned schema from be an input to ?
During training, reconstruction and forward-generation failures jointly refine , , and . Guidance discovered through , such as which relations, guards, collection semantics, and Lean representations must be explicit, is incorporated into the prompt of .
At inference time, generates a task-specific NLFP from the requirement and signature, and decodes it into Lean. Thus, influences through training-time prompt refinement, not an additional runtime object. We will revise Figure 2 accordingly.
Q3. Can the learned guidance be reused across LLMs?
Yes. We compared DeepSeek-v3.2 under three settings: Few-shot + CoT; SpecBridge with DeepSeek-refined prompts; and SpecBridge using GPT-5.4-refined prompts.
Their Alignment/Computable/Proof scores are 0.242/0.782/0.667, 0.424/0.910/0.688, and 0.580/0.910/0.780, respectively. Transferring GPT-5.4-refined prompts therefore improves Alignment from 0.424 to 0.580 and Proof from 0.688 to 0.780 over DeepSeek's self-refined prompts, while preserving Computable performance.
This is prompt transfer, not parameter transfer or distillation. The transferred prompts encode reusable guidance about relation structure, guards, collection semantics, witnesses, and Lean-specific choices, providing preliminary evidence that the guidance is not model-specific.
C1. How does the SpecBridge learning algorithm work?
SpecBridge performs iterative prompt refinement, not gradient-based training: (1) extracts NLFPs from reference Lean specifications and reconstructs them; recurring reconstruction failures refine the encoder and decoder prompts. (2) The resulting formalization guidance is transferred into the prompt of . (3) and generate Lean specifications from natural-language tasks, and semantic, computable, and proof feedback refines the generator and decoder prompts. This process runs for five rounds.
Examples are generated independently, while failures are aggregated before each round-level update. The refinement LLM attributes errors to missing NLFP information, incorrect natural-language interpretation, or decoding loss, and edits the corresponding prompts. For example, repeatedly omitted guards revise encoder or generator instructions, while constraints present in an NLFP but absent from Lean revise the decoder. At deployment, only and are used, with requirement and signature as inputs (no references, programs, or testcases). We drafted step-by-step pseudocode for Section 3 and will revise Figure 2.
C2. How does SpecBridge compare with stronger decomposition and refinement baselines?
We added new baselines to isolate contributions of each components.
| Method | Alignment | Computable | Proof |
|---|---|---|---|
| Few-shot + CoT | 0.61 | 0.76 | 0.58 |
| Best-of-5 Reranking | 0.60 | 0.83 | 0.50 |
| Free-form Plan-then-Spec | 0.65 | 0.85 | 0.76 |
| Direct Lean Feedback | 0.54 | 0.85 | 0.80 |
| NLFP without Forward Feedback | 0.52 | 0.78 | 0.43 |
| SpecBridge | 0.65 | 0.90 | 0.89 |
These baselines respectively control for additional sampling, generic planning, feedback without NLFPs, and NLFP learning without forward refinement.
Free-form planning ties SpecBridge on Alignment but is lower on Computable and Proof performance, suggesting that decomposition helps but free-form plans preserve formalization choices less reliably. Direct Lean Feedback improves Proof but has lower Alignment, indicating that local repair may improve certifiability without correcting semantic interpretation. Best-of-5 shows that sampling alone cannot explain the gains, while NLFP without Forward Feedback shows that the representation alone is insufficient.
The results therefore support the complete design: reconstruction-guided NLFP learning and forward validation feedback are complementary.
C3. How does SpecBridge relate to existing autoformalization systems?
We will distinguish three related settings.
Natural-language contract synthesis, including NL2Postcond and NL2Contract, is closest in task interface: it translates requirements and signatures into formal constraints without implementation access. SpecBridge differs by learning reusable prompt guidance through reconstruction, representing task-specific decisions in NLFPs, and targeting Lean relations.
Structured autoformalization uses plans, sketches, grammars, or intermediate representations. Unlike structures predefined or generated only for one task, SpecBridge learns shared guidance from reconstruction and validation failures and reuses it across unseen tasks.
Implementation-centered specification inference, including AutoSpec and SpecGen, uses code, traces, static analysis, mutations, or verifier feedback. SpecBridge instead receives only the requirement and signature at deployment.
Because these settings differ in inputs, target languages, benchmarks, and evaluators, their published scores are not directly comparable. We therefore compare them conceptually and use controlled baselines for direct experimental attribution.
C4. How do the proposed metrics relate to conventional specification-synthesis metrics?
For Few-shot + CoT versus SpecBridge, Initial Type-Check is 0.61/0.61, Repaired Type-Check 0.94/0.97, Positive Acceptance 0.76/0.85, proved Negative Rejection 0.16/0.53, and Exact Match 0.00/0.00.
Type checking measures formal validity. Positive Acceptance and Negative Rejection jointly measure behavioral discrimination, since an under-constrained specification may accept both correct and corrupted outputs. Negative Rejection counts corrupted outputs for which Lean proves non-satisfaction; an unproved obligation does not necessarily indicate acceptance.
Exact Match is only a surface diagnostic because equivalent Lean specifications may differ syntactically. Our primary metrics instead measure semantic alignment, sampled executable behavior, and concrete Lean proof obligations.
Other metrics are redundant or unsuitable here: FNR complements Positive Acceptance; task-level soundness/completeness aggregate the same sampled outcomes; Mutation Score usually concerns mutated implementations; Verified Program Rate requires complete programs and verification conditions; and clause precision/recall requires equivalence-aware clause annotations.
C5. Does the learned guidance generalize beyond CLEVER?
We refined prompts only on CLEVER, froze them, and evaluated them on a compatible VERINA subset without using VERINA references or validation feedback. SpecBridge improves Alignment/Computable/Proof from 0.56/0.61/0.83 to 0.89/0.74/0.94, providing preliminary evidence of cross-dataset transfer.
Further evaluation is limited by the scarcity of comparable benchmarks. CLEVER and the compatible VERINA tasks follow the requirement-centered setting of synthesizing specifications from natural-language requirements and signatures, whereas many Dafny- or ACSL/C-based benchmarks follow an implementation-centered route. Supporting richer behaviors such as global state, I/O, heaps, concurrency, and multi-function interactions within our setting is future work.
C6. What are the main failure modes of SpecBridge?
Among 10 randomly sampled failed CLEVER instances, the primary errors were guard/precondition scope (3), semantic underconstraint (3), collection/multiplicity/ordering (1), overconstraint (1), Lean-specific helper/type mismatch (1), and other (1).
Guard-scope errors place conditions under the wrong logical construct, sometimes allowing an implication to hold vacuously. Underconstraint omits an input-output dependency or boundary condition, such as disconnecting a parsed value from the input or leaving an empty-input result unrestricted. Other cases treated empty delimiter fragments as elements, initialized folds with values absent from the input, or replaced approximate conditions with exact equality.
Action requried
Dear Reviewer,
Please confirm that you have read the authors’ rebuttal. We also ask that you explicitly indicate whether your original concerns have been addressed and, if not, describe any remaining concerns or questions you would like the authors and Area Chair to consider.
Thank you for your time and thoughtful participation in the review process.
Thank you again for your thoughtful and constructive feedback, which help improve our work indeed! We have sought to address your questions in our rebuttal with our best. We would be grateful for and look forward to any remaining questions, comments, or suggestions!
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 2/4
- Originality
- 2/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
To research natural-language-to-Lean formal specification synthesis, this paper proposes SPECBRIDGE, a prompt-based framework that first generates a natural-language formalization plan and then decodes it into a Lean specification. The system is refined through structured feedback and evaluated on CLEVER using LLM-based alignment, executable Python validation, and Lean testcase proof validation.
Strengths and weaknesses
Strength
- The problem is interesting. I do believe that generating faithful formal specifications is a real bottleneck for verified code generation.
- The intermediate formalization plan is a reasonable and interpretable design does make sense.
Weakness
- The baseline is too limited. Comparing only against Few-shot + CoT does not show whether the gains come from NLFP specifically, rather than generic decomposition/refinement methods such as Plan-and-Solve, Least-to-Most Prompting, Self-Planning Code Generation, CodePlan, Draft-Sketch-and-Prove, or simple validation-based best-of-N reranking.
- The core semantic gap between formal / informal languages remains unresolved. A generated Lean specification may be syntactically valid and pass tests, but still fail to capture the intended meaning of an ambiguous natural-language requirement, i.e., they are not exactly equivalent.
- The demonstrated scope is narrow. The paper focuses on small, single-function, pure input-output specifications; it does not show scalability to loop invariants, mutable state, heap reasoning, concurrency, I/O, or multi-function protocols.
Questions
- How does the method compare with stronger generic decomposition/refinement baselines?
- How does the system handle genuinely ambiguous natural-language requirements?
Limitations
yes
Formatting concerns
no
2 comments
Rebuttal
We are truly grateful for the reviewer's recognition of faithful formal-specification synthesis as an important bottleneck and of NLFP as a reasonable and interpretable design. Their constructive comments prompted us to strengthen the baseline comparisons and more clearly discuss ambiguity, scope, and generalization.
Q1. How does SpecBridge compare with stronger generic decomposition and refinement baselines?
To isolate the sources of improvement, we added four controlled baselines:
- Free-form Plan-then-Spec: generates an unconstrained natural-language plan before Lean generation.
- Best-of-5 Validation Reranking: samples five direct Lean specifications and selects one using SpecBridge's validation signals.
- Direct Lean Feedback Refinement: applies the same computable and proof feedback directly to Lean, without NLFPs.
- NLFP without Forward Feedback: retains reconstruction-guided NLFP generation but removes forward validation refinement.
All methods use the same CLEVER subset, GPT-5.4 backend, testcase artifacts, Lean environment, and evaluation pipeline.
| Method | LLM Spec. Alignment | Computable Pass Rate | Proof Pass Rate |
|---|---|---|---|
| Few-shot + CoT | 0.61 | 0.76 | 0.58 |
| Free-form Plan-then-Spec | 0.65 | 0.85 | 0.76 |
| Best-of-5 Validation Reranking | 0.60 | 0.83 | 0.50 |
| Direct Lean Feedback Refinement | 0.54 | 0.85 | 0.80 |
| NLFP without Forward Feedback | 0.52 | 0.78 | 0.43 |
| SpecBridge | 0.65 | 0.90 | 0.89 |
Generic planning and feedback refinement explain part of SpecBridge's improvement. Free-form Plan-then-Spec is the strongest baseline, tying SpecBridge on Alignment, which confirms that decomposing the requirement before Lean generation is useful. Its lower Computable and Proof Pass Rates, however, suggest that free-form plans preserve formalization decisions less reliably than reconstruction-guided NLFPs.
Direct Lean Feedback Refinement achieves the second-highest Proof Pass Rate, confirming the value of validation feedback, but its lower Alignment indicates that local Lean repair may improve certifiability without correcting semantic interpretation. Best-of-5 Validation Reranking mainly improves computable validation, showing that additional sampling alone does not explain the gains. NLFP without Forward Feedback performs substantially worse, indicating that structured planning is insufficient without validation-guided refinement. SpecBridge performs best by combining both components.
The broader literature spans four related settings:
- natural-language translation into temporal logics such as LTL;
- natural-language generation of function-level contracts or postconditions;
- implementation-centered inference of invariants, contracts, or annotations from code, traces, static analysis, or verifier feedback;
- program or proof generation given an already specified target.
SpecBridge belongs primarily to the second setting: it derives a function-level formal relation from a natural-language requirement and fixed signature. Unlike implementation-centered methods, it does not receive the implementation at inference time; unlike verified-program generation, it must construct rather than assume the specification.
NL2Postcond and NL2Contract are therefore the closest prior systems. Although their target languages and verification pipelines differ, their generation components follow the same broad paradigm of translating natural-language intent into formal constraints. Our Few-shot + CoT baseline instantiates this direct-generation paradigm in Lean with demonstrations and explicit reasoning guidance. It is intended as a controlled baseline for the core generation setting, not an exact reproduction of their language-specific encodings. The added baselines further control for generic planning, additional sampling, and feedback refinement.
We therefore do not claim that an intermediate representation alone provides an independent additive gain. The results instead support the complete design: reconstruction-guided NLFPs and forward validation feedback play complementary roles.
Q2. How does the system handle genuinely ambiguous natural-language requirements?
SpecBridge assumes that the natural-language requirement, fixed signature, and benchmark context jointly support a benchmark-consistent interpretation.
Reconstruction can recover recurring but implicit formalization choices reflected in training specifications, including multiplicity, ordering, guard scope, and witness structure. NLFPs make these choices explicit before Lean generation.
When multiple interpretations remain equally plausible, however, SpecBridge cannot determine the user's unstated intent. For example, "return the characters shared by two strings" may refer to set intersection, multiset intersection, or an order-preserving relation. NLFPs expose the selected interpretation but cannot guarantee that it is intended.
A natural extension is to generate multiple candidate NLFPs, expose their differing assumptions, and request clarification. We will state this assumption and limitation explicitly.
C1. Does testcase success establish specification equivalence?
We agree that syntactic validity and testcase success do not establish semantic equivalence to the intended requirement or logical equivalence to a reference specification.
Our three evaluation channels provide complementary evidence:
- LLM Specification Alignment estimates high-level semantic agreement;
- Computable Validation checks sampled behaviors through executable pre/postconditions;
- Proof Validation provides Lean-kernel-checked evidence for the concrete positive and negative obligations that are proved.
We therefore treat testcase validation as a practical proxy, not a proof of universal equivalence.
To assess this proxy, we manually audited 16 successful SpecBridge artifacts from 16 distinct CLEVER problems. All 16 had faithful Python translations, correct testcase polarity, and faithful Lean obligations; 15/16 were semantically consistent with the task. The remaining artifact passed the sampled checks but failed on an untested boundary case, directly illustrating the limitation of testcase-based evidence.
We also increased the fixed budget from 10 to 100 positive and 100 negative cases per problem while keeping generated specifications unchanged. The aggregate proof-obligation pass rate changed from 0.89 to 0.85, suggesting reasonable stability under broader sampled coverage. Nevertheless, both analyses remain sampled evidence, and we will revise the paper to avoid implying full specification equivalence.
C2. Could errors in LLM-generated evaluation artifacts inflate the reported results?
We further examine whether errors in the generated Python or Lean evaluators could inflate the reported results.
First, we report Full Consistency, where a testcase succeeds only if:
- the executable checker returns the expected result;
- the corresponding Lean obligation compiles; and
- Lean proves the expected positive or negative proposition.
| Method | Full Consistency |
|---|---|
| Few-shot + CoT | 0.45 |
| Direct Lean Feedback Refinement | 0.70 |
| SpecBridge | 0.74 |
This conjunction reduces the risk that success in only one validation channel inflates the result, although it cannot eliminate correlated errors shared by the Python and Lean artifacts.
The manual audit described above found no evaluator-translation false positives among the 16 inspected artifacts: all Python translations, testcase polarities, and Lean obligations faithfully represented the generated specifications. The single incorrect artifact instead contained a specification error exposed only by an untested boundary case. Thus, cross-channel agreement is stronger than any individual metric, but remains testcase-level evidence rather than proof of universal correctness.
Together, Full Consistency and manual auditing reduce the risk of evaluator-induced inflation, while increased testcase coverage evaluates robustness to limited sampling. We will nevertheless state explicitly that these checks do not establish full specification equivalence.
C3. How well does SpecBridge generalize beyond CLEVER?
Existing specification-generation work broadly follows two settings:
- implementation-centered inference, which derives contracts, invariants, or annotations from code, traces, static analysis, or verifier feedback;
- requirement-centered formalization, which derives a formal specification from a natural-language requirement and fixed signature.
SpecBridge targets the second setting. At inference time, it receives no implementation from which state properties or invariants can be inferred. Benchmarks supporting this stricter interface are limited, and CLEVER provides aligned natural-language tasks, Lean signatures, reference specifications, and canonical behaviors. Our current study therefore focuses on pure, function-level input-output relations.
To test whether the learned guidance is specific to CLEVER, we conducted a preliminary CLEVER-to-VERINA transfer experiment. Prompts are learned only from CLEVER and frozen before VERINA evaluation; no VERINA reference specification or validation feedback is used for further refinement.
| Method | LLM Spec. Alignment | Computable Pass Rate | Proof Pass Rate |
|---|---|---|---|
| Few-shot + CoT | 0.56 | 0.61 | 0.83 |
| SpecBridge, CLEVER VERINA transfer | 0.89 | 0.74 | 0.94 |
The transferred guidance improves all three metrics, providing preliminary evidence of cross-dataset generalization within our requirement-centered setting. Further evaluation is limited by the scarcity of comparable benchmarks, as many Dafny- or ACSL/C-based datasets instead follow an implementation-centered route; supporting richer behaviors such as global state, I/O, heaps, concurrency, and multi-function interactions within our setting is future work.
Thank you for your clarifications. I am satisfied by the rebuttal. I will maintain my positive opinion.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
We sincerely thank all reviewers for their thoughtful and in-depth feedback, and the Area Chair for carefully synthesizing the central questions. We are genuinely grateful for their input, which has helped us strengthen the paper in two important ways: by providing a clearer account of where SpecBridge's gains come from, and by more precisely defining the evidence, scope, and limitations of the current work. Below, we summarize our responses to the shared and prioritized concerns, with reviewer-specific details provided in our individual responses.
Ambiguity
The information gap we address
SpecBridge primarily addresses implicit specifications: formal obligations that are not stated explicitly but can be inferred from the requirement. For example, "sort the array" implies both that the output is ordered and that it contains exactly the same elements, with the same multiplicities, as the input. In Lean, these conditions can be expressed as
List.Pairwise (fun x y => x <= y) resultandList.Perm result numbers;List.Permstates that two lists contain the same elements with the same multiplicities, possibly in different orders.SpecBridge uses the NLFP as a bridge between learning from existing formal specifications and generating specifications for new requirements. By encoding reference Lean specifications into NLFPs and reconstructing them, reconstruction and validation feedback reveal which formalization patterns should be preserved. These reusable patterns, including both the required formal obligations and their Lean representations, are incorporated into the refined prompts, which are the learned artifact of SpecBridge. For a new requirement such as "sort the array", the refined prompts guide the generated NLFP to state that "the output is ordered" and "the output preserves exactly the input elements and their multiplicities", which the decoder realizes in Lean using
List.PairwiseandList.Perm.The definition of ambiguity
However, we acknowledge that not every information gap can be resolved in this way. We follow a common understanding of ambiguity as a case where the same requirement admits multiple equally plausible specifications and provides no basis for selecting the intended one. For example, "select the best candidate" does not specify whether "best" means the highest score, greatest experience, lowest cost, or another criterion. Each interpretation yields a reasonable but different specification.
How SpecBridge currently handles ambiguity
While SpecBridge is not specifically designed to solve ambiguity, the LLM will still select one plausible interpretation during decoding and generate a specification accordingly. The selected interpretation is made explicit through the NLFP and then translated into a complete Lean specification.
Ongoing work
We are exploring an extension built on SpecBridge that uses repeated decoding to generate multiple plausible specifications and presents their differences for user selection or clarification. A practical realization of this idea would require a systematic human-in-the-loop framework that organizes the alternatives, identifies the decisions requiring user input, and incorporates the user's responses into the final specification. Developing such a framework goes beyond the scope of this paper and would constitute substantial separate work. We view it as a natural direction for extending SpecBridge and an important topic for our ongoing research.