Abstract
Feature attribution has been a foundational building block for explaining input feature importance in supervised learning with Deep Neural Networks (DNNs), but faces new challenges when applied to deep Reinforcement Learning (RL). We propose a new approach to explaining deep RL actions by defining a class of action reconstruction functions that mimic the behavior of a network in deep RL. This approach allows us to answer more complex explainability questions than direct application of DNN attribution methods, which we adapt to behavior-level attributions in building our action reconstructions. It also allows us to define agreement, a metric for quantitatively evaluating the explainability of our methods. Our experiments on a variety of Atari games suggest that perturbation-based attribution methods are significantly more suitable in reconstructing actions to explain the deep RL agent than alternative attribution methods, and show greater agreement than existing explainability work utilizing attention. We further show that action reconstruction allows us to demonstrate how a deep agent learns to play the Pac-Man game.
Introduction
In traditional supervised learning, feature attribution methods like saliency maps are used to identify which input features (e.g., pixels) most influence a model's classification. However, applying these techniques to Deep Reinforcement Learning (RL) presents unique challenges. While a heatmap might indicate that an agent is "looking" at a specific object, it fails to explain the underlying logic of the chosen action or how that feature relates to long-term reward maximization.
Existing RL explanations often rely on subjective human interpretation, lacking an objective, quantitative measure of faithfulness to the model's logic. Furthermore, standard methods do not account for the behavioral dynamics of RL, where an agent must weigh multiple candidate actions based on the current environmental state.
Methodology: Action Reconstruction
To address these gaps, we introduce the concept of Action Reconstruction. The core idea is to build a proxy function, or "shadow model" ($\hat{f}$), that can accurately predict the agent's chosen action using only attribution data. This framework consists of several key components:
Behavior-Level Attribution
Rather than generating a single importance score for a pixel, we determine which specific action (e.g., Up, Down, Left, Right) a feature most strongly encourages. This provides a more granular understanding of how environmental features drive specific behavioral outputs.
Reachability and the Perceptual Horizon
We introduce Reachability ($r$) to model an agent's "perceptual horizon." In a dynamic environment, an agent typically prioritizes features it can interact with in the immediate future. We formalize this using distance metrics tailored to the environment, such as Manhattan distance for Pac-Man or Euclidean distance for Space Invaders. By aggregating behavior-level attributions within a specific reachability threshold, we can more accurately reconstruct the agent's decision-making process.
The Agreement Metric
To quantitatively evaluate explainability, we propose the Agreement metric. This metric measures the frequency with which the reconstructed action matches the agent's actual action. High agreement indicates that the explanation method is highly faithful to the agent's underlying policy.
Experimental Setup and Datasets
We evaluated our framework using several classic Atari 2600 games within the OpenAI Gym environment. These games provide diverse challenges for reachability and attribution:
- Ms. Pac-Man: Tested using both a simplified "binary" version (location matrices) and the standard image-based version.
- Space Invaders: Used to test reachability based on Euclidean distance.
- Breakout: Used to test reachability based on functional distance (e.g., the number of brick layers between the ball and the target).
Results and Discussion
The Superiority of Perturbation-Based Methods
Our experiments consistently showed that perturbation-based attribution methods, specifically Occlusion-1 (OC-1), significantly outperform gradient-based methods like Integrated Gradients or standard Saliency Maps. In the complex, temporal domain of RL, observing how a model's output changes when a feature is removed (occluded) provides a more reliable signal than mathematical gradients.
In the binary version of Ms. Pac-Man, OC-1 reconstruction achieved an Agreement score of 0.66, whereas gradient-based methods hovered between 0.28 and 0.30. Furthermore, our post-hoc reconstruction method outperformed "self-explainable" models that utilize built-in attention mechanisms, achieving 0.39 agreement compared to 0.31 on image-based Pac-Man.
Perceptual Horizons and Learning
We found that the highest Agreement scores typically occur at a specific reachability distance ($\lambda$). This suggests that well-trained agents focus on features within a specific functional range rather than the entire state space. Additionally, action reconstruction allowed us to visualize the learning process: early-stage agents learn to associate ghosts with avoidance actions well before they recognize pellets as targets for approach.
Conclusion and Future Work
Action reconstruction provides a robust, quantitative framework for explaining Deep RL. While current reachability functions are manually defined, future research could focus on learning these functions automatically from agent trajectories. Additionally, addressing the computational cost of perturbation methods and finding more semantically meaningful baselines for gradient methods remain important areas for future development.
Summary updated