Abstract
As deep reinforcement learning (DRL) agents tackle increasingly complex tasks, simply looking at reward curves isn't enough to understand how they solve problems. This paper introduces ForageWorld, a naturalistic foraging environment, and applies analysis tools from neuroscience and ethology to reveal that model-free RNN agents can develop sophisticated, planning-like behaviors and spatial memory purely through emergent dynamics.
Introduction
In reinforcement learning, evaluating an agent usually comes down to looking at a single metric: the reward curve. But as RL moves toward open-ended, partially observable, and complex environments, aggregate performance metrics offer very little insight into how an agent is solving a task or why it fails. This lack of behavioral analysis makes it hard to diagnose algorithmic issues or ensure safe alignment.
In neuroscience, researchers use joint behavioral and neural analysis to understand biological intelligence. The authors argue that DRL needs a similar "behavior-first" approach—studying AI agents like animals—to uncover the rich strategies, memory, and planning hidden inside their black-box neural networks.
The ForageWorld Environment
To study these agents, the paper introduces ForageWorld, a novel, procedurally generated RL task suite built on top of the GPU-accelerated Craftax benchmark. Unlike standard gridworlds, ForageWorld incorporates ecological constraints: depleting and diffusing food patches (cows), fixed water sources, intermittent predator threats, and physiological internal states (hunger, thirst, fatigue, health). The reward function is tied to survival and maintaining homeostasis rather than simply maximizing resource consumption.
Methodology
The authors train agents using Proximal Policy Optimization (PPO) with a Gated Recurrent Unit (GRU) core to handle partial observability. To analyze these agents, they adapt a toolkit from neuroethology:
- Behavioral Phase Segmentation: Using unsupervised clustering to identify distinct movement modes (e.g., short-range foraging vs. long-range navigation) without explicitly programming them.
- Generalized Linear Models (GLMs): Fitting statistical models to agent decisions to see which historical variables (like predator presence or spatial uncertainty) drive their choices to revisit specific areas.
- Recurrent State Decoding: Training linear decoders (ridge regression) on the RNN's hidden states to see if the network internally predicts the agent's past and future allocentric (absolute, origin-relative) or egocentric (self-relative) positions.
- Model Ablations: Testing the impact of network pruning (90% sparsity) and auxiliary path-integration objectives on both performance and interpretability.
Key Findings
Emergent Planning and Exploration
Contrary to the assumption that sophisticated planning requires explicit world models or symbolic memory, model-free RNN agents developed structured, memory-guided revisitation strategies purely through emergent dynamics. Early in training or in novel arenas, agents exhibit outwardly spiraling, azimuthally rotating search loops. These trajectories strikingly resemble the real-world search patterns of ants and bees navigating novel environments.
Spatial Memory and Decision Making
- Spatial Decoding: The agents' RNN hidden states encoded allocentric position up to 50–100 timesteps into the past and future, proving long-horizon memory and implicit planning. Egocentric decoding remained at chance levels.
- Multi-objective Decision Making: GLM analysis of 7,978 revisitation decisions showed agents actively weigh multiple factors: they prefer recently visited patches, patches with higher prior position prediction error (uncertainty), and avoid patches with high predator encounter rates.
- Single-Neuron Tuning: Approximately 100 out of 512 RNN neurons were found to be highly position-sensitive. Their activity response scaled with radial distance from the arena's origin, suggesting an emergent distance-accumulation circuit.
Network Architecture Insights
- Sparsity improves interpretability: Pruning the RNN to 90% sparsity (mimicking biological brains) didn't degrade performance but did improve the modularity and accuracy of spatial decoding from hidden states.
- Auxiliary tasks are a win-win: Adding a simple path-integration objective (asking the network to predict its current position) not only improved survival in large arenas but was absolutely necessary for the network to develop interpretable spatial representations.
Training Dynamics
Skill acquisition happens in distinct phases. Around 20,000 training iterations, agents abruptly shift from a stationary "fishing" strategy to long-distance travel, strategic food/water trade-offs, and tool-making.
Conclusion and Future Work
The study demonstrates that applying neuroethology-inspired tools to DRL agents uncovers rich structures in learning dynamics and behavior. However, the environment is currently capped at a 96x96 grid size due to underlying constraints, limiting the study of even larger-scale navigation. Additionally, the exact locations of all trees and rocks couldn't be logged, restricting detailed analysis of landmark-based navigation. The study also primarily focused on PPO and PQN architectures.
Future work will explore architectures that explicitly mimic mammalian spatial navigation (like grid-cell-based cognitive maps) to see how they solve ForageWorld. The authors also propose incorporating curriculum learning to study how staged training histories shape internal representations and generalization.
Summary updated