[论文解读] A Survey of Techniques for Optimizing Transformer Inference
本综述汇总并分类了优化 transformer 推理的方法,涵盖算法压缩(蒸馏、剪枝、量化、NAS)和硬件加速器,以及在准确度、延迟和能耗上的权衡。
Recent years have seen a phenomenal rise in performance and applications of transformer neural networks. The family of transformer networks, including Bidirectional Encoder Representations from Transformer (BERT), Generative Pretrained Transformer (GPT) and Vision Transformer (ViT), have shown their effectiveness across Natural Language Processing (NLP) and Computer Vision (CV) domains. Transformer-based networks such as ChatGPT have impacted the lives of common men. However, the quest for high predictive performance has led to an exponential increase in transformers' memory and compute footprint. Researchers have proposed techniques to optimize transformer inference at all levels of abstraction. This paper presents a comprehensive survey of techniques for optimizing the inference phase of transformer networks. We survey techniques such as knowledge distillation, pruning, quantization, neural architecture search and lightweight network design at the algorithmic level. We further review hardware-level optimization techniques and the design of novel hardware accelerators for transformers. We summarize the quantitative results on the number of parameters/FLOPs and accuracy of several models/techniques to showcase the tradeoff exercised by them. We also outline future directions in this rapidly evolving field of research. We believe that this survey will educate both novice and seasoned researchers and also spark a plethora of research efforts in this field.
研究动机与目标
- 由于模型规模和部署需求增加,激发对高效 transformer 推理的需求。
- 综述减少模型大小和计算量的算法技术(蒸馏、剪枝、量化、NAS、轻量化设计)。
- 综述面向硬件的优化与 transformer 加速器设计。
- 提供分类、实际权衡,以及关于参数、FLOPs 与准确度的定量洞察。
- 概述 transformer 推理在联合设计与基准测试方面的未来方向。
提出的方法
- 介绍 transformer 基础知识,包括嵌入、自注意力、MHA 和 FFN。
- 对 NLP 与视觉 transformer 的蒸馏、剪枝、量化、NAS 和轻量化架构方法进行分类与综述。
- 讨论面向硬件的优化与加速器设计(ASIC/FPGA/GPU)以及联合设计的考量。
- 提供带有定量结果的分类法与权衡(参数/ FLOPs 与准确度)。
- 总结硬件-软件 协同设计与基准测试中的挑战与未来研究方向。
实验结果
研究问题
- RQ1降低 transformer 推理成本的主要算法技术及其在准确度和延迟方面的权衡是什么?
- RQ2在剪枝、量化、知识蒸馏和 NAS 方面,与硬件兼容性及部署效率相比如何?
- RQ3有哪些硬件加速策略和联合设计机会可在现代设备上优化 transformer 推理?
- RQ4为了推进高效 transformer 推理,需要哪些未来的方向和基准测试?
主要发现
- 知识蒸馏可以产生更小的模型并带来显著的速度提升(例如 DistilBERT 在保持约 97% 的语言能力的同时,规模缩小约 40%)。
- 剪枝可以实现显著的延迟降低(例如 oBERT 在 Intel CPU 上实现 10× 加速,准确率损失小于 1%),而面向硬件的策略则提高了实际收益。
- 量化可以将模型大小最多降低到 4×(例如 Q8BERT 将 32 位降至 8 位),且准确性损失极小。
- 面向硬件的神经网络架构搜索(HW-NAS)可在 CPU/GPU/移动端上获得更好的验证指标和更低的延迟。
- 综述强调,若未进行硬件意识设计的简单剪枝可能无法带来延迟/能耗的收益,凸显了联合设计的必要性。
- 本文提供了一套优化技术的分类法,并讨论了未来方向,如新硬件架构和基准测试。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。