SpecMind:基于认知的、交互式多轮框架用于后置条件推断
SpecMind: Cognitively Inspired, Interactive Multi-Turn Framework for Postcondition Inference
AI总结:
SpecMind通过多轮交互式提示方法提升后置条件生成的准确性和完整性,利用反馈驱动模型迭代优化,增强代码理解和程序行为对齐。
摘要:
规格对于确保程序正确性至关重要,但手动编写规格仍具挑战性且耗时。最近基于大语言模型(LLM)的方法在生成规格如后置条件方面取得了成功,但现有单次提示方法往往产生不准确的结果。在本文中,我们提出了SpecMind,一种新的后置条件生成框架,将LLM视为交互式和探索性推理者,而非一次性生成者。SpecMind采用反馈驱动的多轮提示方法,使模型能够通过整合隐含和显式的正确性反馈,迭代优化候选后置条件,同时自主决定何时停止。此过程通过探索性尝试促进更深入的代码理解,并通过探索性尝试提高与真实程序行为的一致性。我们的实证评估表明,SpecMind在生成后置条件的准确性和完整性方面显著优于现有最先进方法。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。