Introduction
In the field of Reinforcement Learning (RL), agents often achieve high performance while remaining "black boxes." While an agent might successfully navigate a complex maze, the underlying logic for specific decisions—such as turning at a particular junction—remains opaque. This research, presented at NeSy 2023, proposes a neural-symbolic bridge to address this lack of transparency by translating neural network behaviors into human-readable, executable code.
The Problem of Interpretability in RL
Deep neural networks, the standard for RL agents, lack inherent transparency. When an agent fails or behaves unexpectedly, tracing the reasoning behind its actions is nearly impossible. Existing Explainable RL (XRL) methods, such as heatmaps or feature importance scores, identify where an agent focuses its attention but fail to explain how it processes that information to reach a decision.
The authors argue that programs serve as the ultimate explanation. Programs are symbolic, inherently interpretable, and formally verifiable. The core challenge lies in "Inductive Program Synthesis": automatically generating a program that accurately mimics the observed behavior of a complex RL agent.
The LibT5 Framework
The proposed LibT5 framework combines the strengths of neural language models with symbolic verification to turn black-box RL trajectories into interpretable Lisp-like programs.
LibT5 is built upon three main pillars:
- Neural Program Synthesis (CodeT5): Rather than relying on computationally expensive brute-force search, the system fine-tunes CodeT5, a transformer-based language model. CodeT5 takes a string representation of an agent's observations and actions and predicts a program in a Lisp-based Domain-Specific Language (DSL) that replicates those actions.
- Library Learning: Inspired by DreamCoder, the system identifies recurring patterns in synthesized code and refactors them into higher-level functions (e.g., a function to check for obstacles two steps ahead). This incrementally expands the DSL, allowing for more concise expression of complex behaviors.
- Domain-Agnostic Curriculum: To handle long action sequences, the authors implemented a curriculum. The system starts by imitating short sub-trajectories (5 actions) and gradually increases the length (up to 30) as the library of functions matures.
Experimental Setup and Datasets
The researchers evaluated LibT5 using the MiniGrid environment, a partially observable 2D grid-world. They used a pre-trained ACCEL Oracle agent to provide the demonstrations for imitation.
To train the CodeT5 model, the team generated a synthetic dataset of 50,000 random programs from their DSL, executing them to create a large-scale "program-to-behavior" training set.
Key Insights and Results
- Neural-Symbolic Synergy: CodeT5 significantly outperformed traditional enumerative search methods. The neural component prioritizes likely code structures, while the symbolic component filters for functional correctness.
- The Necessity of Curriculum: Without the curriculum, the system failed to solve any tasks. The curriculum allows the library to "boot up," establishing basic primitives that serve as building blocks for more complex reasoning.
- Superior Imitation and Scaling: LibT5 achieved higher accuracy in imitating agent behavior compared to standard CodeT5 and traditional search-based systems like DreamCoder. It was the only method capable of maintaining performance as action sequences scaled to 30 steps.
- Rich Interpretability: The system successfully extracted 114 reusable functions describing common navigation concepts, providing a much richer vocabulary for explanation than previous methods.
Limitations and Future Directions
While promising, LibT5 currently depends on a pre-trained oracle and is designed for discrete grid-world environments. Future work aims to extend this approach to continuous spaces (e.g., robotics) by integrating perception front-ends like object detectors. Additionally, the researchers hope to move from explaining sub-trajectories to extracting a single, comprehensive program representing an agent's entire policy.
Summary updated