ChatPaper.aiChatPaper

Un acceleratore software efficiente per l'inferenza sparsa su modelli linguistici basati su Transformer per CPU

An Efficient Sparse Inference Software Accelerator for Transformer-based Language Models on CPUs

June 28, 2023
Autori: Haihao Shen, Hengyu Meng, Bo Dong, Zhe Wang, Ofir Zafrir, Yi Ding, Yu Luo, Hanwen Chang, Qun Gao, Ziheng Wang, Guy Boudoukh, Moshe Wasserblat
cs.AI

Abstract

Negli ultimi anni, i modelli linguistici basati su Transformer sono diventati l'approccio standard per le attività di elaborazione del linguaggio naturale. Tuttavia, i rigorosi requisiti di throughput e latenza nelle applicazioni industriali ne stanno limitando l'adozione. Per mitigare questo divario, tecniche di compressione dei modelli come il pruning strutturato vengono utilizzate per migliorare l'efficienza dell'inferenza. Tuttavia, la maggior parte dei runtime di inferenza per reti neurali esistenti non offre un supporto adeguato per la sparsità strutturata. In questo articolo, proponiamo uno stack software efficiente per l'inferenza di deep learning sparsa per modelli linguistici basati su Transformer, in cui i pesi vengono potati con una dimensione di blocco costante. Il nostro acceleratore software sparsa sfrutta Intel Deep Learning Boost per massimizzare le prestazioni della moltiplicazione matrice sparsa - matrice densa (comunemente abbreviata come SpMM) sulle CPU. Il nostro kernel SpMM supera le librerie sparse esistenti (oneMKL, TVM e LIBXSMM) di un ordine di grandezza su un'ampia gamma di forme GEMM sotto 5 rapporti di sparsità rappresentativi (70%, 75%, 80%, 85%, 90%). Inoltre, il nostro kernel SpMM mostra un miglioramento fino a 5x rispetto al kernel GEMM denso di oneDNN, una libreria densa altamente ottimizzata ampiamente utilizzata nell'industria. Applichiamo il nostro acceleratore sparsa su modelli linguistici basati su Transformer ampiamente utilizzati, tra cui Bert-Mini, DistilBERT, Bert-Base e BERT-Large. Il nostro software di inferenza sparsa mostra un miglioramento fino a 1,5x rispetto a Deepsparse di Neural Magic nelle stesse configurazioni su Xeon su Amazon Web Services sotto vincoli di latenza proxy di produzione. Confrontiamo inoltre la nostra soluzione con due soluzioni di inferenza basate su framework, ONNX Runtime e PyTorch, e dimostriamo un miglioramento fino a 37x rispetto a ONNX Runtime e 345x rispetto a PyTorch su Xeon sotto i vincoli di latenza. Tutto il codice sorgente è disponibile pubblicamente su Github: https://github.com/intel/intel-extension-for-transformers.
English
In recent years, Transformer-based language models have become the standard approach for natural language processing tasks. However, stringent throughput and latency requirements in industrial applications are limiting their adoption. To mitigate the gap, model compression techniques such as structured pruning are being used to improve inference efficiency. However, most existing neural network inference runtimes lack adequate support for structured sparsity. In this paper, we propose an efficient sparse deep learning inference software stack for Transformer-based language models where the weights are pruned with constant block size. Our sparse software accelerator leverages Intel Deep Learning Boost to maximize the performance of sparse matrix - dense matrix multiplication (commonly abbreviated as SpMM) on CPUs. Our SpMM kernel outperforms the existing sparse libraries (oneMKL, TVM, and LIBXSMM) by an order of magnitude on a wide range of GEMM shapes under 5 representative sparsity ratios (70%, 75%, 80%, 85%, 90%). Moreover, our SpMM kernel shows up to 5x speedup over dense GEMM kernel of oneDNN, a well-optimized dense library widely used in industry. We apply our sparse accelerator on widely-used Transformer-based language models including Bert-Mini, DistilBERT, Bert-Base, and BERT-Large. Our sparse inference software shows up to 1.5x speedup over Neural Magic's Deepsparse under same configurations on Xeon on Amazon Web Services under proxy production latency constraints. We also compare our solution with two framework-based inference solutions, ONNX Runtime and PyTorch, and demonstrate up to 37x speedup over ONNX Runtime and 345x over PyTorch on Xeon under the latency constraints. All the source code is publicly available on Github: https://github.com/intel/intel-extension-for-transformers.
PDF40December 15, 2024