The Transformer has been an indispensable staple in deep learning. However, for real-life applications, it is very challenging to deploy efficient Transformers due to immense parameters and operations of models. To relieve this burden, exploiting sparsity is an effective approach to accelerate Transformers. Newly emerging Ampere GPUs leverage a 2:4 sparsity pattern to achieve model acceleration, while it can hardly meet the diverse algorithm and hardware constraints when deploying models. By contrast, we propose an algorithm-hardware co-optimized framework to flexibly and efficiently accelerate Transformers by utilizing general N:M sparsity patterns. (1) From algorithm perspective, we propose a sparsity inheritance mechanism along with an inherited dynamic pruning (IDP) method to obtain a series of N:M sparse candidate Transformers rapidly. A model compression scheme is further proposed to significantly reduce the storage requirement for deployment. (2) From hardware perspective, we present a flexible and efficient hardware architecture, namely STA, to achieve significant speedup when deploying N:M sparse Transformers. STA features not only a computing engine unifying both sparse-dense and dense-dense matrix multiplications with high computational efficiency but also a scalable softmax module eliminating the latency from intermediate off-chip data communication. Experimental results show that compared to other methods, N:M sparse Transformers, generated using IDP, achieves an average of 6.7% improvement on accuracy with high training efficiency. Moreover, STA can achieve 14.47x and 11.33x speedup compared to Intel i9-9900X and NVIDIA RTX 2080 Ti, respectively, and perform 2.00-19.47x faster inference than the state-of-the-art FPGA-based accelerators for Transformers.
翻译:变压器是深层学习中不可或缺的主菜。 但是,对于现实生活应用来说,由于模型的参数和运行量巨大,部署高效变压器非常困难。 为了减轻这一负担,利用宽度是加速变压器的有效方法。 新兴的Ampere GPS 利用了2:4的宽度模式来实现模型加速, 而它很难在部署模型时满足不同的算法和硬件限制。 相反,我们建议了一个算法-硬件共同优化框架,以便通过使用通用的 N:M 宽度模式灵活和高效地加速变压器。 (1) 从算法角度看,我们提议一个变压器继承机制,同时采用一种传承的动态调整(IDP)方法来快速加速变压变压器。 新的A: M 分散的候选变压器变压器快速进行一系列 N: 进一步建议大幅降低部署的存储要求。 (2) 从硬件角度看,我们提出了一个灵活而高效的硬件结构,即STA,在部署N:M 稀释变压变压器时实现大幅度的加速速度。 2. STA的计算机发动机不仅可以将稀薄和密集变压式变压式变压式变压器的变压器进行20- 并且从软式变压的变压的变压的变压的变压式的变压的变压器,而且从高的变压式的变压式的变压式的变压式的变压器, 将高的变压式的变压式的变压器的变压器的变压的变压的变压的变压的变压式的变压式的变压的变压式的变压的变压的变压的变压式的变压式的变压的变压的变压的变压的变压式的变压的变压式的变压的变压的变压器, 将的变压式的变压式的变压的变压式的变压的变压式的变压的变压式的变压的变压的变压的变压式的变压的变压的变压的变压的变压的变压式的变压的变压的变压的变压式的变压的变压式的变压的变压的变压的变压