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.


翻译:规范对于确保程序正确性至关重要,但手动编写规范仍然具有挑战性且耗时费力。近期基于大语言模型的方法在生成后置条件等规范方面已取得一定成功,但现有的单次提示方法往往产生不准确的结果。本文提出SpecMind,一种新颖的后置条件生成框架,它将LLM视为交互式、探索性的推理器,而非一次性生成器。SpecMind采用反馈驱动的多轮提示方法,使模型能够通过整合隐式和显式正确性反馈,迭代优化候选后置条件,并自主决定何时停止。这一过程通过探索性尝试促进更深入的代码理解,并提升与真实程序行为的对齐度。我们的实证评估表明,SpecMind在生成后置条件的准确性和完整性方面均显著优于现有最先进方法。

0
下载
关闭预览

相关内容

什么是后训练?大语言模型训练后优化方法综述,87页pdf
【普林斯顿】基于大型语言模型的语言智能体认知架构
专知会员服务
78+阅读 · 2023年9月6日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
9+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
VIP会员
最新内容
《人工智能赋能的适应性多功能电磁战》
专知会员服务
9+阅读 · 9月29日
俄乌战场实验室:全面战争如何重塑现代作战
专知会员服务
6+阅读 · 9月29日
2026年美空军协会会议上的无人机系统趋势
专知会员服务
9+阅读 · 9月28日
反制无人机:乌克兰提供的五点启示
专知会员服务
14+阅读 · 9月23日
《各指挥层级均亟需红队能力》报告
专知会员服务
10+阅读 · 9月23日
《航电任务系统框架(FAMOS)》50页报告
专知会员服务
9+阅读 · 9月22日
《对抗行动中的人工智能与自主性》智库报告
专知会员服务
14+阅读 · 9月22日
《从数据到胜利:战争中的分析优势之争》
专知会员服务
17+阅读 · 9月22日
相关VIP内容
什么是后训练?大语言模型训练后优化方法综述,87页pdf
【普林斯顿】基于大型语言模型的语言智能体认知架构
专知会员服务
78+阅读 · 2023年9月6日
相关基金
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
9+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员