DeFormer: Decomposing Pre-trained Transformers for Faster Question Answering

Qingqing Cao, Harsh Trivedi, Aruna Balasubramanian, Niranjan Balasubramanian
5/2/2020
cs.CLcs.AIcs.LG
transformer-attention

Official code: StonyBrookNLP/deformer (120 stars, Python, MIT, last commit 2023-05-22).

Abstract

Transformer-based QA models use input-wide self-attention -- i.e. across both the question and the input passage -- at all layers, causing them to be slow and memory-intensive. It turns out that we can get by without input-wide self-attention at all layers, especially in the lower layers.

Show full abstract

We introduce DeFormer, a decomposed transformer, which substitutes the full self-attention with question-wide and passage-wide self-attentions in the lower layers. This allows for question-independent processing of the input text representations, which in turn enables pre-computing passage representations reducing runtime compute drastically. Furthermore, because DeFormer is largely similar to the original model, we can initialize DeFormer with the pre-training weights of a standard transformer, and directly fine-tune on the target QA dataset. We show DeFormer versions of BERT and XLNet can be used to speed up QA by over 4.3x and with simple distillation-based losses they incur only a 1% drop in accuracy. We open source the code at https://github.com/StonyBrookNLP/deformer.

View on arXivView PDF

Code Implementations(1)

MIT

[ACL 2020] DeFormer: Decomposing Pre-trained Transformers for Faster Question Answering

12014Python, ShellMay 1, 20203 years agoMIT
acl2020decompositiondeformerquestion-answeringtransformer

Similar Papers

Cite this paper

@article{cao2020deformer,
  title  = {DeFormer: Decomposing Pre-trained Transformers for Faster Question Answering},
  author = {Qingqing Cao and Harsh Trivedi and Aruna Balasubramanian and Niranjan Balasubramanian},
  year   = {2020},
  eprint = {2005.00697},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2005.00697}
}

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/2005.00697.svg)](https://codeofpaper.com/paper/2005.00697)

Discussion