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

FastSeq:使序列生成更快

FastSeq: Make Sequence Generation Faster

Microsoft(微软);Microsoft Research Asia(微软亚洲研究院)

Yu Yan, Fei Hu, Jiusheng Chen, Nikhil Bhendawade, Ting Ye, Yeyun Gong, Nan Duan, Desheng Cui, Bingyu Chi, Ruofei Zhang

摘要:

基于transformer的模型在自然语言生成中产生了巨大的影响。然而,由于自回归解码过程中涉及的大模型尺寸和密集计算,推理速度是一个瓶颈。我们开发了FastSeq框架来加速序列生成而不会损失准确性。所提出的优化技术包括注意缓存优化、检测重复n-gram的有效算法以及具有并行I/O的异步生成流水线。这些优化足够通用,可以应用于基于transformer的模型(例如,T5、GPT 2和UniLM)。我们在一组广泛使用的不同模型上的基准测试结果表明,推理速度提高了4- 9倍。此外,FastSeq易于使用,只需简单的一行代码更改。源代码可在https://github.com/microsoft/fastseq上获得。

英文摘要:

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. 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.

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

↑