Programmable Reinforcement Learning Agents

David Andre, Stuart J. RussellNeurIPS 2000

Introduction

Reinforcement Learning (RL) often struggles with the "curse of dimensionality." As environments become more complex, the state space explodes, making it nearly impossible for an agent to learn from scratch. To solve real-world problems, agents require prior knowledge to guide their learning process.

This paper introduces Programmable Hierarchical Abstract Machines (PHAMs), a language that allows developers to write "sketches" of agent behavior using standard programming constructs like parameters, interrupts, and local variables. By leaving specific decisions as "choice points," the agent uses reinforcement learning to fill in the blanks. This approach results in faster learning and much more concise, modular code than previous hierarchical RL methods.

Overcoming the Brittleness of Early Frameworks

While previous frameworks like Hierarchical Abstract Machines (HAMs) allowed users to constrain an agent’s behavior, they were often brittle and verbose. For example, programming an agent to walk in four different directions required writing four separate routines. Furthermore, there was no easy way to handle unexpected events—like a low battery—without manually inserting checks into every single line of the agent's code. The authors aim to bridge the gap between expressive high-level programming and robust reinforcement learning.

Programmable HAMs (PHAMs)

The authors propose PHAMs as a specialized language that defines the agent's policy. A PHAM is essentially a program that structures behavior while leaving room for learned optimization.

Examples of Programmable Hierarchical Abstract Machines (PHAMs) showing parameterization and modular structure.

Key features of this approach include:

  • Parameterization: Subroutines can take arguments (e.g., Walk(direction)), allowing one piece of code to handle multiple similar tasks.
  • Interrupts and Aborts: These allow the agent to react to high-priority environmental changes (like a dirty camera lens or low battery) globally, rather than checking for them at every step.
  • Memory Variables: Agents can store and retrieve local state information, which is essential for tasks in partially observable environments.
  • Choice Points: The user specifies the structure of the behavior but leaves certain transitions as "choices" for the RL algorithm to optimize.

The authors prove that a PHAM combined with a Markov Decision Process (MDP) forms a Semi-Markov Decision Process (SMDP). They demonstrate that an algorithm called HAMQ-learning can converge to an optimal policy within the constraints defined by the PHAM.

Evaluation Domains

The paper evaluates the PHAM approach on two simulated environments:

  1. The Deliver-Patrol Domain: A complex grid-world task with 38,400 states. The robot must deliver mail, pick up rewards, keep its battery charged at a charging station, and keep its camera lens clean.
  2. Maze World: A 3,700-state maze environment previously used in the literature to benchmark hierarchical RL.
The Deliver-Patrol domain grid world (left) and its corresponding PHAM hierarchy (right).

Key Insights and Results

The introduction of PHAMs yielded significant improvements in both code conciseness and learning efficiency:

  • Massive State Space Reduction: In the Deliver-Patrol domain, the PHAM reduced the original 38,400 states to just 7,816 choice points.
  • Conciseness is Power: A standard HAM required 63 separate machines to describe the Deliver-Patrol behavior. The PHAM version required only 9. This reduction in states makes RL exploration highly feasible. Similarly, for the Maze World, the PHAM required only 7 machines compared to the 37 required by the original HAM framework.
  • Learning Speed: PHAM-based Q-learning was significantly faster and achieved higher rewards than "flat" Q-learning, which attempts to learn from scratch.
  • Emergent Behavior: In one experiment, the agent was programmed to patrol several rooms. However, the RL algorithm discovered that the optimal strategy was actually to "loiter" in the mail room and wait for mail to appear, rather than wasting energy patrolling. Because the PHAM was flexible, the agent could retarget its navigation routines to stay put, discovering a more efficient behavior than the designer originally intended.

Limitations and Future Work

While PHAMs offer a massive leap in modularity, there are still areas for improvement. Currently, the agent learns choices for every specific instance of a subroutine. True cross-task learning would require the agent to recognize that a "traverse room" skill learned in one room is identical to the same skill in another room, regardless of global coordinates (state abstraction).

Additionally, the current framework focuses on hierarchical optimality (the best policy given the program's constraints). The authors are exploring recursive optimality, a slightly weaker form of optimality that allows for better state abstraction and modularity. Finally, the authors note ongoing work to incorporate PHAM features into standard programming languages like Lisp, providing even more powerful tools for agent designers.

Summary updated

BibTeX
@inproceedings{andre2000programmable,
  author = {David Andre and Stuart J. Russell},
  title = {{Programmable Reinforcement Learning Agents}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2000},
}
Figure