[Paper Review] TerpreT: A Probabilistic Programming Language for Program Induction
TerpreT is a probabilistic programming language that enables rapid prototyping and comparative evaluation of program synthesis approaches by decoupling model specification from inference algorithms. It supports multiple inference back-ends—including gradient descent, linear programming, satisfiability solving, and Sketch—demonstrating that constraint solvers outperform differentiable and LP-based methods in program induction tasks.
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.
Motivation & Objective
- To develop a unified framework for specifying and comparing diverse program synthesis approaches in a like-for-like manner.
- To explore the efficacy of machine learning-based inference (e.g., gradient descent) versus traditional constraint-solving methods in inductive program synthesis.
- To enable rapid experimentation with different program representations, interpreters, and inference algorithms through a domain-specific language.
- To investigate whether differentiable, neural-inspired program representations can effectively synthesize interpretable, control-flow-aware source code.
- To provide a systematic empirical comparison of inference back-ends on a variety of program induction problems.
Proposed method
- TerpreT is a domain-specific language that separates program representation (random variable declarations) from execution semantics (interpreters).
- It defines a model where unknown program components are inferred from observed input-output examples using probabilistic inference.
- The framework supports four inference back-ends: gradient descent (via differentiable interpreters), LP relaxations for graphical models, discrete SAT solving, and the Sketch program synthesis system.
- Programs are represented as sequences of instructions with explicit control flow (if-then-else, loops), registers, and heap memory, enabling synthesis of interpretable source code.
- The interpreter model is implemented using conditional logic and variable assignments that simulate program execution step-by-step across timesteps.
- Observations are incorporated by fixing final program counter values to 0 (halt state), ensuring termination.
Experimental results
Research questions
- RQ1Can a unified probabilistic programming framework like TerpreT enable fair and systematic comparison of diverse inference algorithms for program synthesis?
- RQ2How do gradient descent-based and LP-relaxation approaches compare to constraint-solving methods in synthesizing correct programs from input-output examples?
- RQ3To what extent do differentiable, neural-inspired program representations with explicit control flow improve generalization and interpretability in program induction?
- RQ4Does the use of a structured, compiler-like intermediate representation enhance the performance of machine learning-based synthesis methods?
- RQ5What are the relative strengths and weaknesses of different inference back-ends when applied to the same program synthesis problem specification?
Key findings
- Constraint solvers (including SAT and Sketch) significantly outperform gradient descent and LP-based inference methods in terms of accuracy and success rate on program induction benchmarks.
- The empirical results show that traditional constraint-based approaches remain dominant even when compared to differentiable, neural-inspired models trained via gradient descent.
- Differentiable interpreters in TerpreT enable end-to-end training of program representations with explicit control flow and memory access, but do not match the performance of symbolic solvers.
- LP relaxation-based inference shows limited effectiveness, particularly on problems requiring discrete decisions and non-linear constraints.
- The framework successfully decouples model specification from inference, enabling direct comparison across four distinct inference back-ends using the same TerpreT specification.
- The study suggests that future progress in machine learning-based program synthesis may require integrating symbolic reasoning with neural differentiability rather than relying solely on gradient-based optimization.
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.