Program Synthesis Guided Reinforcement Learning for Partially Observed Environments

Yichen Yang, Jeevana Priya Inala, Osbert Bastani, Yewen Pu, Armando Solar-Lezama, Martin Rinard

TL;DR

Reinforcement learning (RL) often struggles with long-horizon tasks where the agent cannot see the entire map. This paper introduces Model Predictive Program Synthesis (MPPS), a framework that automatically generates high-level "guiding programs" by hallucinating possible versions of the unobserved world and synthesizing a plan that is robust to uncertainty.

The Challenge of Long-Horizon Planning

Standard Reinforcement Learning excels at reactive tasks but frequently fails at "long-horizon" planning—tasks requiring a complex sequence of specific steps (e.g., "get wood, then build a bridge, then find the gem").

One effective workaround is program-guided RL, where a human writes a high-level script for the agent to follow. However, this approach introduces two major flaws:

  1. High Manual Burden: The user must write a new program for every single task.
  2. Partial Observability: If the agent cannot see the whole environment, the human programmer must write incredibly complex "if-then-else" logic to handle every possible hidden layout.

The authors aim to automate this process, allowing the agent to "write its own scripts" even when it lacks complete information about its environment.

Methods: Model Predictive Program Synthesis (MPPS)

To solve these challenges, the authors propose MPPS, which divides the agent's decision-making process into three distinct components:

The Model Predictive Program Synthesis (MPPS) framework architecture, showing the Hallucinator, Synthesizer, and Executor.
  1. The Hallucinator (CVAE): Because the agent cannot see the whole world, it uses a Conditional Variational Auto-Encoder to "dream" up multiple possible versions of the unobserved regions based on what it has seen so far.
  2. The Synthesizer (MaxSAT): Instead of picking just one "dream" world, the agent samples several. It then uses a MaxSAT solver to find a single program (a sequence of subgoals) that has the highest probability of succeeding across all those sampled worlds. This ensures the plan is robust to uncertainty.
  3. The Executor (Modular Neural Network): This acts as the low-level muscle. It takes the synthesized program and executes the "options" (learned neural policies) for each step (e.g., a specific policy for "get wood").

The agent follows the synthesized program for $N$ steps. If the goal isn't reached, it stops, updates its "hallucinations" with new observations, and synthesizes a fresh program.

Datasets and Evaluation

The researchers evaluated MPPS on three challenging benchmarks:

An example of the 2D-craft environment where the agent must synthesize a program to navigate obstacles and collect resources.
  • 2D-craft: A Minecraft-inspired grid world where agents must collect resources and build tools to overcome obstacles (e.g., building a bridge to cross water).
  • Box-world: A task requiring abstract reasoning where the agent must find keys of specific colors to unlock a sequence of boxes to reach a goal.
  • Ant-craft: A transfer learning task where the high-level logic from 2D-craft is applied to a continuous control environment involving a MuJoCo "Ant" robot.

Key Insights

  • Robustness through Sampling: By synthesizing a program that works across multiple "hallucinated" worlds, the agent naturally avoids overly optimistic plans that might fail if the hidden part of the map isn't what it expects.
  • Programs as State Abstractions: Instead of trying to plan in raw pixel space or complex coordinate systems, the agent plans using a Domain-Specific Language (DSL). This drastically reduces the search space for the RL algorithm.
  • Implicit Exploration: The agent doesn't need a specific "exploration" reward. It naturally explores because it synthesizes plans to reach the goal; if it fails, the new information gathered during the attempt helps it synthesize a better plan next time.

Key Results

  • Outperforms Baselines: In the 2D-craft environment, MPPS achieved a success rate of 0.70, compared to just 0.22 for standard end-to-end RL and 0.23 for standard "World Models."
  • Near-Oracle Performance: MPPS performed nearly as well as an "Oracle" agent (0.76 success rate) that was given the ground-truth program by a human.
  • Efficiency: MPPS reached high performance with significantly fewer training episodes than non-program-guided methods.
  • Continuous Transfer: The system successfully guided a complex MuJoCo Ant to solve crafting tasks, proving that high-level symbolic planning can seamlessly integrate with low-level continuous motor control.

Limitations and Future Work

While MPPS significantly reduces manual programming, it still has limitations:

  • DSL Requirement: The agent synthesizes the program, but a human still has to provide the Domain-Specific Language (DSL) and the logical predicates defining "success" for each sub-component (e.g., defining that "get wood" means the inventory count of wood increases).
  • Computational Overhead: Running a MaxSAT solver and a generative model every $N$ steps is computationally heavier than a simple feed-forward neural network.

The authors suggest that automatically inferring the DSL components from raw experience is the next major frontier, which would remove the final layer of manual human engineering required.

Summary updated

BibTeX
@inproceedings{yang2021program,
  author = {Yichen Yang and Jeevana Priya Inala and Osbert Bastani and Yewen Pu and Armando Solar-Lezama and Martin Rinard},
  title = {{Program Synthesis Guided Reinforcement Learning for Partially Observed Environments}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=QwNLVId9Df},
}
Figure