神经程序合成的潜在执行
Latent Execution for Neural Program Synthesis
摘要:
从输入-输出(IO)实例进行程序合成是一个长期存在的挑战。虽然最近的工作在领域特定语言(DSL)上取得了有限的成功,但将它们应用于现实世界的程序设计语言(如C)仍然具有很大的挑战性。由于复杂的语法和标记变化,存在三个主要挑战:(1)与许多DSL不同,像C这样的语言中的程序需要首先编译并且不通过解释器执行;(2)当程序设计语言的语法和语义变得更加复杂时,程序搜索空间呈指数级增长;以及(3)收集真实世界程序的大规模数据集是不平凡的。作为解决这些挑战的第一步,我们提出LaSynth,并显示其在限制C域的有效性。更具体地说,LaSynth学习潜在表示来近似部分生成的程序的执行,即使它们在语法上不完整(寻址(1))。学习的执行显著提高了现有方法的下一个令牌预测的性能,促进了搜索(寻址(2))。最后,一旦使用随机生成的地面实况程序及其IO对进行训练,LaSynth就可以合成更简洁的程序,类似于人类编写的代码。此外,用这些合成程序重新训练我们的模型,对于卡雷尔和C程序合成都用更少的样本产生了更好的性能,这表明利用学习的程序合成器来提高输入输出程序合成的数据集质量的前景(寻址(3))。当评估程序执行输出是否与IO对匹配时,LaSynth在生成具有数十个令牌(包括循环和分支)的简单C代码时达到了55.2%的准确率,比没有执行器的现有方法高出约20%。
英文摘要:
Program synthesis from input-output (IO) examples has been a long-standing challenge. While recent works demonstrated limited success on domain-specific languages (DSL), it remains highly challenging to apply them to real-world programming languages, such as C. Due to complicated syntax and token variation, there are three major challenges: (1) unlike many DSLs, programs in languages like C need to compile first and are not executed via interpreters; (2) the program search space grows exponentially when the syntax and semantics of the programming language become more complex; and (3) collecting a large-scale dataset of real-world programs is non-trivial. As a first step to address these challenges, we propose LaSynth and show its efficacy in a restricted-C domain. More specifically, LaSynth learns the latent representation to approximate the execution of partially generated programs, even if they are incomplete in syntax (addressing (1)). The learned execution significantly improves the performance of next token prediction over existing approaches, facilitating search (addressing (2)). Finally, once trained with randomly generated ground-truth programs and their IO pairs, LaSynth can synthesize more concise programs that resemble human-written code. Furthermore, retraining our model with these synthesized programs yields better performance with fewer samples for both Karel and C program synthesis, indicating the promise of leveraging the learned program synthesizer to improve the dataset quality for input-output program synthesis (addressing (3)). When evaluating on whether the program execution outputs match the IO pairs, LaSynth achieves 55.2% accuracy on generating simple C code with tens of tokens including loops and branches, outperforming existing approaches without executors by around 20%.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。