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 about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 81f2ab56-dd92-4976-8dd1-4b4b68610edeCited 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
- 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
- RNNRepair: Automatic RNN Repair via Model-based AnalysisXiaofei Xie, Wenbo Guo, Lei Ma, Wei Le et al.ICML 2021 · 21 citations
