TL;DR
Instead of trying to understand deep reinforcement learning (RL) agents by analyzing individual neurons—an approach that scales poorly—this paper introduces a training and analysis pipeline that forces networks to self-organize into distinct, human-understandable "functional modules." By combining spatially aware regularization with a custom community-detection algorithm, the authors successfully induce, detect, and causally validate independent sub-networks responsible for specific behaviors, like navigating along different spatial axes.
What Problem Does This Paper Address?
Mechanistic interpretability aims to reverse-engineer neural networks by looking under the hood. However, doing this at the level of individual neurons or decision nodes is incredibly difficult: large models contain millions of parameters, and individual neurons are rarely semantically meaningful in isolation (a phenomenon known as polysemanticity).
To make explanations tractable for human interpreters, we need a higher level of abstraction—what cognitive scientists call "cognitive chunks." This paper addresses the challenge of scaling interpretability by focusing on functional modularity: creating and identifying independent sub-components within a neural network that handle distinct sub-tasks, much like specialized regions in the biological brain.
Methods
The authors propose a complete pipeline consisting of four main stages:
- Spatially Aware Regularization: The neural network is projected into a 2D Euclidean space where each neuron is assigned a coordinate. The network is trained using a novel connection cost loss ($L_{cc}$) that combines a logarithmic sparsity penalty with the physical distance between connected neurons. This penalizes long, sprawling connections and encourages local clustering.
- Neuron Relocation: Periodically during training, neurons within the same layer are ranked by their importance and swapped if moving them to a new position reduces the overall connection cost. This allows the network to dynamically rearrange its "circuit board" layout.
- Extended Louvain Algorithm for Module Detection: Standard graph clustering algorithms (like the Louvain algorithm) fail when applied to Multi-Layer Perceptrons (MLPs) because they get tripped up by shared input features and strict layer-wise connectivity. The authors introduce an internal Louvain step that ignores inputs initially, followed by a fine-tuning stage that optimizes a joint metric: structural isolation plus correlation alignment (measured via the Adjusted Rand Index between weight structures and actual neuron activation correlations).
- Causal Validation via Interventions: To prove the detected modules actually perform specific functions, the authors perform targeted weight interventions prior to inference: negative saturation (effectively turning a module off by setting its weights to -50) and negation (flipping the signs of the weights to perturb the module).
Datasets
The pipeline was evaluated on two main reinforcement learning benchmarks implemented in JAX:
- MiniGrid Environments:
- Go-to-Key (G2K): An agent navigates a 4x4 grid to reach one of two keys.
- Dynamic Obstacles (DO): An agent navigates a 4x4 grid to reach a goal while avoiding three moving obstacles.
- 3D Dynamic Obstacles (3D-DO): Extends the obstacle-avoidance task to a 3x3x2 3D grid.
- Pong: A custom implementation where the agent receives symbolic observations (paddle and ball coordinates/velocities) and plays against a standard "follow ball" opponent.
Key Insights and Ideas
- Layout Matters: Combining distance-weighted regularization with neuron relocation forces the network to align its internal structure with environmental physics. For example, input features and output actions naturally sort themselves out so that $X, Y,$ and $Z$ coordinates align vertically with the actions that control movement along those exact axes.
- Standard Graph Theory Fails on NNs: Traditional community detection algorithms assume uniform connection probabilities. In MLPs, the high fan-out of input features causes standard algorithms to incorrectly slice modules horizontally (by layer) rather than vertically (by function). The authors' extended Louvain algorithm fixes this by evaluating functional activation correlations alongside structural weights.
- Modularity Doubles as Extreme Compression: Forcing the network to form local modules acts as a powerful pruning mechanism. The regularized networks can be stripped of low-magnitude weights and neurons, resulting in massive parameter reductions while maintaining functional integrity.
Key Results
- Improved Module Detection: The proposed fine-tuning method increased average module isolation by 16.8% and correlation alignment by 33.7% compared to standard baseline partitioning methods.
- Massive Network Pruning: At the point of module emergence, the final networks achieved parameter reductions of 90.5% for DO, 96.5% for 3D-DO, and 89% for G2K compared to unregularized baselines.
- Performance Trade-off: Enforcing modularity caused a moderate drop in agent returns (~11.4% for DO and 12.5% for 3D-DO), though the G2K environment saw a negligible drop of just 0.8%.
- Causal Verification: When the authors negatively saturated the "Up/Down" module in the 3D-DO network, up/down actions dropped by 95%, while the remaining modules continued to handle left/right and forward/backward navigation successfully without an increase in catastrophic failures.
Limitations and Future Work
- The Performance Tax: The primary drawback is the trade-off between strict interpretability and raw performance (return). Future work is needed to mitigate this decline.
- Architectural Simplicity: The pipeline was only demonstrated on relatively simple MLPs (two hidden layers) in symbolic, low-dimensional environments. Scaling this approach to complex visual inputs, Convolutional Neural Networks (CNNs), or Transformers remains an open challenge.
- Destructive Interventions: Modifying weights directly via negative saturation or negation is a blunt instrument. In more complex, less perfectly isolated networks, activation-based interventions might be necessary to preserve downstream distributions and prevent total system collapse.
Summary updated