Code Monkey home page Code Monkey logo

decomposernnintomodules's Introduction

Decompose a RNN model into modules

Title: Decomposing a Recurrent Neural Network into Modules for Enabling Reusability and Replacement

Authors: Sayem Mohammad Imtiaz, Fraol Batole, Astha Singh, Rangeet Pan, Breno Dantas Cruz, and Hridesh Rajan

PDF: https://arxiv.org/pdf/2212.05970.pdf

Modularity and decomposition are central ideas in software engineering that enable better software evolution. One of the important benefits of decomposing software into modules is the ability to reassemble and replace modules flexibly. This paper proposes an approach to decompose a trained model into modules to enable such benefits for recurrent neural networks. In particular, it introduces a method for breaking down a trained RNN model into separate modules, one for each output class. The research question evaluated in this paper examines the efficacy of this decomposition technique and its applicability in various scenarios. In particular, the paper asks three research questions:

  • RQ1 - Decomposition quality: Does decomposing the RNN model into modules incur cost?
  • RQ2 - Reusability: Can Decomposed Modules be Reused to Create a New Problem?
  • RQ3 - Replaceability: Can Decomposed Modules be Replaced?

This repository exposes all the code, data, and instructions to reproduce the results presented in the paper.

Project structure

The structure of this repository has been detailed here.

Installation and Usage

Please follow this documentation to install the system and make it runnable.

Running experiments

The paper evaluates three research questions (RQ). Detailed instruction to reproduce results for every RQs are listed in the following files:

  1. RQ1: The quality of the RNN decomposition (in terms of accuracy), and the similarity between the model and modules (in terms of Jaccard index) are evaluated in this RQ. The detailed instructions can be found here.
  2. RQ2: This RQ evaluates different reuse scenarios. The detailed instructions can be found here.
  3. RQ3: This RQ evaluates different replacement scenarios. The detailed instructions can be found here.

DOI of Replication Package

DOI

Please cite the paper as:

@inproceedings{imtiaz23rnn,
  author = {Sayem Mohammad Imtiaz and Fraol Batole and Astha Singh and Rangeet Pan and Breno Dantas Cruz and Hridesh Rajan},
  title = {Decomposing a Recurrent Neural Network into Modules for Enabling Reusability and Replacement},
  booktitle = {ICSE'23: The 45th International Conference on Software Engineering},
  location = {Melbourne, Australia},
  month = {May 14-May 20},
  year = {2023},
  entrysubtype = {conference},
  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 multiclass 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 nonlinear 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, Clinc 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.
  }

decomposernnintomodules's People

Contributors

astha99 avatar sayemimtiaz avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.