Skip to main content
QUICK REVIEW

[Paper Review] Are Neural Nets Modular? Inspecting Functional Modularity Through Differentiable Weight Masks

Róbert Csordás, Sjoerd van Steenkiste|arXiv (Cornell University)|Oct 5, 2020
Topic ModelingComputer Science60 references13 citations
TL;DR

This paper introduces a differentiable binary masking method to identify functional modules in pre-trained neural networks by training masks that isolate weights responsible for specific subtasks. The study reveals that while standard networks often specialize in distinct functions, they fail to reuse shared modules, leading to non-compositional solutions—especially evident in language tasks like SCAN and image classification, where class-exclusive features dominate.

ABSTRACT

Neural networks (NNs) whose subnetworks implement reusable functions are expected to offer numerous advantages, including compositionality through efficient recombination of functional building blocks, interpretability, preventing catastrophic interference, etc. Understanding if and how NNs are modular could provide insights into how to improve them. Current inspection methods, however, fail to link modules to their functionality. In this paper, we present a novel method based on learning binary weight masks to identify individual weights and subnets responsible for specific functions. Using this powerful tool, we contribute an extensive study of emerging modularity in NNs that covers several standard architectures and datasets. We demonstrate how common NNs fail to reuse submodules and offer new insights into the related issue of systematic generalization on language tasks.

Motivation & Objective

  • Investigate whether standard neural networks spontaneously develop functional modularity—subnetworks that implement reusable, task-specific functions.
  • Address the gap in prior work that defines modules via connectivity or activation patterns rather than functional roles.
  • Assess whether emerging modules support compositionality by measuring reuse and specialization across different functions.
  • Provide a functional definition of modularity grounded in subnetworks responsible for specific target behaviors.
  • Explain why standard networks fail to achieve systematic generalization, especially in tasks requiring compositional reasoning.

Proposed method

  • Train differentiable, probabilistic binary masks over all network weights while keeping the original network weights frozen.
  • Use auxiliary tasks corresponding to specific target functions (e.g., classifying a single image class or a subset of language commands) to train the masks.
  • Apply gradient-based optimization to learn which weights are essential for performing each target function.
  • Measure functional modularity by evaluating performance changes when masks are applied to isolate specific subnetworks.
  • Quantify specialization (P_specialize) and reuse (P_reuse) as continuous metrics based on performance degradation under mask application.
  • Apply the method to diverse architectures: feedforward, CNNs, RNNs, Transformers, and ResNets, across image and language datasets.

Experimental results

Research questions

  • RQ1Do standard neural networks spontaneously develop functional modules that correspond to specific subtasks?
  • RQ2To what extent do these modules support compositionality, as measured by reuse across identical functions?
  • RQ3How does functional modularity relate to systematic generalization in language and vision tasks?
  • RQ4Why do standard networks fail to learn reusable modules despite their theoretical advantages?
  • RQ5Are class-specific features in image classifiers indicative of functional modularity, and how do they affect generalization?

Key findings

  • Standard neural networks exhibit strong specialization (P_specialize) but fail to reuse the same module for identical functions (low P_reuse), indicating a lack of compositional learning.
  • On the SCAN dataset, models learn combination-specific weights for similar command structures, revealing non-compositional solutions that fail systematic generalization.
  • In image classification, removing class-exclusive feature detectors causes performance drops of 40–60% on simple CNNs and nearly 100% on ResNet-110, showing heavy reliance on class-specific modules.
  • The presence of dropout increases the performance degradation when removing class-exclusive features, suggesting dropout amplifies reliance on such modules.
  • Confusion patterns in CIFAR-10 (e.g., airplane with bird and ship) are driven by shared visual features like background color, not by shared functional modules.
  • The same non-reuse behavior appears in the Mathematics Dataset, confirming that the issue persists in real-world, complex reasoning tasks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.