NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Program Synthesis Using Deduction-Guided Reinforcement Learning

Yanju Chen, Chenglong Wang, Osbert Bastani, Isil Dillig, Yu FengCAV 2020

Abstract

Program synthesis—the task of automatically generating code from high-level specifications—is hindered by the vast search space of possible programs. Traditional methods typically rely on either deductive pruning via formal logic or statistical guessing via pre-trained models. However, these approaches often operate in isolation. This paper introduces CONCORD, a synthesis tool that achieves a tight coupling between statistical models and deductive reasoning. By formulating synthesis as a reinforcement learning (RL) problem, CONCORD uses feedback from an SMT-based deduction engine to update its search policy on-the-fly. Our evaluation shows that CONCORD solves 82% of benchmarks, outperforming state-of-the-art tools like Neo and DeepCoder with a significant speedup.

Introduction

Generating programs from input-output examples or formal specifications is a fundamental challenge in computer science. The search space is effectively infinite, requiring synthesizers to be both efficient and accurate. Historically, researchers have used two main strategies: deductive reasoning (using SMT solvers to prune infeasible branches) and statistical reasoning (using neural networks to predict likely code snippets).

The primary limitation of existing tools is that statistical models are usually static; they do not learn from the specific failures encountered during a search. Conversely, deduction engines provide binary feedback but do not help the statistical model refine its future guesses. CONCORD bridges this gap by using deductive failures as a training signal for a neural search policy.

Methodology: Deduction-Guided RL

CONCORD treats syntax-guided synthesis as a Markov Decision Process (MDP). In this framework, states represent partial programs, and actions correspond to the grammar rules used to expand them. The system consists of three main components working in a closed loop:

  1. The Policy Agent: A Gated Recurrent Unit (GRU) network predicts the most promising grammar production to apply to a "hole" in a partial program.
  2. The Deduction Engine: When the agent explores a path, the Z3 SMT solver checks for feasibility. If a partial program is proven infeasible, the engine identifies the "root cause" using unsat cores.
  3. Off-Policy Gradient Update: This is the core innovation. CONCORD generalizes a single logical failure into a class of similar failures. It then uses an off-policy variant of the policy gradient algorithm to treat these inferred failures as negative rewards, updating the neural network's weights during the search process.
The CONCORD framework: A closed-loop system where deductive feedback updates the search policy in real-time.

By incorporating importance weighting, the authors ensure that the gradient updates remain mathematically sound even when the deduction engine provides feedback on programs the agent did not explicitly sample. This effectively turns logical contradictions into a gradient update, steering the search away from entire classes of incorrect programs.

Experimental Results

The authors evaluated CONCORD on 100 synthesis benchmarks involving list transformations (e.g., sorting, filtering, and mapping), comparing it against Neo (deduction-heavy) and DeepCoder (statistics-heavy).

  • Success Rate: CONCORD solved 82% of the benchmarks, significantly higher than Neo (71%) and DeepCoder (32%).
  • Efficiency: On benchmarks solved by both tools, CONCORD achieved an 8.71x speedup over Neo.
  • Ablation Study: A version of the tool without the RL update (Concord-noRL) solved 21% fewer benchmarks, confirming that real-time learning from deductive feedback is the primary driver of performance.

Conclusion

CONCORD demonstrates that deduction and reinforcement learning are highly complementary. By closing the loop between formal logic and neural search, the tool can prune the search space more aggressively and learn from its mistakes in real-time. Future work includes extending this framework to general-purpose languages and utilizing more complex architectures like Graph Neural Networks to better capture program structure.

Summary updated

BibTeX
@inproceedings{chen2020program,
  author = {Yanju Chen and Chenglong Wang and Osbert Bastani and Isil Dillig and Yu Feng},
  title = {{Program Synthesis Using Deduction-Guided Reinforcement Learning}},
  booktitle = {CAV},
  year = {2020},
  doi = {10.1007/978-3-030-53291-8\_30},
}
Figure