LightSeq2: Accelerated Training for Transformer-based Models on GPUs

Xiaohui Wang, Yang Wei, Ying Xiong, Guyue Huang, Xian Qian +3 more
10/12/2021
cs.CLcs.MS
transformer-attention

Official code: bytedance/lightseq (3,289 stars, C++, last commit 2023-05-16).

Abstract

Transformer-based neural models are used in many AI applications. Training these models is expensive, as it takes huge GPU resources and long duration.

Show full abstract

It is challenging because typical data like sentences have variable lengths, and Transformer's computation patterns are more complex than convolutional neural networks. Existing systems either only focus on model inference or optimization for only BERT-like encoder models. In this paper, we present LightSeq2, a system to accelerate training for a general family of Transformer models on GPUs. We propose a series of GPU optimization techniques tailored to the specific computation flow and memory access patterns of Transformer models. LightSeq2 supports many model architectures, including BERT (encoder-only), GPT (decoder-only), Transformer (encoder-decoder), and vision Transformer. Our experiments for a variety of models and benchmarks show that LightSeq2 is consistently faster (1.4-3.5x) than previous systems on different GPUs. In particular, it gains 308% training speedup compared with existing systems on a large public machine translation benchmark (WMT14 English-German).

View on arXivView PDF

Code Implementations(1)

bytedance/lightseqOfficial100%

LightSeq: A High Performance Library for Sequence Processing and Generation

3,289332C++, CudaDec 6, 20193 years agoNOASSERTION
acceleratebartbeam-searchbertcuda+7 more

Similar Papers

Cite this paper

@article{wang2021lightseq,
  title  = {LightSeq2: Accelerated Training for Transformer-based Models on GPUs},
  author = {Xiaohui Wang and Yang Wei and Ying Xiong and Guyue Huang and Xian Qian and Yufei Ding and Mingxuan Wang and Lei Li},
  year   = {2021},
  eprint = {2110.05722},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2110.05722}
}

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

Discussion