Neural Network Module Decomposition and Recomposition

Hiroaki Kingetsu, Kenichi Kobayashi, Taiji SuzukiarXiv 2021

Abstract

We propose a modularization method that decomposes a deep neural network (DNN) into small modules from a functionality perspective and recomposes them into a new model for some other task. Decomposed modules are expected to have the advantages of interpretability and verifiability due to their small size. In contrast to existing studies based on reusing models that involve retraining, such as a transfer learning model, the proposed method does not require retraining and has wide applicability as it can be easily combined with existing functional modules. The proposed method extracts modules using weight masks and can be applied to arbitrary DNNs. Unlike existing studies, it requires no assumption about the network architecture. To extract modules, we designed a learning method and a loss function to maximize shared weights among modules. As a result, the extracted modules can be recomposed without a large increase in the size. We demonstrate that the proposed method can decompose and recompose DNNs with high compression ratio and high accuracy and is superior to the existing method through sharing weights between modules.

Introduction

Modern deep learning models are typically monolithic "black boxes." While highly effective, these large models are computationally expensive and difficult to interpret or verify. For instance, a 100-class classifier is often overkill for an application only requiring a 5-class subset. Traditionally, developers must either use the full model as-is or retrain a smaller one from scratch. This paper introduces a framework to decompose large, pre-trained DNNs into small, class-specific modules that can be recomposed like Lego blocks to create efficient sub-task classifiers—all without any retraining of the original network weights.

Methodology

The proposed framework relies on three primary components to achieve modularity without catastrophic forgetting or architectural constraints.

Supermasks and Edge-Popup

Instead of modifying the weights of a pre-trained model, the method identifies specialized subnetworks using "supermasks"—binary matrices that select specific edges. The edge-popup algorithm is employed to find these "winning ticket" subnetworks within the frozen weights of the original model.

Grafting Layers

To transform a multi-class model into a binary module (e.g., "is this Class 2?"), a tiny, fully connected "grafting layer" is appended to the subnetwork. This is the only component that undergoes traditional training, ensuring the core feature extraction remains unchanged.

Module Stemming and Co-training

A significant challenge in modularization is "bloat"—if modules are extracted independently, they may use disjoint sets of neurons, leading to a massive model when combined. The authors introduce Module Stemming, which utilizes a "stemming loss" function to encourage different modules to share as many edges as possible. Through Module Co-training, all class modules are trained simultaneously, guided by an average mask score to ensure structural consistency across the network.

Conceptual framework for decomposing a trained model into class-specific modules and recomposing them for new tasks.

Experimental Evaluation

The method was evaluated using standard computer vision benchmarks, including MNIST, Fashion-MNIST, SVHN, CIFAR-10, and CIFAR-100. The researchers tested the approach across diverse architectures, ranging from simple fully connected networks to complex models like VGG16, ResNet50, and WideResNet28-10.

Results and Discussion

The experiments demonstrate that the proposed method achieves high compression ratios while maintaining high accuracy. For example, on MNIST, a 10-class model could be recomposed into a 2-class classifier using only ~12% of the original parameters with ~96% accuracy.

A key metric for modularity is the Jaccard Index (JI), which measures the overlap of edges between modules. A higher JI indicates more efficient weight sharing. As shown in the comparison with baselines like TI-I and CM-RIE, the "Module Stemming" approach consistently achieves higher JI scores across various datasets and models, proving its effectiveness in creating compact recomposed networks.

Performance comparison against baselines, highlighting the improved Jaccard Index (JI) achieved by Module Stemming.

Conclusion

This research provides a robust method for neural network decomposition and recomposition. By leveraging supermasks and a novel stemming loss, the framework allows for the creation of specialized, efficient, and interpretable modules from monolithic models. Future work will explore scaling this approach to datasets with thousands of classes and analyzing whether shared edges correspond to specific visual features, further enhancing model interpretability.

Summary updated

BibTeX
@misc{kingetsu2021neural,
  author = {Hiroaki Kingetsu and Kenichi Kobayashi and Taiji Suzuki},
  title = {{Neural Network Module Decomposition and Recomposition}},
  year = {2021},
  eprint = {2112.13208},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.13208},
}
Figure