Abstract
The learning process of a reinforcement learning (RL) agent remains poorly understood beyond the mathematical formulation of its learning algorithm. To address this gap, we introduce attention-oriented metrics (ATOMs) to investigate the development of an RL agent's attention during training. We tested ATOMs on three variations of a Pong game, each designed to teach the agent distinct behaviours, complemented by a behavioural assessment. Our findings reveal that ATOMs successfully delineate the attention patterns of an agent trained on each game variation, and that these differences in attention patterns translate into differences in the agent's behaviour. Through continuous monitoring of ATOMs during training, we observed that the agent's attention developed in phases, and that these phases were consistent across games. Finally, we noted that the agent's attention to its paddle emerged relatively late in the training and coincided with a marked increase in its performance score. Overall, we believe that ATOMs could significantly enhance our understanding of RL agents' learning processes, which is essential for improving their reliability and efficiency.
Introduction
In Reinforcement Learning (RL), success is typically measured by a scalar reward or performance score. While effective for determining if an agent is winning, these scores offer little insight into how an agent understands its environment or why it makes specific errors. This "black box" nature of RL makes it difficult to diagnose failures or ensure reliability in complex tasks.
Existing Explainable AI (XAI) methods, such as saliency maps, provide qualitative snapshots of a single decision after training is complete. However, they are rarely used to monitor the entire learning journey because they lack the mathematical quantification needed to track progress over millions of training steps. To bridge this gap, we introduce Attention-Oriented Metrics (ATOMs), a framework that translates raw neural importance into human-understandable attention on specific game objects.
The ATOMs Framework
Our approach utilizes an Actor-Critic (A2C) architecture, focusing on the "actor" network’s final linear layer ($F_c$), which serves as the agent's internal world model. To quantify attention, we employ Layer-Wise Relevance Propagation (LRP), a technique that backpropagates the importance of a specific action down to the input pixels.
We define two primary metrics:
- Hierarchical-attention: This metric ranks the relative importance of individual objects, such as distinguishing between a primary target and a distractor.
- Combinatorial-attention: This measures the agent's focus on relationships between objects, such as the spatial interaction between the ball and the agent's paddle.
By filtering for neurons that account for 90% of total relevance, we reduce noise and create stable metrics that can be plotted as a "learning curve" of attention over time.
Experimental Design
To validate ATOMs, we developed three custom variations of the classic Atari Pong game using the Pygame library, each designed to elicit different strategic priorities:
- v0 (Standard): A single ball and paddle.
- v1 (Distractor): Two balls are present, but only one ($B1$) provides a reward. The second ball ($B2$) is a distractor that must be ignored.
- v2 (Dual Reward): Two balls are present, both providing rewards, but with different physics (e.g., one can pass through the opponent's paddle).
We also implemented a Dual Ball Discrimination Test, a behavioral experiment where an agent is forced to choose between two balls. This allows us to verify if the internal "attention" measured by ATOMs accurately predicts the agent's physical choices.
Key Insights and Results
Learning in Phases
ATOMs revealed that RL agents do not learn all aspects of a game simultaneously. Instead, attention develops in distinct, consistent phases across different game versions. A critical discovery was the "Paddle Breakthrough": attention to the agent's own paddle typically emerges late in the training process. This late emergence coincides with the sharpest increase in performance scores, suggesting that understanding one's own role and position in the environment is a necessary tipping point for mastery.
Attention Predicts Behavior
The metrics proved to be more than theoretical. In the Dual Ball Discrimination Test, hierarchical attention scores accurately predicted which ball the agent would move toward. Furthermore, ATOMs identified "residual attention" in version $v1$; even when agents were successful, they never learned to ignore the distractor ball completely. This internal focus on the distractor explained why agents occasionally attempted to hit the wrong ball despite their training.
Delineation of Strategies
ATOMs successfully distinguished between the strategies learned in different environments. Agents in $v0$ and $v1$ showed high hierarchical attention to the primary ball, while $v2$ agents developed a balanced preference for both reward-providing balls. Across all versions, successful agents eventually transitioned from looking at objects in isolation to a combinatorial focus on the "ball + paddle" or "ball + opponent" relationship.
Conclusion and Future Work
ATOMs provide a quantifiable window into the developmental psychology of RL agents. While currently tested in the controlled environment of Pong, these metrics offer a path toward detecting observational overfitting—where an agent "cheats" by focusing on irrelevant features—and exploring the neurobiological links between surprise (Temporal Difference error) and shifts in attention. Future research will focus on scaling these metrics to high-dimensional, real-world environments to further improve the reliability and efficiency of autonomous systems.
Summary updated