Breaking the Myth: Can Small Models Infer Postconditions Too?
Not on the map. Why?
Abstract (arXiv)
Formal specifications are essential for ensuring software correctness, yet manually writing them is tedious and error-prone. Large Language Models (LLMs) have shown promise in generating such specifications from natural language intents, but the giant model size and high computational demands raise a fundamental question: Do we really need large models for this task? In this paper, we show that a small, fine-tuned language model can achieve high-quality postcondition generation with much lower computational costs. We construct a specialized dataset of prompts, reasoning logs, and postconditions, then supervise the fine-tuning of a 7B-parameter code model. Our approach tackles real-world repository dependencies and preserves pre-state information, allowing for expressive and accurate specifications. We evaluate the model on a benchmark of real-world Java bugs (Defects4J) and compare against both proprietary giants (e.g., GPT-4o) and open-source large models. Empirical results demonstrate that our compact model matches or outperforms significantly larger counterparts in syntax correctness, semantic correctness, and bug-distinguishing capability. These findings highlight that targeted fine-tuning on a modest dataset can enable small models to achieve results formerly seen only in massive, resource-heavy LLMs, offering a practical and efficient path for the real-world adoption of automated specification generation.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Builds on 7 of its 71 references that are in the map. First posted on arXiv 14 Jul 2025.
Builds on
7 of 71 references.
References · 7
- 2023Self-Evaluation Guided Beam Search for Reasoningcited by 196
- 2024Planning In Natural Language Improves LLM Search For Code Generationcited by 83
- 2025ReasonFlux: Hierarchical LLM Reasoning via Scaling Thought Templatescited by 63
- 2023Don't throw away your value model! Generating more preferable text with Value-Guided Monte-Carlo Tree Search decodingcited by 60
- 2023KCTS: Knowledge-Constrained Tree Search Decoding with Token-Level Hallucination Detectioncited by 45
- 2024What Makes Large Language Models Reason in (Multi-Turn) Code Generation?cited by 29
- 2021Generating Symbolic Reasoning Problems with Transformer GANscited by 5
Built on by
Citing papers per year: 2025: 1.
1 paper.