Decomposing a Recurrent Neural Network into Modules for Enabling Reusability and Replacement
Sayem Mohammad Imtiaz, Fraol Batole, Astha Singh, Rangeet Pan, Breno Dantas Cruz, Hridesh Rajan
Abstract
Can we take a recurrent neural network (RNN) trained to translate between languages and augment it to support a new natural language without retraining the model from scratch? Can we fix the faulty behavior of the RNN by replacing portions associated with the faulty behavior? Recent works on decomposing a fully connected neural network (FCNN) and convolutional neural network (CNN) into modules have shown the value of engineering deep models in this manner, which is standard in traditional SE but foreign for deep learning models. However, prior works focus on the image-based multi-class classification problems and cannot be applied to RNN due to (a) different layer structures, (b) loop structures, (c) different types of input-output architectures, and (d) usage of both non-linear and logistic activation functions. In this work, we propose the first approach to decompose an RNN into modules. We study different types of RNNs, i.e., Vanilla, LSTM, and GRU. Further, we show how such RNN modules can be reused and replaced in various scenarios. We evaluate our approach against 5 canonical datasets (i.e., Math QA, Brown Corpus, Wiki-toxicity, Cline OOS, and Tatoeba) and 4 model variants for each dataset. We found that decomposing a trained model has a small cost (Accuracy: -0.6%, BLEU score: +0.10%). Also, the decomposed modules can be reused and replaced without needing to retrain.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
4 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Decomposing Convolutional Neural Networks into Reusable and Replaceable Modules cites On decomposing a deep neural network into modules
- Design by Contract for Deep Learning APIs cites Decomposing Convolutional Neural Networks into Reusable and Replaceable Modules
- Design by Contract for Deep Learning APIs cites On decomposing a deep neural network into modules
- BDefects4NN: A Backdoor Defect Database for Controlled Localization Studies in Neural Networks cites On decomposing a deep neural network into modules
- Inferring Data Preconditions from Deep Learning Models for Trustworthy Prediction in Deployment cites Decomposing Convolutional Neural Networks into Reusable and Replaceable Modules
- Inferring Data Preconditions from Deep Learning Models for Trustworthy Prediction in Deployment cites Design by Contract for Deep Learning APIs
- Inferring Data Preconditions from Deep Learning Models for Trustworthy Prediction in Deployment cites On decomposing a deep neural network into modules
- DNN Modularization via Activation-Driven Training cites Decomposing Convolutional Neural Networks into Reusable and Replaceable Modules
- DNN Modularization via Activation-Driven Training cites On decomposing a deep neural network into modules
Cited by top-tier papers4
- Design by Contract for Deep Learning APIsShibbir Ahmed, Sayem Mohammad Imtiaz, Syeda Khairunnesa Samantha, Breno Dantas Cruz et al.FSE 2023 · 10 citations
- Inferring Data Preconditions from Deep Learning Models for Trustworthy Prediction in DeploymentShibbir Ahmed, Hongyang Gao, Hridesh RajanICSE 2024 · 3 citations
- DNN Modularization via Activation-Driven TrainingTuan Ngo, Abid Hassan, Saad Shafiq, Nenad MedvidovićICSE 2026 · 2 citations
- BDefects4NN: A Backdoor Defect Database for Controlled Localization Studies in Neural NetworksYisong Xiao, Aishan Liu, Xinwei Zhang, Tianyuan Zhang et al.ICSE 2025
Builds on4
- Traceability Transformed: Generating more Accurate Links with Pre-Trained BERT ModelsJinfeng Lin, Yalin Liu, Qingkai Zeng, Meng Jiang et al.ICSE 2021 · 124 citations
- On decomposing a deep neural network into modulesRangeet Pan, Hridesh RajanFSE 2020 · 38 citations
- Automating the removal of obsolete TODO commentsZhipeng Gao, Xin Xia, David Lo, John C. Grundy et al.FSE 2021 · 34 citations
- Decomposing Convolutional Neural Networks into Reusable and Replaceable ModulesRangeet Pan, Hridesh RajanICSE 2022 · 30 citations
Related papers
- Patching Weak Convolutional Neural Network Models through Modularization and CompositionBinhang Qi, Hailong Sun, Xiang Gao, Hongyu ZhangASE 2022 · 13 citations
- Modularizing while Training: A New Paradigm for Modularizing DNN ModelsBinhang Qi, Hailong Sun, Hongyu Zhang, Ruobing Zhao et al.ICSE 2024 · 3 citations
- AUTOTRAINER: An Automatic DNN Training Problem Detection and Repair SystemXiaoyu Zhang, Juan Zhai, Shiqing Ma, Chao ShenICSE 2021 · 62 citations
- Recyclable Tuning for Continual Pre-trainingYujia Qin, Cheng Qian, Xu Han, Yankai Lin et al.ACL Findings 2023 · 4 citations
- TRADER: trace divergence analysis and embedding regulation for debugging recurrent neural networksGuanhong Tao, Shiqing Ma, Yingqi Liu, Qiuling Xu et al.ICSE 2020 · 14 citations
