Program synthesis aims to automatically construct human-readable programs that satisfy given task specifications, such as input/output pairs or demonstrations. Recent works have demonstrated encouraging results in a variety of domains, such as string transformation, tensor manipulation, and describing behaviors of embodied agents. Most existing program synthesis methods are designed to synthesize programs from scratch, generating a program token by token, line by line. This fundamentally prevents these methods from scaling up to synthesize programs that are longer or more complex. In this work, we present a scalable program synthesis framework that instead synthesizes a program by hierarchically composing programs. Specifically, we first learn a task embedding space and a program decoder that can decode a task embedding into a program. Then, we train a high-level module to comprehend the task specification (e.g., input/output pairs or demonstrations) from long programs and produce a sequence of task embeddings, which are then decoded by the program decoder and composed to yield the synthesized program. We extensively evaluate our proposed framework in a string transformation domain with input/output pairs. The experimental results demonstrate that the proposed framework can synthesize programs that are significantly longer and more complex than the programs considered in prior program synthesis works. Website at https://thoughtp0lice.github.io/hnps_web/
翻译:程序合成旨在自动构建满足给定任务规范(如输入/输出对或演示)的人类可读程序。近期研究在字符串变换、张量操作以及具身智能体行为描述等多个领域展现了令人鼓舞的成果。现有大多数程序合成方法均从零开始设计,逐词逐行地生成程序,这从根本上限制了这些方法扩展到合成更长或更复杂程序的能力。本研究提出一种可扩展的程序合成框架,通过层次化地组合程序来实现合成。具体而言,我们首先学习一个任务嵌入空间和一个能够将任务嵌入解码为程序的程序解码器。随后,我们训练一个高层模块,使其能从长程序中理解任务规范(如输入/输出对或演示)并生成一系列任务嵌入,这些嵌入被程序解码器解码后组合形成最终合成的程序。我们在基于输入/输出对的字符串变换领域对提出的框架进行了全面评估。实验结果表明,该框架能够合成比先前程序合成工作中所考虑程序更长且更复杂的程序。网站见 https://thoughtp0lice.github.io/hnps_web/