Interpretable and Editable Programmatic Tree Policies for Reinforcement Learning

Hector Kohler, Quentin Delfosse, Riad Akrour, Kristian Kersting, Philippe Preux

TL;DR

Deep reinforcement learning (RL) models achieve impressive performance, but their black-box nature makes goal misalignments difficult to detect and fix. The authors introduce INTERPRETER, a distillation framework that converts neural RL agents into compact, human-readable Python programs based on oblique decision trees in just a few minutes. Because these policies take the form of simple if/else code, human experts can directly audit, understand, and manually edit them without any retraining.

What Problem Does This Paper Address?

Deep RL agents frequently suffer from goal misgeneralization and shortcut learning—exploiting spurious correlations in an environment rather than learning the intended objective (for example, tracking an opponent paddle’s position in Pong instead of tracking the ball). When policies are parameter-heavy neural networks, diagnosing and repairing these flaws is exceptionally challenging.

Existing attempts to extract interpretable policies either generate decision trees that are too deep to be human-auditable, rely heavily on domain-specific primitives and language models, or struggle to scale beyond simple toy environments.

Methods

INTERPRETER distills continuous or discrete neural RL oracles (such as PPO, DQN, or SAC) into compact decision tree programs via a four-stage pipeline:

  1. State Simplification & Masking: Removes constant or idle features (e.g., ladder positions or fixed horizontal coordinates) from object-centric state representations to prevent combinatorial explosion.
  2. Imitation Learning: Collects transitions using standard DAgger (for continuous actions or policy-only access) or Q-DAgger (which weights samples based on Q-value spreads when available).
  3. Oblique Decision Tree Fitting: Instead of standard axis-parallel trees (which test single variables like $x \le c$), INTERPRETER fits modified CART trees using oblique splits of pairwise differences ($s_i - s_j \le c$, with weights in $\{+1, -1\}$). This allows the agent to naturally compute intuitive relative quantities (such as distance between player and ball) without adding complex mathematical operators.
  4. Program Conversion & Pruning: Converts the oblique tree directly into executable Python if/else statements, merging redundant branches to maximize human readability and maintain a constrained leaf budget $K$.
+-------------------+      Imitation      +--------------------+      Conversion      +-----------------------+
|  Neural Oracle    |  ---------------->  |  Oblique Decision  |  ----------------->  | Editable Python Code  |
|  (PPO / SAC / DQN)|   (DAgger/Q-DAgger) |  Tree (CART-based) |   (Pruned if/else)   | (Audited & Corrected) |
+-------------------+                     +--------------------+                      +-----------------------+

Datasets

The authors evaluated INTERPRETER across several standard RL benchmarks and real-world simulators:

  • Object-Centric Atari 2600 (via OCAtari): 8 games (Pong, Asterix, Seaquest, Space Invaders, Kangaroo, Freeway, Boxing, Tennis) using RAM-extracted object coordinates rather than raw pixels.
  • Classic Control: CartPole-v1, Acrobot-v1, LunarLander-v2.
  • MuJoCo Robot Continuous Control: HalfCheetah-v4, Hopper-v4, Swimmer-v4, Walker2d-v4.
  • Agricultural Simulation: gym-DSSAT, an agronomic simulator modeling soil dynamics, crop growth, and nitrogen fertilization.

Key Insights and Ideas

  • Pairwise differences unlock policy performance: Standard axis-parallel trees fail dramatically on games like Pong because decision boundaries are naturally diagonal (e.g., comparing paddle height to ball height). Simple pairwise subtractions provide the expressive power needed to mimic neural policies while remaining easy for humans to interpret.
  • Direct code editing beats retraining:
  • Fixing shortcuts: In Pong, the neural agent relied on the opponent's paddle coordinate rather than the ball. Replacing Enemy.y with Ball.y in a single line preserved standard performance while generalizing to environments with stationary opponents.
  • Fixing misaligned rewards: In Seaquest, where the game fails to reward surfacing with rescued divers, adding two lines (if diver_0.x > 0: return "UP") increased diver rescue rates from 18.6% to 98.5%.
  • Drastic inference speedups: Python tree programs executed in an average of $79\,\mu\text{s}$, compared to $236\,\mu\text{s}$ for standard scikit-learn decision trees and $466\,\mu\text{s}$ for PyTorch neural networks.

Key Results

  • Matching Oracles: With 64 or fewer nodes, INTERPRETER matched or outperformed neural oracles on all classic control tasks, 6 out of 8 Atari tasks, and MuJoCo environments like Swimmer and HalfCheetah.
  • User Study: In a blinded study with 19 machine learning practitioners comparing four interpretable policy approaches (INTERPRETER, NUDGE, SCoBots, INSIGHT), INTERPRETER ranked highest across explainability, interpretability, trust, and adjustability.
  • Real-World Soil Fertilization: Distilling an expert heuristic on gym-DSSAT produced a 9-line program achieving 100% policy fidelity. Its learned split points cleanly mapped onto recognized agronomic phases (flowering to grain filling).

Limitations and Future Work

  • State Feature Coverage: If an underlying symbolic extractor omits critical game elements (e.g., the oxygen gauge in Seaquest or maze boundaries in Ms. Pac-Man), the policy cannot reason about them.
  • Greedy Tree Induction: Standard CART makes greedy split decisions that can yield suboptimal program structures; exploring non-greedy or optimal decision tree algorithms remains future work.
  • High-Dimensional Locomotion: While successful on Swimmer and HalfCheetah, compact oblique trees failed to effectively stabilize more complex bipedal locomotion tasks like Hopper and Walker2d.

Summary updated

BibTeX
@inproceedings{kohler2024interpretable,
  author = {Hector Kohler and Quentin Delfosse and Riad Akrour and Kristian Kersting and Philippe Preux},
  title = {{Interpretable and Editable Programmatic Tree Policies for Reinforcement Learning}},
  booktitle = {InterpPol @ RLC},
  year = {2024},
  url = {https://openreview.net/forum?id=zafp5CwoTq},
}
Figure