Skip to main navigation Skip to search Skip to main content

Automated Postcondition Generation System: A Linguistic-Logical Hybrid Retrieval and Refinement Approach with Fine-Tuned LLMs

  • Institute of Software Engineering
  • East China Normal University
  • National Trusted Embedded Software Engineering Technology Research Center
  • Ltd

Research output: Chapter in Book/Report/Conference proceeding › Conference contribution › peer-review

Abstract

Mapping natural language (NL) docstrings to formal program specifications is essential for software reliability, yet general-purpose LLMs often suffer from logical hallucinations. This paper proposes a methodological framework for automated postcondition generation centering on domain-specific fine-tuning of open-source LLMs. By fine-tuning Qwen2.5-7B-Instruct on a high-quality dataset of 17,007 Python docstring-postcondition pairs, our approach enables models to capture intricate linguistic-logical mappings. We enhance accuracy through a hybrid similarity retrieval mechanism, combining semantic and structural context, and a dual-path feedback loop integrating static symbolic analysis (Z3) with dynamic execution. Experimental results on EvalPlus show that our fine-tuned model achieves a 38.01% Bug-Complete (BC) rate, which further improves to 45.16% under the full framework, surpassing GPT-4. The methodology’s generalizability is validated on Java (HumanEval-X) and real-world bugs (Defects4J). Our work demonstrates that methodologically reinforced open-source models provide a technically viable, privacy-preserving paradigm for automated formal specification generation.

Original languageEnglish
Title of host publicationAdvanced Intelligent Computing Technology and Applications - 22nd International Conference on Intelligent Computing, ICIC 2026, Proceedings
EditorsDe-Shuang Huang, Chuanlei Zhang, Wei Chen, Yijie Pan, Prashan Premaratne
PublisherSpringer Science and Business Media Deutschland GmbH
Pages489-501
Number of pages13
ISBN (Print)9789819234349
DOIs
StatePublished - 2027
Event22nd International Conference on Intelligent Computing, ICIC 2026 - Toronto, Canada
Duration: 22 Jul 2026 → 26 Jul 2026

Publication series

NameLecture Notes in Computer Science
Volume16665 LNAI
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349

Conference

Conference22nd International Conference on Intelligent Computing, ICIC 2026
Country/TerritoryCanada
CityToronto
Period22/07/26 → 26/07/26

Keywords

  • Formal Verification
  • Large Language Models
  • Model Fine-tuning
  • Postcondition Generation
  • Software Reliability

Fingerprint

Dive into the research topics of 'Automated Postcondition Generation System: A Linguistic-Logical Hybrid Retrieval and Refinement Approach with Fine-Tuned LLMs'. Together they form a unique fingerprint.

Cite this