Inducing, Detecting and Characterising Neural Modules: A Pipeline for Functional Interpretability in Reinforcement Learning

Anna Soligo, Pietro Ferraro, David Boyle

Abstract

Interpretability is crucial for ensuring RL systems align with human values. However, it remains challenging to achieve in complex decision making domains. Existing methods frequently attempt interpretability at the level of fundamental model units, such as neurons or decision nodes: an approach which scales poorly to large models. Here, we instead propose an approach to interpretability at the level of functional modularity. We show how encouraging sparsity and locality in network weights leads to the emergence of functional modules in RL policy networks. To detect these modules, we develop an extended Louvain algorithm which uses a novel 'correlation alignment' metric to overcome the limitations of standard network analysis techniques when applied to neural network architectures. Applying these methods to 2D and 3D MiniGrid environments reveals the consistent emergence of distinct navigational modules for different axes, and we further demonstrate how these functions can be validated through direct interventions on network weights prior to inference.

Introduction

As Reinforcement Learning (RL) systems are increasingly deployed in high-stakes environments, the need for transparency in their decision-making processes becomes critical for safety and alignment. Traditional interpretability research often focuses on "bottom-up" analysis, examining individual neurons or single decision nodes. However, this approach scales poorly; in large networks, a single neuron rarely possesses a clean, human-understandable meaning in isolation.

This paper proposes a modular approach to interpretability, inspired by the functional specialization seen in biological brains. By decomposing decision-making into distinct, functional "chunks," we can achieve a higher-level understanding of agent behavior. The primary challenge lies in the fact that standard neural networks do not naturally form these clean modules, and conventional graph analysis tools are often ill-suited for detecting them in layered architectures.

The Modular Pipeline

The authors introduce a three-step pipeline: Induce, Detect, and Characterize.

1. Inducing Modularity

To force the emergence of modules, the authors project the network's neurons into a 2D grid and apply spatially aware regularization during training. This process penalizes the "wire length" or distance between connected neurons. By using a novel logarithmic sparsity loss and periodically swapping neuron positions to minimize connection costs, the network is incentivized to cluster related neurons together physically.

2. Detecting Modules

Standard community-detection algorithms like the Louvain method often fail on Multi-Layer Perceptrons (MLPs) due to strict layer-by-layer connectivity. The authors developed an Extended Louvain algorithm that integrates structural data (weights) with functional data (correlations in neuron activations). This approach maximizes both network isolation and "correlation alignment," allowing the algorithm to map module boundaries across multiple layers.

Emergence of modularity across different regularization strengths (λcc) and environments. As λcc increases, the network structure becomes visibly more modular, though often at the cost of agent returns.

3. Characterizing Modules

Once modules are identified, their functions are empirically tested through surgical interventions. By suppressing specific modules (e.g., setting weights to large negative values) prior to inference, researchers can observe changes in the agent's behavior to validate the module's functional role.

Key Results and Insights

Experiments in 2D and 3D MiniGrid environments, as well as a symbolic version of Pong, yielded several key insights:

  • Functional Specialization: Distance penalties successfully forced the networks to organize into distinct pathways. For instance, in 3D navigation tasks, separate clusters of neurons emerged to handle X-axis, Y-axis, and Z-axis movements independently.
  • Behavioral Validation: In the 3D Dynamic Obstacles (3D-DO) environment, intervening on specific modules led to predictable behavioral shifts. Negatively saturating the module responsible for vertical movement reduced up/down actions by 95% while leaving horizontal navigation intact.
  • The Interpretability Tax: There is a performance trade-off associated with modularity. While simpler tasks like "Go-to-key" (G2K) saw negligible performance drops (0.8%), more complex environments like 3D-DO experienced mean return decreases of approximately 12.5% as regularization increased to force clean modularity.
Functional decomposition of navigation modules in 3D-DO (left) and G2K (right). The diagrams show how specific input features map through isolated neural pathways to distinct action outputs.

Conclusion

This research demonstrates that functional modularity can be successfully induced and detected in RL agents, providing a scalable path toward interpretability. While a performance "interpretability tax" exists, the ability to perform surgical interventions and identify brittle strategies (such as the Pong agent's over-reliance on opponent positioning) offers significant value for safety and alignment. Future work will focus on mitigating performance trade-offs and scaling these techniques to high-dimensional domains like raw pixel inputs.

Summary updated

BibTeX
@inproceedings{soligo2025inducing,
  author = {Anna Soligo and Pietro Ferraro and David Boyle},
  title = {{Inducing, Detecting and Characterising Neural Modules: A Pipeline for Functional Interpretability in Reinforcement Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=PNy6UmfzgS},
}
Figure