[Paper Review] Learning Compositional Neural Programs with Recursive Tree Search and Planning
This paper introduces AlphaNPI, a reinforcement learning algorithm that trains Neural Programmer-Interpreters (NPIs) without execution traces by using only program specifications and correctness tests. By integrating recursive tree search and AlphaZero-style planning into NPIs, AlphaNPI achieves strong performance on sorting and generalizes to arbitrary Tower of Hanoi puzzles, matching supervised baselines without strong supervision.
We propose a novel reinforcement learning algorithm, AlphaNPI, that incorporates the strengths of Neural Programmer-Interpreters (NPI) and AlphaZero. NPI contributes structural biases in the form of modularity, hierarchy and recursion, which are helpful to reduce sample complexity, improve generalization and increase interpretability. AlphaZero contributes powerful neural network guided search algorithms, which we augment with recursion. AlphaNPI only assumes a hierarchical program specification with sparse rewards: 1 when the program execution satisfies the specification, and 0 otherwise. Using this specification, AlphaNPI is able to train NPI models effectively with RL for the first time, completely eliminating the need for strong supervision in the form of execution traces. The experiments show that AlphaNPI can sort as well as previous strongly supervised NPI variants. The AlphaNPI agent is also trained on a Tower of Hanoi puzzle with two disks and is shown to generalize to puzzles with an arbitrary number of disk
Motivation & Objective
- To eliminate the need for strong supervision in training Neural Programmer-Interpreters (NPIs), which traditionally require full execution traces.
- To enable effective reinforcement learning (RL) training of NPIs by replacing execution traces with program specifications and correctness tests.
- To leverage hierarchical and recursive program structures to improve generalization and interpretability in RL agents.
- To demonstrate that Monte Carlo Tree Search (MCTS) planning significantly improves performance over plain neural policies in combinatorial tasks.
Proposed method
- Reformulate NPI as an actor-critic network to enable end-to-end RL training.
- Integrate recursive tree search and AlphaZero-style MCTS planning into the NPI framework to handle hierarchical and recursive program composition.
- Use a sparse reward signal: 1 if the program execution satisfies the specification, 0 otherwise.
- Apply curriculum learning with a temperature-controlled scheduler to gradually increase task difficulty.
- Incorporate Dirichlet noise and PUCT-based exploration to balance exploitation and exploration in MCTS.
- Apply a recursive execution penalty ($r_{\text{pen-recur}}$) to encourage discovery of recursive program traces during training.
Experimental results
Research questions
- RQ1Can NPIs be effectively trained via reinforcement learning without execution traces?
- RQ2Can recursive program structures be learned using RL with only correctness feedback and program specifications?
- RQ3Does MCTS-guided planning significantly improve sample efficiency and performance in NPI training compared to direct policy learning?
- RQ4Can the trained agent generalize to larger problem instances (e.g., more disks in Tower of Hanoi) based on behavior observed on smaller instances?
Key findings
- AlphaNPI achieves performance comparable to strongly supervised NPI variants on the bubble sort task, despite using only sparse rewards and no execution traces.
- The agent successfully generalizes to solve the Tower of Hanoi puzzle with an arbitrary number of disks, as verified via inductive reasoning on behavior from smaller instances.
- Agents using MCTS planning at inference time outperform plain neural network policies, demonstrating the critical role of planning in sample-efficient RL for compositional programs.
- The recursive execution penalty effectively encourages the discovery of recursive program traces, increasing the likelihood of learning correct recursive solutions.
- Training on a CPU-only setup (12 CPUs, no GPU) takes approximately 2 hours per environment, showing feasibility on modest hardware.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.