FastSeq: Make Sequence Generation Faster

Yu Yan, Fei Hu, Jiusheng Chen, Nikhil Bhendawade, Ting Ye +5 more
6/8/2021
cs.CLcs.LG
transformer-attention

Official code: microsoft/fastseq (431 stars, Python, MIT, last commit 2022-08-17).

Abstract

Transformer-based models have made tremendous impacts in natural language generation. However the inference speed is a bottleneck due to large model size and intensive computing involved in auto-regressive decoding process.

Show full abstract

We develop FastSeq framework to accelerate sequence generation without accuracy loss. The proposed optimization techniques include an attention cache optimization, an efficient algorithm for detecting repeated n-grams, and an asynchronous generation pipeline with parallel I/O. These optimizations are general enough to be applicable to Transformer-based models (e.g., T5, GPT2, and UniLM). Our benchmark results on a set of widely used and diverse models demonstrate 4-9x inference speed gain. Additionally, FastSeq is easy to use with a simple one-line code change. The source code is available at https://github.com/microsoft/fastseq.

View on arXivView PDF

Code Implementations(1)

microsoft/fastseqOfficial100%
MIT

An efficient implementation of the popular sequence models for text generation, summarization, and translation tasks. https://arxiv.org/pdf/2106.04718.pdf

43139Python, ShellJul 15, 20204 years agoMIT

Similar Papers

Cite this paper

@article{yan2021fastseq,
  title  = {FastSeq: Make Sequence Generation Faster},
  author = {Yu Yan and Fei Hu and Jiusheng Chen and Nikhil Bhendawade and Ting Ye and Yeyun Gong and Nan Duan and Desheng Cui and Bingyu Chi and Ruofei Zhang},
  year   = {2021},
  eprint = {2106.04718},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2106.04718}
}

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

Discussion