Deep Reinforcement Learning Discovers Internal Models

Nir Baram, Tom Zahavy, Shie MannorarXiv 2016

Abstract

Deep Reinforcement Learning (DRL) agents, such as Deep Q-Networks (DQN), are often viewed as "black boxes" despite their superhuman performance. This paper demonstrates that these agents implicitly learn structured internal models of their environments. We present a framework for extracting a Semi-Aggregated Markov Decision Process (SAMDP) from a trained agent, revealing human-interpretable spatial and temporal abstractions. Our results show that these extracted models not only provide insights into agent strategies but can also be used to enhance performance by detecting potential failures.

Introduction

While DRL has revolutionized complex task solving, understanding the underlying logic of these agents remains a significant challenge. Traditional visualization techniques often fail to capture the temporal dynamics inherent in Reinforcement Learning. To address this, we propose a method to automatically extract abstractions:

  1. Spatial Abstraction: Grouping similar states into clusters.
  2. Temporal Abstraction: Identifying sequences of actions as "skills" or "options."

By bridging these gaps, we can reveal the internal "maps" and strategies that agents develop during training.

The SAMDP Framework

The core of our approach is the construction of a Semi-Aggregated MDP (SAMDP). This model represents a high-level hierarchy that simplifies the agent's state space and action sequences.

The SAMDP framework integrates spatial aggregation and skill identification to form a high-level hierarchy from a standard MDP.

The pipeline involves several key steps:

  • State Representation: Recording internal neural activations and value estimates from a trained DQN.
  • Dimensionality Reduction: Using t-SNE to project high-dimensional activations into a 2D space, highlighting natural clusters.
  • Spatio-Temporal Clustering: Applying modified K-means with a temporal constraint to ensure that states visited sequentially are likely to be grouped together.
  • Skill Identification: Defining transitions between clusters as high-level "skills."
  • Model Selection: Utilizing the Minimum Description Length (MDL) principle to optimize the balance between model simplicity and descriptive power.

Experimental Setup

We evaluated the SAMDP framework on three classic Atari 2600 games: Breakout, Seaquest, and Pacman. For each game, 120,000 states were collected to build and validate the models. These games represent a range of challenges, from precise positioning in Breakout to complex resource management in Seaquest and navigation in Pacman.

Results and Insights

The extracted SAMDPs proved to be high-fidelity representations of the agents' internal states. Value functions derived from the simplified SAMDP models showed strong correlations with the actual DQN value functions.

Evaluation metrics for spatio-temporal clustering, showing relationships between inertia, entropy, value, and intensity factor.

Key findings include:

  • Strategy Visualization: In Breakout, the model explicitly identified "tunnel-digging" as a distinct skill transition.
  • Failure Detection: The SAMDP acts as a "normalcy" model. By identifying transitions that rarely lead to rewards, we implemented an "eject button" to terminate failing trajectories. This shared autonomy approach improved average scores by 36% in Breakout and 20% in Seaquest.
  • Interpretability: Complex game dynamics were reduced to graphs of 15-25 nodes, allowing for direct human inspection of the agent's "game plan."

Conclusion

This work confirms that DRL agents naturally discover spatio-temporal hierarchies. The SAMDP framework provides a powerful tool for peering into the "black box" of DRL, offering both interpretability and practical performance gains. Future work will explore applying these methods to stochastic environments and using discovered hierarchies to accelerate the training of new agents.

Summary updated

BibTeX
@misc{baram2016deep,
  author = {Nir Baram and Tom Zahavy and Shie Mannor},
  title = {{Deep Reinforcement Learning Discovers Internal Models}},
  year = {2016},
  eprint = {1606.05174},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1606.05174},
}
Figure