arXiv:2410.16135cs.LGcs.AI2024-10被引 3

探索V:N:M稀疏模式,让Transformer模型在GPU上实现更灵活高效的推理加速。

Beyond 2:4: exploring V:N:M sparsity for efficient transformer inference on GPUs

  • 提出V:N:M稀疏模式,突破2:4稀疏的固定比例限制,支持更多稀疏率。
  • DeiT-small在64:2:5稀疏下无损精度,DeiT-base在64:2:8稀疏仍保持准确率。
  • 适用于视觉模型和大语言模型,适合追求高效推理的部署场景。

目前,只有2:4稀疏模式能在GPU的稀疏张量核心上获得加速。然而,2:4稀疏的实际加速比通常较低(≤1.3),且稀疏比例固定,导致4:8、8:16或超过50%稀疏度无法带来加速。最近研究指出,V:N:M稀疏模式有望解决这一问题。但其在视觉变压器和大语言模型(LLMs)中的准确率影响尚不明确,且如何选择合适的V和M值仍未解决。本研究系统评估了V:N:M稀疏在多个任务中对视觉模型和LLMs的应用效果。提出了三种提升方法:启发式选择V和M、针对V:N:M的通道重排、三阶段LoRA训练。实验表明,使用这些方法后,DeiT-small在64:2:5稀疏下实现无损精度,DeiT-base在64:2:8稀疏下仍保持准确率。此外,微调后的LLama2-7B在64:2:5稀疏下,在下游任务表现优于或等同于无训练的2:4稀疏替代方案。更重要的是,与2:4稀疏相比,V:N:M稀疏提供了更广泛的加速-精度权衡。总体而言,本研究显著推动了V:N:M稀疏成为成本敏感推理场景中真正有效的加速方案。

原文摘要 · Abstract (English)

To date, 2:4 sparsity has stood as the only sparse pattern that can be accelerated using sparse tensor cores on GPUs. In practice, 2:4 sparsity often possesses low actual speedups ($\leq 1.3$) and requires fixed sparse ratios, meaning that other ratios, such as 4:8, 8:16, or those exceeding 50% sparsity, do not incur any speedups on GPUs. Recent studies suggest that V:N:M sparsity is promising in addressing these limitations of 2:4 sparsity. However, regarding accuracy, the effects of V:N:M sparsity on broader Transformer models, such as vision Transformers and large language models (LLMs), are largely unexamined. Moreover, Some specific issues related to V:N:M sparsity, such as how to select appropriate V and M values, remain unresolved. In this study, we thoroughly investigate the application of V:N:M sparsity in vision models and LLMs across multiple tasks, from pertaining to downstream tasks. We propose three key approaches to enhance the applicability and accuracy of V:N:M-sparse Transformers, including heuristic V and M selection, V:N:M-specific channel permutation, and three-staged LoRA training techniques. Experimental results show that, with our methods, the DeiT-small achieves lossless accuracy at 64:2:5 sparsity, while the DeiT-base maintains accuracy even at 64:2:8 sparsity. In addition, the fine-tuned LLama2-7B at 64:2:5 sparsity performs comparably or better than training-free 2:4 sparse alternatives on downstream tasks. More importantly, V:N:M-sparse Transformers offer a wider range of speedup-accuracy trade-offs compared to 2:4 sparsity. Overall, our exploration largely facilitates the V:N:M sparsity to act as a truly effective acceleration solution for Transformers in cost-sensitive inference scenarios.

稀疏推理TransformerGPU加速大模型压缩

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。