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

Reusing Convolutional Neural Network Models through Modularization and Composition

Binhang Qi, Hailong Sun, Hongyu Zhang, Xiang Gao

TL;DR

This paper introduces a "Lego-like" approach to deep learning by decomposing monolithic Convolutional Neural Networks (CNNs) into small, reusable, class-specific modules. By using a novel gradient-based search method called GradSplitter, the authors demonstrate that you can "patch" weak models or build new ones through composition with negligible accuracy loss and significantly reduced computational overhead.

What Problem Does This Paper Address?

Deep learning models are typically treated as "black boxes"—monolithic structures that are difficult to update or reuse partially. If a model performs poorly on a specific class (e.g., it's great at identifying dogs but terrible at cats), developers usually have to retrain the entire network on a massive dataset, which is computationally expensive and time-consuming.

While software engineering has long embraced modularization (breaking systems into smaller, swappable parts), applying this to CNNs is hard. Previous attempts at modularization often resulted in "uncompressed" modules that were just as large as the original model but filled with zeros (sparse matrices). This paper tackles the challenge of compressed modularization: creating modules that are physically smaller and faster by removing unnecessary convolution kernels entirely.

Methods

The authors propose two main frameworks for model decomposition:

  1. CNNSplitter: This approach uses a Genetic Algorithm (GA) to search for the optimal set of kernels for a specific class. To make the massive search space manageable, it groups kernels based on their "importance" (activation levels) and uses "sensitivity-based initialization" to focus on layers that are most critical to performance.
  2. GradSplitter: This is the more advanced, gradient-based evolution. It introduces a differentiable mask and a small "head" (fully connected layers) for each class. By using a Straight-Through Estimator (STE), the system can backpropagate through the binary mask to learn exactly which kernels are essential for recognizing a specific class.
The overall workflow of model modularization and composition.

Once modules are created, they can be composed. Because different modules might have been trained on different data distributions, the authors use a normalization step to ensure their output probabilities are comparable before making a final prediction.

An illustration of creating a module using GradSplitter's mask and head.

Datasets

The researchers evaluated their techniques on three standard benchmarks:

  • CIFAR-10: 10 classes of natural images.
  • CIFAR-100: 100 classes of natural images.
  • SVHN (Street View House Numbers): Digit recognition.

To test "weak" models, they created specialized variants (CIFAR-W and SVHN-W) designed to simulate overly simple, underfitted, or overfitted scenarios.

Key Insights and Ideas

  • Kernel Specialization: The study confirms that lower layers in a CNN tend to learn general features (edges, textures) useful for all classes, while higher layers are highly specialized. GradSplitter naturally retains more kernels in the lower layers and aggressively prunes the higher ones.
  • Parallelism is a Speed Hack: While a composed model consists of multiple modules, running them in parallel is actually 28.6% faster than running the original monolithic model. This is because each module is significantly smaller (~37% of the original size).
  • The Normalization Necessity: You can't just "plug and play" modules from different sources. The authors found that normalizing module outputs using the training data's distribution is critical to prevent one module from "screaming" louder than others in the final decision.

Key Results

  • Minimal Accuracy Loss: Decomposing a model into GradSplitter modules and then recomposing them results in an average accuracy loss of only 0.58%.
  • Effective Patching: When a "strong" module was used to patch a "weak" model, the average improvement in F1-score was 11.47%.
  • Efficiency: GradSplitter modules are much smaller than those produced by the GA-based CNNSplitter, retaining nearly 20% fewer kernels while achieving better accuracy.
  • New Task Performance: Building a model for a completely new task by reusing existing modules achieved accuracy within 2.46% of a model trained from scratch, but without the massive training cost.

Limitations and Future Work

The authors acknowledge a few hurdles:

  • Memory Overhead: While parallel execution is faster, it requires more GPU memory to hold multiple module instances simultaneously.
  • Architectural Scope: This work focused on CNNs (SimCNN, ResCNN, InceCNN). The authors plan to explore if these techniques translate to Transformers and Large Language Models (LLMs), specifically at the granularity of attention heads.
  • Semantic Hierarchies: Future work could involve "hierarchical modularization," where modules are broken down further based on semantic relationships (e.g., a "mammal" module that can be further decomposed into "cat" and "dog").

For those interested in the implementation, the source code is available on GitHub for both CNNSplitter and GradSplitter.

Summary updated

BibTeX
@article{qi2024reusing,
  author = {Binhang Qi and Hailong Sun and Hongyu Zhang and Xiang Gao},
  title = {{Reusing Convolutional Neural Network Models through Modularization and Composition}},
  journal = {ACM Trans. Softw. Eng. Methodol.},
  year = {2024},
  url = {https://openreview.net/forum?id=Lj0XFcunSN},
}
Figure