Skip to main content
QUICK REVIEW

[Paper Review] Neural Program Synthesis with Priority Queue Training

Daniel A. Abolafia, Mohammad Norouzi|arXiv (Cornell University)|Jan 10, 2018
Software Engineering ResearchComputer Science33 references28 citations
TL;DR

This paper proposes Priority Queue Training (PQT), a reinforcement learning method for neural program synthesis that iteratively improves a recurrent neural network (RNN) by training on the top-K highest-reward programs from a dynamic priority queue. PQT outperforms both policy gradient and genetic algorithm baselines on a range of tasks in the Turing-complete BF programming language, achieving higher success rates and generating shorter, human-readable programs when a length penalty is applied.

ABSTRACT

We consider the task of program synthesis in the presence of a reward function over the output of programs, where the goal is to find programs with maximal rewards. We employ an iterative optimization scheme, where we train an RNN on a dataset of K best programs from a priority queue of the generated programs so far. Then, we synthesize new programs and add them to the priority queue by sampling from the RNN. We benchmark our algorithm, called priority queue training (or PQT), against genetic algorithm and reinforcement learning baselines on a simple but expressive Turing complete programming language called BF. Our experimental results show that our simple PQT algorithm significantly outperforms the baselines. By adding a program length penalty to the reward function, we are able to synthesize short, human readable programs.

Motivation & Objective

  • To develop a general-purpose program synthesis framework that requires only a reward function, without ground-truth programs or correct outputs.
  • To evaluate the effectiveness of a simple, iterative optimization method—priority queue training (PQT)—for neural program synthesis.
  • To benchmark PQT against established baselines like policy gradient and genetic algorithms in a Turing-complete programming language.
  • To explore whether PQT can generate concise, human-readable programs by incorporating a program length penalty into the reward function.
  • To establish a standardized evaluation methodology for comparing program synthesis methods across multiple tasks and random seeds.

Proposed method

  • The method maintains a priority queue of the K highest-reward programs generated so far, which are used to train the RNN via maximum likelihood on the top-K programs.
  • The RNN generates new programs via autoregressive sampling from the learned policy, and these are added to the priority queue after execution and reward evaluation.
  • The training process iterates: retrain the RNN on the current top-K programs, sample new candidates, and update the queue with the best K programs including new ones.
  • A reward function is defined to evaluate program correctness, with optional penalties for program length or execution time to encourage compact, efficient code.
  • The approach is evaluated on the BF programming language, a minimal but Turing-complete language with only 8 operations, enabling syntactically valid program generation.
  • The method is compared against policy gradient (PG) and genetic algorithm (GA) baselines using success rates on training and held-out test cases across multiple tasks.

Experimental results

Research questions

  • RQ1Can a simple iterative optimization method based on a priority queue outperform established reinforcement learning and genetic algorithm baselines in program synthesis?
  • RQ2Does training an RNN on the top-K programs from a dynamic priority queue lead to more stable and reliable program synthesis than standard policy gradient methods?
  • RQ3Can the PQT method generate short, human-readable programs when a program length penalty is included in the reward function?
  • RQ4Is the PQT method robust across multiple random seeds and diverse programming tasks, including string manipulation and algorithmic operations?
  • RQ5Can PQT bootstrap from a randomly initialized RNN and an empty queue to discover correct programs without prior supervision?

Key findings

  • PQT achieved a success rate of 13.0 / 5.7 on average across 20 tasks (training / evaluation), significantly outperforming policy gradient (3.3 / 1.5) and genetic algorithm (8.6 / 4.3).
  • For the reverse task, PQT achieved 20 / 20 success on both training and evaluation sets, while policy gradient only reached 3 / 2.
  • On the print-hello task, PQT achieved 25 / 25 success, matching the best performance of the PG+PQT hybrid, while GA achieved only 12 / 16.
  • PQT successfully generated human-readable, minimal-length BF programs for tasks like reverse, add, and print-hello, with examples such as ",[>,]+[,<.]" for reversing a string.
  • The method demonstrated high reliability, finding solutions on most random seeds and most tasks, unlike baselines that failed on many combinations.
  • When a length penalty was applied, PQT generated concise programs, such as "++++++++.---.+++++++..+++." for printing "hello", indicating effective code simplification.

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.