Research

Paper

AI LLM February 24, 2026

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

Authors

Cuong Chi Le, Minh V. T Pham, Tung Vu Duy, Cuong Duc Van, Huy N. Phan, Hoang N. Phan, Tien N. Nguyen

Abstract

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.

Metadata

arXiv ID: 2602.20610
Provider: ARXIV
Primary Category: cs.SE
Published: 2026-02-24
Fetched: 2026-02-25 06:05

Related papers

Raw Data (Debug)
{
  "raw_xml": "<entry>\n    <id>http://arxiv.org/abs/2602.20610v1</id>\n    <title>SpecMind: Cognitively Inspired, Interactive Multi-Turn Framework for Postcondition Inference</title>\n    <updated>2026-02-24T07:01:17Z</updated>\n    <link href='https://arxiv.org/abs/2602.20610v1' rel='alternate' type='text/html'/>\n    <link href='https://arxiv.org/pdf/2602.20610v1' rel='related' title='pdf' type='application/pdf'/>\n    <summary>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.</summary>\n    <category scheme='http://arxiv.org/schemas/atom' term='cs.SE'/>\n    <category scheme='http://arxiv.org/schemas/atom' term='cs.CL'/>\n    <published>2026-02-24T07:01:17Z</published>\n    <arxiv:primary_category term='cs.SE'/>\n    <author>\n      <name>Cuong Chi Le</name>\n    </author>\n    <author>\n      <name>Minh V. T Pham</name>\n    </author>\n    <author>\n      <name>Tung Vu Duy</name>\n    </author>\n    <author>\n      <name>Cuong Duc Van</name>\n    </author>\n    <author>\n      <name>Huy N. Phan</name>\n    </author>\n    <author>\n      <name>Hoang N. Phan</name>\n    </author>\n    <author>\n      <name>Tien N. Nguyen</name>\n    </author>\n  </entry>"
}