Large language models (LLMs) have advanced code generation from natural language descriptions of desired behavior (intent). Most existing methods refine code using execution feedback while leaving the underlying specification unchanged, implicitly assuming that the LLM correctly understands the intent. Yet ambiguous or underspecified descriptions can lead even capable models to correctly implement the wrong intent, making specification mismatch a central bottleneck. This paper presents BeSpec, a behavioral model based approach to specification alignment. Treating intent as partial evidence of intended program behavior, BeSpec extracts a structured specification and predicts executable behaviors that capture properties a correct program should satisfy. These avoid requiring exact test oracles, which can be as hard to predict as the solution itself. BeSpec executes candidate programs on probe inputs and compares their observed behaviors with the predicted behaviors. It validates mismatches and diagnoses their causes, refining defective specifications. We evaluate BeSpec with three LLMs on four code generation benchmarks: CodeContests, xCodeEval, APPS, and LiveCodeBench. Against nine baselines, BeSpec achieves the highest Pass at 1 and average pass rate in all settings, improving mean Pass at 1 over the strongest baseline by 9.3 to 23.6 percent relative across LLMs. After alignment, most remaining failures are adherence failures. Ablation studies on qwen3 coder 30b show the benefit of behavior modeling.


翻译:暂无翻译

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
【ETZH博士论文】语言模型编程
专知会员服务
22+阅读 · 1月8日
《大型语言模型代码生成》综述
专知会员服务
70+阅读 · 2024年6月4日
BERT源码分析PART I
AINLP
38+阅读 · 2019年7月12日
使用 Bert 预训练模型文本分类(内附源码)
数据库开发
102+阅读 · 2019年3月12日
Perseus-BERT——业内性能极致优化的BERT训练方案
云栖社区
15+阅读 · 2019年2月20日
BERT相关论文、文章和代码资源汇总
AINLP
19+阅读 · 2018年11月17日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
北约400亿美元反无人机能力投资建设
专知会员服务
6+阅读 · 11月25日
反小型无人机系统方案评估(27页)
专知会员服务
8+阅读 · 11月25日
乌克兰无人机饱和战场中的错误教训
专知会员服务
18+阅读 · 11月17日
面向最后一战术英里:美军无人机创新尝试
专知会员服务
14+阅读 · 11月17日
《美空军2026条令文件:对海压制作战》
专知会员服务
31+阅读 · 11月9日
人工智能与战争的未来
专知会员服务
14+阅读 · 11月8日
《Agent Mosaic:识别智能体LLM系统中的机密泄露》
专知会员服务
14+阅读 · 11月8日
相关基金
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员