Skip to main content
QUICK REVIEW

[Paper Review] Towards Synthesizing Complex Programs from Input-Output Examples

Xinyun Chen, Chang Liu|arXiv (Cornell University)|Jun 5, 2017
Software Engineering ResearchComputer Science29 references15 citations
TL;DR

This paper introduces a novel approach to synthesize complex programs from input-output examples by training a neural program to operate a domain-specific non-differentiable machine designed for recursive parsing. By combining a non-differentiable machine with a two-phase reinforcement learning algorithm, the method achieves 100% test accuracy on input sequences 500× longer than training inputs, overcoming the generalization failure of prior state-of-the-art techniques.

ABSTRACT

In recent years, deep learning techniques have been developed to improve the performance of program synthesis from input-output examples. Albeit its significant progress, the programs that can be synthesized by state-of-the-art approaches are still simple in terms of their complexity. In this work, we move a significant step forward along this direction by proposing a new class of challenging tasks in the domain of program synthesis from input-output examples: learning a context-free parser from pairs of input programs and their parse trees. We show that this class of tasks are much more challenging than previously studied tasks, and the test accuracy of existing approaches is almost 0%. We tackle the challenges by developing three novel techniques inspired by three novel observations, which reveal the key ingredients of using deep learning to synthesize a complex program. First, the use of a non-differentiable machine is the key to effectively restrict the search space. Thus our proposed approach learns a neural program operating a domain-specific non-differentiable machine. Second, recursion is the key to achieve generalizability. Thus, we bake-in the notion of recursion in the design of our non-differentiable machine. Third, reinforcement learning is the key to learn how to operate the non-differentiable machine, but it is also hard to train the model effectively with existing reinforcement learning algorithms from a cold boot. We develop a novel two-phase reinforcement learning-based search algorithm to overcome this issue. In our evaluation, we show that using our novel approach, neural parsing programs can be learned to achieve 100% test accuracy on test inputs that are 500x longer than the training samples.

Motivation & Objective

  • To address the challenge of generalizing program synthesis to complex programs beyond simple string or array operations.
  • To develop a method that can learn recursive, context-free language parsers from input-tree pairs without execution trace supervision.
  • To overcome the poor generalization of end-to-end differentiable models and the training instability of reinforcement learning from a cold start.
  • To demonstrate that neural programs can fully generalize to inputs significantly longer than seen during training.

Proposed method

  • Design a domain-specific non-differentiable machine that supports recursion and restricts the search space to valid programs.
  • Train a neural program to operate this machine using a novel two-phase reinforcement learning algorithm to recover execution traces and train the policy.
  • Bake-in recursion into the machine's architecture to enable generalization to arbitrarily long inputs.
  • Use the non-differentiable machine as a differentiable interface to constrain the neural program to only generate valid, structured programs.
  • Decompose the training into two phases: first, search for plausible execution traces; second, train the neural policy using the recovered traces as supervision.
  • Leverage the machine’s recursive structure to enable the neural program to generalize beyond training sequence lengths.

Experimental results

Research questions

  • RQ1Can a neural program be trained to generalize to inputs much longer than seen during training when learning to parse context-free grammars?
  • RQ2How can reinforcement learning be stabilized when training from a cold start with no supervision on execution traces?
  • RQ3What role does a non-differentiable machine play in restricting the search space to valid programs and improving generalization?
  • RQ4Can recursion be effectively encoded in a neural program’s execution machine to enable perfect generalization?

Key findings

  • The proposed method achieves 100% test accuracy on input sequences 500× longer than the longest training sequence, demonstrating full generalization.
  • Existing state-of-the-art approaches, including RobustFill and StackRNN, achieve nearly 0% test accuracy on the same long inputs, highlighting the challenge of generalization.
  • The two-phase reinforcement learning algorithm successfully avoids local minima and enables effective training from a cold start, unlike prior methods.
  • The integration of recursion into the non-differentiable machine is essential for enabling generalization to arbitrarily long inputs.
  • The use of a non-differentiable machine effectively restricts the neural program to only generate valid, structured programs, preventing overfitting to training data.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.