arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2210.03052cs.LG
收藏

ByteTransformer:一种适用于变长输入的高性能Transformer

ByteTransformer: A High-Performance Transformer Boosted for Variable-Length Inputs

University of California, Riverside(加州大学河滨分校);ByteDance Ltd.(字节跳动有限公司);NVIDIA Corporation(英伟达公司)

Yujia Zhai, Chengquan Jiang, Leyuan Wang, Xiaoying Jia, Shang Zhang, Zizhong Chen, Xin Liu, Yibo Zhu

摘要:

在过去的十年中,Transformers已经成为自然语言处理中的关键模型。它们在深度学习应用中非常受欢迎,但Transformer模型所需的参数空间越来越大,因此需要相应地提高性能。自然语言处理问题也经常面临可变长度序列,因为单词计数通常在句子之间变化。现有的深度学习框架将可变长度序列填充到最大长度,这增加了显著的存储器和计算开销。在本文中,我们提出了字节Transformer,一个高性能的Transformer升压可变长度的输入。我们提出了一个无填充算法,解放了整个Transformer从零填充令牌的冗余计算。除了算法级优化,我们还为Transformer功能模块提供架构感知优化,尤其是性能关键算法多头注意力(MHA)。在具有可变长度序列输入的NVIDIA A100 GPU上的实验结果验证了我们的融合MHA比PyTorch高出6.13倍。前向BERT Transformer的ByteTransformer的端到端性能分别超过PyTorch JIT、TensorFlow XLA、Tencent TurboTransformer、Microsoft DeepSpeed-Inference和NVIDIA Faster Transformer等最先进的Transformer框架87\%、131\%、138\%、74\%和55\%。我们还证明了我们的优化方法的一般适用性,其他BERT类模型,包括ALBERT,DistilBERT,和DeBERTa。

英文摘要:

Transformers have become keystone models in natural language processing over the past decade. They have achieved great popularity in deep learning applications, but the increasing sizes of the parameter spaces required by transformer models generate a commensurate need to accelerate performance. Natural language processing problems are also routinely faced with variable-length sequences, as word counts commonly vary among sentences. Existing deep learning frameworks pad variable-length sequences to a maximal length, which adds significant memory and computational overhead. In this paper, we present ByteTransformer, a high-performance transformer boosted for variable-length inputs. We propose a padding-free algorithm that liberates the entire transformer from redundant computations on zero padded tokens. In addition to algorithmic-level optimization, we provide architecture-aware optimizations for transformer functional modules, especially the performance-critical algorithm Multi-Head Attention (MHA). Experimental results on an NVIDIA A100 GPU with variable-length sequence inputs validate that our fused MHA outperforms PyTorch by 6.13x. The end-to-end performance of ByteTransformer for a forward BERT transformer surpasses state-of-the-art transformer frameworks, such as PyTorch JIT, TensorFlow XLA, Tencent TurboTransformer, Microsoft DeepSpeed-Inference and NVIDIA FasterTransformer, by 87\%, 131\%, 138\%, 74\% and 55\%, respectively. We also demonstrate the general applicability of our optimization methods to other BERT-like models, including ALBERT, DistilBERT, and DeBERTa.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑