Search is an important technique in program synthesis that allows for adaptive strategies such as focusing on particular search directions based on execution results. Several prior works have demonstrated that neural models are effective at guiding program synthesis searches. However, a common drawback of those approaches is the inability to handle iterative loops, higher-order functions, or lambda functions, thus limiting prior neural searches from synthesizing longer and more general programs. We address this gap by designing a search algorithm called LambdaBeam that can construct arbitrary lambda functions that compose operations within a given DSL. We create semantic vector representations of the execution behavior of the lambda functions and train a neural policy network to choose which lambdas to construct during search, and pass them as arguments to higher-order functions to perform looping computations. Our experiments show that LambdaBeam outperforms neural, symbolic, and LLM-based techniques in an integer list manipulation domain.
翻译:搜索是程序合成中的重要技术,它允许根据执行结果聚焦特定搜索方向等自适应策略。多项先前研究已证明神经网络模型能有效指导程序合成搜索。然而,这些方法的常见缺陷是无法处理迭代循环、高阶函数或lambda函数,从而限制了先前神经搜索方法在合成更长及更通用程序方面的能力。我们通过设计名为LambdaBeam的搜索算法来弥补这一空白,该算法能够构建任意lambda函数,并组合给定DSL内的操作。我们创建了lambda函数执行行为的语义向量表示,并训练神经策略网络在搜索过程中选择要构建的lambda表达式,将其作为参数传递给高阶函数以执行循环计算。实验表明,在整数列表操作领域,LambdaBeam的性能优于基于神经网络、符号方法及大语言模型的技术。