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

TurboTransformers:一个高效的Transformer模型GPU服务系统

TurboTransformers: An Efficient GPU Serving System For Transformer Models

Pattern Recognition Center, Wechat AI, Tencent Inc(腾讯微信AI模式识别中心)

Jiarui Fang, Yang Yu, Chengduo Zhao, Jie Zhou

摘要:

Transformer是近年来自然语言处理领域最重要的算法创新。与递归神经网络(RNN)模型不同,Transformers可以并行处理序列长度的维度,因此在长序列上具有更好的准确性。然而,在配备GPU的数据中心中为在线服务高效部署它们并不容易。首先,由Transformer结构引入的更多计算使得满足服务的延迟和吞吐量约束更具挑战性。第二,NLP任务采用可变长度的句子。输入维数的可变性给有效的存储管理和服务优化带来了严重的问题。本文设计了一个Transformer服务系统TurboTransformers,该系统由计算运行时和服务框架两部分组成。三大创新特点使其在同类作品中脱颖而出。提出了一种有效的并行算法,用于基于GPU的批量约简操作,如Softmax和LayerNorm,除了BLAS例程之外的主要热点。针对变长输入的情况,设计了一种内存分配算法,该算法能够更好地平衡内存占用和分配/释放效率。一个服务框架配备了一个新的批处理调度器,使用动态规划实现可变长度的请求的最佳吞吐量。该系统可以实现最先进的Transformer模型,在GPU平台上提供性能,并且可以通过几行代码无缝集成到PyTorch代码中。

英文摘要:

The transformer is the most critical algorithm innovation of the Nature Language Processing (NLP) field in recent years. Unlike the Recurrent Neural Network (RNN) models, Transformers can process on dimensions of sequence lengths in parallel, therefore leading to better accuracy on long sequences. However, efficient deployments of them for online services in data centers equipped with GPUs are not easy. First, more computation introduced by transformer structures makes it more challenging to meet the latency and throughput constraints of serving. Second, NLP tasks take in sentences of variable length. The variability of input dimensions brings a severe problem to efficient memory management and serving optimization. This paper designed a transformer serving system called TurboTransformers, which consists of a computing runtime and a serving framework to solve the above challenges. Three innovative features make it stand out from other similar works. An efficient parallel algorithm is proposed for GPU-based batch reduction operations, like Softmax and LayerNorm, major hot spots besides BLAS routines. A memory allocation algorithm, which better balances the memory footprint and allocation/free efficiency, is designed for variable-length input situations. A serving framework equipped with a new batch scheduler using dynamic programming achieves the optimal throughput on variable-length requests. The system can achieve the state-of-the-art transformer model serving performance on GPU platforms and can be seamlessly integrated into your PyTorch code with a few lines of code.

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

↑