The rise of large language models (LLMs) has sparked interest in coding assistants. While general-purpose programming languages are well supported, generating code for domain-specific languages remains a challenging problem for LLMs. In this paper, we focus on the LLM-based generation of code for Answer Set Programming (ASP), a particularly effective approach for finding solutions to combinatorial search problems. The effectiveness of LLMs in ASP code generation is currently hindered by the limited number of examples seen during their initial pre-training phase. In this paper, we introduce a novel ASP-solver-in-the-loop approach for solver-guided instruction-tuning of LLMs to addressing the highly complex semantic parsing task inherent in ASP code generation. Our method only requires problem specifications in natural language and their solutions. Specifically, we sample ASP statements for program continuations from LLMs for unriddling logic puzzles. Leveraging the special property of declarative ASP programming that partial encodings increasingly narrow down the solution space, we categorize them into chosen and rejected instances based on solver feedback. We then apply supervised fine-tuning to train LLMs on the curated data and further improve robustness using a solver-guided search that includes best-of-N sampling. Our experiments demonstrate consistent improvements in two distinct prompting settings on two datasets.


翻译:大型语言模型(LLM)的兴起引发了人们对编码助手的兴趣。虽然通用编程语言已获得良好支持,但为领域特定语言生成代码对LLM而言仍是具有挑战性的问题。本文聚焦于基于LLM的答案集编程(ASP)代码生成——这是一种解决组合搜索问题特别有效的方法。当前LLM在ASP代码生成中的有效性受限于其初始预训练阶段接触的有限示例数量。本文提出一种新颖的ASP求解器在环方法,通过求解器引导的指令微调来解决ASP代码生成中固有的高度复杂语义解析任务。我们的方法仅需自然语言描述的问题规范及其对应解。具体而言,我们从LLM中采样ASP语句作为程序续写以解析逻辑谜题。利用声明式ASP编程的特殊性质——部分编码会持续缩小解空间,我们根据求解器反馈将采样结果划分为采纳样本与拒绝样本。随后通过监督微调在筛选数据上训练LLM,并利用包含N选一采样的求解器引导搜索进一步提升鲁棒性。实验结果表明,该方法在两个数据集上的两种不同提示设置中均实现了持续改进。

0
下载
关闭预览

相关内容

ASP是Active Server Page的缩写,意为“动态服务器页面”。ASP是微软公司开发的代替CGI脚本程序的一种应用,它可以与数据库和其它程序进行交互,是一种简单、方便的编程工具。
《用于代码弱点识别的 LLVM 中间表示》CMU
专知会员服务
14+阅读 · 2022年12月12日
ICLR'21 | GNN联邦学习的新基准
图与推荐
12+阅读 · 2021年11月15日
图机器学习 2.2-2.4 Properties of Networks, Random Graph
图与推荐
10+阅读 · 2020年3月28日
可解释AI(XAI)工具集—DrWhy
专知
25+阅读 · 2019年6月4日
国家自然科学基金
2+阅读 · 2016年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关资讯
ICLR'21 | GNN联邦学习的新基准
图与推荐
12+阅读 · 2021年11月15日
图机器学习 2.2-2.4 Properties of Networks, Random Graph
图与推荐
10+阅读 · 2020年3月28日
可解释AI(XAI)工具集—DrWhy
专知
25+阅读 · 2019年6月4日
相关基金
国家自然科学基金
2+阅读 · 2016年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员