NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Scalable Modular Network: A Framework for Adaptive Learning via Agreement Routing

Minyang Hu, Hong Chang, Bingpeng Ma, Shiguang Shan, Xilin Chen

Introduction

Deep learning models often struggle with "compositional generalization"—the ability to understand new combinations of known concepts. While modular neural networks aim to solve this by using specialized units for different sub-concepts, existing approaches often rely on extra metadata for routing or use static routing functions that ignore how modules interact with each other. Furthermore, most models are rigid; they cannot easily incorporate new specialized knowledge once training is finished without significant retraining or risking catastrophic forgetting.

The Scalable Modular Network (SMN) introduces a novel "agreement router" that dynamically selects and composes specialist neural modules through iterative message passing. This framework not only improves out-of-distribution generalization but also allows for the seamless integration of new modules after pre-training, enabling sample-efficient adaptation to novel tasks.

Methodology

The core innovation of the SMN is the Agreement Router. Unlike standard routers that make a one-shot decision based on the input, the agreement router uses an iterative process ($T$ steps) to refine module selection.

  1. Iterative Routing by Agreement: The router computes "agreements" between input features and the outputs of all available modules. It treats module outputs as cluster centers and inputs as samples to be grouped.
  2. Global Interactions: By passing messages between modules during the routing iterations, the system considers not just how well a single module fits an input (local interaction), but how all modules collectively represent the data (global interaction).
  3. Scalability: The framework is designed to be highly scalable. After pre-training a base set of $M$ modules, users can add $D$ new modules. These new modules compete with the original ones via a softmax-based agreement mechanism, allowing the network to adapt to new feature distributions without retraining the entire system.
  4. Modulated Modules: To keep adaptation efficient, the authors use "Modulated Fully-Connected" (ModFC) layers. These allow modules to condition their computation on a small set of learnable parameters, making fine-tuning extremely fast and sample-efficient.
The SMN architecture consists of a tokenizer, a module processor with an agreement router, and a classifier.

Experiments and Key Insights

The authors evaluated SMN across several challenging scenarios, including a synthetic Toy Min-Max Digit Game, Few-Shot Image Classification (FSIC) benchmarks like miniImageNet and CIFAR-FS, and Reinforcement Learning path-finding tasks.

Key Findings

  • Iteration is Key: Performance significantly improves as the number of routing iterations ($T$) increases. At $T=0$, the model performs similarly to standard non-modular networks; at $T=4$, it achieves a massive boost in accuracy.
  • Sparsity Emerges Naturally: Theoretically and empirically, the agreement routing process naturally converges toward sparse module selection (assigning an input to a single specialist), avoiding the "trivial solution" where all modules are used for everything.
  • Global Context Matters: By considering global interactions, the router can distinguish between very similar inputs that require different specialist modules.
  • Out-of-Distribution (OOD) Generalization: On the Toy Min-Max game, SMN ($T=4$) achieved 54.46% accuracy on unseen compositions, significantly outperforming Transformers (45.76%) and CNNs (42.34%).
  • Few-Shot SOTA: On miniImageNet 5-way 1-shot classification, SMN reached 75.76% accuracy, surpassing recent state-of-the-art methods like SMKD (74.28%).

Plug-and-Play Adaptation

One of the most compelling results is the efficiency of adding new modules. Adding just 2-3 new modules to a pre-trained network and fine-tuning only those new parameters leads to better results than fine-tuning the entire original network on a new task. For example, in a parity code adaptation task, adding 2 new modules improved accuracy from ~88% to over 92%.

Test accuracy improves as new modules are added to the pre-trained framework.

Limitations and Future Work

While highly effective, the SMN framework has some limitations. Adding too many modules can lead to diminishing returns and potential overfitting; performance starts to plateau or slightly dip if the module count becomes excessive relative to the task complexity. Additionally, each routing iteration adds computational overhead, with $T=4$ increasing inference time by about 17% compared to $T=0$.

Future directions include scaling this architecture to even larger modular networks and exploring how to adapt general knowledge to specific downstream tasks without "forgetting" pre-trained information.

Summary updated

BibTeX
@inproceedings{hu2024scalable,
  author = {Minyang Hu and Hong Chang and Bingpeng Ma and Shiguang Shan and Xilin CHEN},
  title = {{Scalable Modular Network: A Framework for Adaptive Learning via Agreement Routing}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=pEKJl5sflp},
}
Figure