Revealing the Learning Process in Reinforcement Learning Agents Through Attention-Oriented Metrics

Charlotte Beylier, Simon M. Hofmann, Nico Scherf

TL;DR

Standard performance curves show that a reinforcement learning agent is improving, but reveal almost nothing about how or what it is learning. This paper introduces Attention-Oriented Metrics (ATOMs)—a framework that uses Layer-Wise Relevance Propagation (LRP) to quantitatively track which individual objects and object combinations an agent attends to over training. Applying ATOMs across controlled Pong variants demonstrates that agents learn in distinct, consistent attentional phases, where attention directly predicts behavioral choices.

What Problem Does This Paper Address?

Reinforcement learning (RL) agents are typically evaluated solely through episodic reward and performance scores. However, a scalar reward curve cannot explain underlying behavioral strategies, detect observational overfitting, or predict failure modes during deployment.

While explainable AI (XAI) tools like saliency maps exist, they are primarily used post-hoc for qualitative human inspection rather than systematic, quantitative tracking during training. Current explanation methods are often too computationally heavy or complex to run continuously across learning. The authors tackle this gap by formulating quantitative metrics that monitor how an agent distributes attention across game entities throughout its entire learning trajectory.

Methods

The authors introduce ATOMs (Attention-Oriented Metrics), which operate on the penultimate linear layer ($F_c$) of an Advantage Actor-Critic (A2C) agent's policy network:

  • Two-Step Layer-Wise Relevance Propagation (LRP):
  • For an input state (a 4-frame stack), output action relevance is backpropagated to layer $F_c$ using the $z^+$-rule. The smallest subset of neurons $S$ accounting for 90% of the total layer relevance is selected.
  • For each relevant neuron $k \in S$, its individual relevance is backpropagated all the way back to the input pixel space to generate pixel-level heatmap $R^k(x)$.
  • Two Granularities of Attention:
  • Hierarchical-Attention ($h(o_g)$): Quantifies and ranks the average relevance density assigned to individual segmented objects $o_g$ (e.g., player paddle, opponent paddle, balls, score counters, walls).
  • Combinatorial-Attention ($c(T)$): Measures when a neuron simultaneously attends to a specific subset of objects $T$ (defined by individual object relevance exceeding a threshold $\alpha = 0.25$ of the neuron's peak object relevance).

Datasets

Rather than using static benchmarks, the authors built three custom, controllable variants of Atari Pong (implemented in Pygame, converted to $84 \times 84$ grayscale):

  • v0 (Classic baseline): Traditional game with a single ball ($B1$).
  • v1 (Distractor): Introduces a second ball ($B2$) that bounces normally but yields zero reward.
  • v2 (Dual-reward choice): $B1$ follows normal rules, while $B2$ interacts exclusively with the agent's paddle (+1 reward for hitting, -1 penalty for missing; it passes through the opponent).
  • Dual Ball Discrimination Test (Behavioral Probe): A synthetic evaluation benchmark with 100 deterministic trajectories where $B1$ and $B2$ reach the agent's defense line at the same time, separated beyond paddle width, forcing an explicit behavioral choice.

Key Insights and Ideas

  • Attention develops in consistent phases: Across all Pong variants, agents follow a common developmental progression:
  • Early training is dominated by noise and general ball tracking.
  • The agent then learns combinatorial attention linking the ball and the opponent.
  • Late-stage emergence: Direct attention on the agent's own paddle only appears late in training, coinciding almost immediately with sharp jumps in performance score.
  • Incomplete suppression of distractors: In variant v1, agents never learned to completely ignore the distractor ball ($B2$), retaining measurable attention and occasionally interacting with it in forced-choice settings.
  • Strategy diversification based on auxiliary inputs: In variant v2, agents developed attention toward score displays. Unsupervised clustering of behavioral heatmaps revealed that agents learned distinct emergent strategies conditioned on the score (e.g., switching preference to $B2$ only when near winning at 40 points, or altering preference based on opponent score thresholds).

Key Results

  • High Inter-Agent Consistency: Across 50 fully trained agents per variant, hierarchical and combinatorial dissimilarity matrices confirmed that successful agents converged to nearly identical attention profiles.
  • Attention Quantitatively Matches Action Selection: In the Dual Ball Discrimination Test, the relative hierarchical attention $\frac{h(B1)}{h(B1) + h(B2)}$ closely correlated with the empirical interaction ratio. Agents trained on v0 and v1 favored $B1$, while v2 agents favored $B2$ (~50–60% interaction and attention share).
  • Robustness to Visual Features: Swapping the color palette between $B1$ and $B2$ across 20 re-trained models yielded equivalent hierarchical attention patterns, demonstrating that ATOMs capture functional semantics rather than superficial pixel intensities.

Limitations and Future Work

  • Manual Object Segmentation: ATOMs currently rely on knowing bounding boxes or exact pixel locations of environmental objects to compute per-object relevance, which requires labeled or easily segmented environments.
  • Model and Domain Scope: The study evaluated an A2C architecture exclusively on 2D Pong environments; extending this to continuous action spaces, 3D visually complex environments, or Transformer-based RL policies remains to be verified.
  • Future Directions: The authors suggest using ATOMs to diagnose observational overfitting, analyze top-down vs. bottom-up biological vision models, and assess how hyperparameters or temporal-difference (TD) errors shape visual representation learning.

Summary updated

BibTeX
@inproceedings{beylier2024revealing,
  author = {Charlotte Beylier and Simon M. Hofmann and Nico Scherf},
  title = {{Revealing the Learning Process in Reinforcement Learning Agents Through Attention-Oriented Metrics}},
  booktitle = {SciForDL @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=s94gpLMiR6},
}
Figure