arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2211.05102cs.LGcs.CL
收藏

有效扩展Transformer推理

Efficiently Scaling Transformer Inference

Google(谷歌)

Reiner Pope, Sholto Douglas, Aakanksha Chowdhery, Jacob Devlin, James Bradbury, Anselm Levskaya, Jonathan Heek, Kefan Xiao, Shivani Agrawal, Jeff Dean

摘要:

我们研究了Transformer模型的高效生成推理问题,在其最具挑战性的设置之一:大型深度模型,具有紧密的延迟目标和长序列长度。更好地理解大型基于transformer的模型的推理的工程权衡非常重要,因为这些模型的用例在整个应用领域中快速增长。我们开发了一个简单的推理效率分析模型,根据应用需求选择最佳的TPU v4切片优化多维分区技术。我们将这些与一套低级优化相结合,以在500 B+参数模型上实现延迟和模型FLOPS利用率(MFU)权衡的新Pareto前沿,该模型优于FasterTransformer基准测试套件。我们进一步表明,通过适当的分区,多查询注意力(即多个查询头共享单个键/值头)的内存需求较低,可以扩展到32倍更大的上下文长度。最后,我们在生成过程中实现了每个令牌29 ms的低批量延迟(使用int 8权重量化),在输入令牌的大批量处理过程中实现了76%的MFU,同时在PaLM 540 B参数模型上支持长2048令牌上下文长度。

英文摘要:

We study the problem of efficient generative inference for Transformer models, in one of its most challenging settings: large deep models, with tight latency targets and long sequence lengths. Better understanding of the engineering tradeoffs for inference for large Transformer-based models is important as use cases of these models are growing rapidly throughout application areas. We develop a simple analytical model for inference efficiency to select the best multi-dimensional partitioning techniques optimized for TPU v4 slices based on the application requirements. We combine these with a suite of low-level optimizations to achieve a new Pareto frontier on the latency and model FLOPS utilization (MFU) tradeoffs on 500B+ parameter models that outperforms the FasterTransformer suite of benchmarks. We further show that with appropriate partitioning, the lower memory requirements of multiquery attention (i.e. multiple query heads share single key/value head) enables scaling up to 32x larger context lengths. Finally, we achieve a low-batch-size latency of 29ms per token during generation (using int8 weight quantization) and a 76% MFU during large-batch-size processing of input tokens, while supporting a long 2048-token context length on the PaLM 540B parameter model.

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

↑