Current approaches to program synthesis with Large Language Models (LLMs) exhibit a "near miss syndrome": they tend to generate programs that semantically resemble the correct answer (as measured by text similarity metrics or human evaluation), but achieve a low or even zero accuracy as measured by unit tests due to small imperfections, such as the wrong input or output format. This calls for an approach known as Synthesize, Execute, Debug (SED), whereby a draft of the solution is generated first, followed by a program repair phase addressing the failed tests. To effectively apply this approach to instruction-driven LLMs, one needs to determine which prompts perform best as instructions for LLMs, as well as strike a balance between repairing unsuccessful programs and replacing them with newly generated ones. We explore these trade-offs empirically, comparing replace-focused, repair-focused, and hybrid debug strategies, as well as different template-based and model-based prompt-generation techniques. We use OpenAI Codex as the LLM and Program Synthesis Benchmark 2 as a database of problem descriptions and tests for evaluation. The resulting framework outperforms both conventional usage of Codex without the repair phase and traditional genetic programming approaches.
翻译:当前基于大语言模型的程序合成方法存在"近似错误综合征":生成的程序在语义上接近正确答案(通过文本相似度指标或人工评估衡量),但因输入输出格式错误等细微缺陷,导致通过单元测试的准确率极低甚至为零。为此需要采用"合成-执行-调试"方法,首先生成解决方案草案,随后针对失败测试进行程序修复。要将该方法有效应用于指令驱动型大语言模型,需确定哪些提示词作为指令效果最佳,同时需在修复失败程序与替换为新生成程序之间取得平衡。我们通过实验探究了这些权衡关系,比较了替换优先、修复优先及混合调试策略,以及基于模板和基于模型的各类提示生成技术。采用OpenAI Codex作为大语言模型,以Program Synthesis Benchmark 2作为问题描述与测试数据库进行评估。最终框架在性能上超越了未含修复阶段的传统Codex使用方法及传统遗传编程方法。