SpecMind: Cognitively Inspired, Interactive Multi-Turn Framework for Postcondition Inference

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Le, Cuong Chi, Pham, Minh V. T, Duy, Tung Vu, Van, Cuong Duc, Phan, Huy N., Phan, Hoang N., Nguyen, Tien N.
Format: Preprint
Publié: 2026
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866917293183729664
author Le, Cuong Chi
Pham, Minh V. T
Duy, Tung Vu
Van, Cuong Duc
Phan, Huy N.
Phan, Hoang N.
Nguyen, Tien N.
author_facet Le, Cuong Chi
Pham, Minh V. T
Duy, Tung Vu
Van, Cuong Duc
Phan, Huy N.
Phan, Hoang N.
Nguyen, Tien N.
contents Specifications are vital for ensuring program correctness, yet writing them manually remains challenging and time-intensive. Recent large language model (LLM)-based methods have shown successes in generating specifications such as postconditions, but existing single-pass prompting often yields inaccurate results. In this paper, we present SpecMind, a novel framework for postcondition generation that treats LLMs as interactive and exploratory reasoners rather than one-shot generators. SpecMind employs feedback-driven multi-turn prompting approaches, enabling the model to iteratively refine candidate postconditions by incorporating implicit and explicit correctness feedback, while autonomously deciding when to stop. This process fosters deeper code comprehension and improves alignment with true program behavior via exploratory attempts. Our empirical evaluation shows that SpecMind significantly outperforms state-of-the-art approaches in both accuracy and completeness of generated postconditions.
format Preprint
id arxiv_https___arxiv_org_abs_2602_20610
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle SpecMind: Cognitively Inspired, Interactive Multi-Turn Framework for Postcondition Inference
Le, Cuong Chi
Pham, Minh V. T
Duy, Tung Vu
Van, Cuong Duc
Phan, Huy N.
Phan, Hoang N.
Nguyen, Tien N.
Software Engineering
Computation and Language
Specifications are vital for ensuring program correctness, yet writing them manually remains challenging and time-intensive. Recent large language model (LLM)-based methods have shown successes in generating specifications such as postconditions, but existing single-pass prompting often yields inaccurate results. In this paper, we present SpecMind, a novel framework for postcondition generation that treats LLMs as interactive and exploratory reasoners rather than one-shot generators. SpecMind employs feedback-driven multi-turn prompting approaches, enabling the model to iteratively refine candidate postconditions by incorporating implicit and explicit correctness feedback, while autonomously deciding when to stop. This process fosters deeper code comprehension and improves alignment with true program behavior via exploratory attempts. Our empirical evaluation shows that SpecMind significantly outperforms state-of-the-art approaches in both accuracy and completeness of generated postconditions.
title SpecMind: Cognitively Inspired, Interactive Multi-Turn Framework for Postcondition Inference
topic Software Engineering
Computation and Language
url https://arxiv.org/abs/2602.20610