SHARCS: Efficient Transformers through Routing with Dynamic Width Sub-networks

Mohammadreza Salehi, Sachin Mehta, Aditya Kusupati, Ali Farhadi, Hannaneh Hajishirzi
10/18/2023
cs.LGcs.AIcs.CL

No confident code implementation found for this paper.

Abstract

We introduce SHARCS for adaptive inference that takes into account the hardness of input samples. SHARCS can train a router on any transformer network, enabling the model to direct different samples to sub-networks with varying widths. Our experiments demonstrate that: (1) SHARCS outperforms or complements existing per-sample adaptive inference methods across various classification tasks in terms of accuracy vs. FLOPs; (2) SHARCS generalizes across different architectures and can be even applied to compressed and efficient transformer encoders to further improve their efficiency; (3) SHARCS can provide a 2 times inference speed up at an insignificant drop in accuracy.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{salehi2023sharcs,
  title  = {SHARCS: Efficient Transformers through Routing with Dynamic Width Sub-networks},
  author = {Mohammadreza Salehi and Sachin Mehta and Aditya Kusupati and Ali Farhadi and Hannaneh Hajishirzi},
  year   = {2023},
  eprint = {2310.12126},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2310.12126v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2310.12126.svg)](https://codeofpaper.com/paper/2310.12126)

Discussion