[论文解读] TerpreT: A Probabilistic Programming Language for Program Induction
TerpreT 是一种概率编程语言,通过将模型定义与推理算法解耦,实现了程序综合方法的快速原型设计与对比评估。它支持多种推理后端——包括梯度下降、线性规划、可满足性求解和 Sketch——并表明在程序归纳任务中,约束求解器的表现优于可微分和基于 LP 的方法。
We study machine learning formulations of inductive program synthesis; given input-output examples, we try to synthesize source code that maps inputs to corresponding outputs. Our aims are to develop new machine learning approaches based on neural networks and graphical models, and to understand the capabilities of machine learning techniques relative to traditional alternatives, such as those based on constraint solving from the programming languages community. Our key contribution is the proposal of TerpreT, a domain-specific language for expressing program synthesis problems. TerpreT is similar to a probabilistic programming language: a model is composed of a specification of a program representation (declarations of random variables) and an interpreter describing how programs map inputs to outputs (a model connecting unknowns to observations). The inference task is to observe a set of input-output examples and infer the underlying program. TerpreT has two main benefits. First, it enables rapid exploration of a range of domains, program representations, and interpreter models. Second, it separates the model specification from the inference algorithm, allowing like-to-like comparisons between different approaches to inference. From a single TerpreT specification we automatically perform inference using four different back-ends. These are based on gradient descent, linear program (LP) relaxations for graphical models, discrete satisfiability solving, and the Sketch program synthesis system. We illustrate the value of TerpreT by developing several interpreter models and performing an empirical comparison between alternative inference algorithms. Our key empirical finding is that constraint solvers dominate the gradient descent and LP-based formulations. We conclude with suggestions for the machine learning community to make progress on program synthesis.
研究动机与目标
- 开发一个统一的框架,以一致的方式指定和比较多种程序综合方法。
- 探索基于机器学习的推理方法(例如梯度下降)与传统约束求解方法在归纳程序综合中的有效性。
- 通过领域特定语言,实现对不同程序表示、解释器和推理算法的快速实验。
- 探究可微分、受神经网络启发的程序表示是否能有效合成可解释的、具备控制流感知的源代码。
- 对多种程序归纳问题,系统性地比较不同推理后端的性能。
提出的方法
- TerpreT 是一种领域特定语言,将程序表示(随机变量声明)与执行语义(解释器)分离。
- 它定义了一个模型,其中未知的程序组件通过观察到的输入-输出示例,使用概率推理进行推断。
- 该框架支持四种推理后端:通过可微分解释器实现的梯度下降、用于图模型的 LP 松弛、离散 SAT 求解,以及 Sketch 程序综合系统。
- 程序以显式控制流(if-then-else、循环)、寄存器和堆内存形式表示,支持生成可解释的源代码。
- 解释器模型通过条件逻辑和变量赋值实现,模拟程序在时间步上的逐步执行。
- 通过将最终程序计数器值固定为 0(停止状态)来引入观测,确保程序终止。
实验结果
研究问题
- RQ1像 TerpreT 这样的统一概率编程框架是否能实现对程序综合中多种推理算法的公平且系统化的比较?
- RQ2基于梯度下降和 LP 松弛的方法与约束求解方法相比,在从输入-输出示例中合成正确程序方面表现如何?
- RQ3具有显式控制流的可微分、受神经网络启发的程序表示在程序归纳中的泛化能力和可解释性方面,能提升到何种程度?
- RQ4使用结构化、类似编译器的中间表示是否能提升基于机器学习的合成方法的性能?
- RQ5在相同的程序综合问题规范下,不同推理后端的相对优势与劣势是什么?
主要发现
- 约束求解器(包括 SAT 和 Sketch)在程序归纳基准测试中,无论在准确率还是成功率方面,均显著优于梯度下降和基于 LP 的推理方法。
- 实证结果表明,即使与通过梯度下降训练的可微分、受神经网络启发的模型相比,传统的基于约束的方法仍占据主导地位。
- TerpreT 中的可微分解释器支持具有显式控制流和内存访问的程序表示的端到端训练,但其性能仍不及符号求解器。
- 基于 LP 松弛的推理方法效果有限,尤其在需要离散决策和非线性约束的问题上表现不佳。
- 该框架成功实现了模型定义与推理的解耦,使得使用同一 TerpreT 规范,可直接比较四种不同的推理后端。
- 本研究表明,未来基于机器学习的程序综合发展可能需要将符号推理与神经可微性相结合,而非仅依赖基于梯度的优化。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。