LLM Reasoning 相关度: 9/10

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

Cuong Chi Le, Minh V. T Pham, Tung Vu Duy, Cuong Duc Van, Huy N. Phan, Hoang N. Phan, Tien N. Nguyen
arXiv: 2602.20610v1 发布: 2026-02-24 更新: 2026-02-24

AI 摘要

SpecMind提出了一种基于反馈迭代的多轮交互框架,用于生成更准确和完整的程序后置条件。

主要贡献

  • 提出SpecMind框架,利用LLM进行交互式后置条件推断
  • 采用反馈驱动的多轮Prompt方法,迭代优化候选后置条件
  • 实验证明SpecMind在准确性和完整性方面优于现有方法

方法论

通过多轮Prompt,LLM根据隐式/显式正确性反馈迭代改进候选后置条件,并自主决定何时停止,实现探索式代码理解。

原文摘要

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.

标签

LLM 后置条件推断 交互式学习 代码生成 反馈驱动

arXiv 分类

cs.SE cs.CL