ChatPaper.aiChatPaper

CPU에서 트랜스포머 기반 언어 모델을 위한 효율적인 희소 추론 소프트웨어 가속기

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

June 28, 2023
저자: 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

초록

최근 몇 년 동안 Transformer 기반 언어 모델은 자연어 처리 작업의 표준 접근 방식으로 자리 잡았습니다. 그러나 산업 애플리케이션에서 엄격한 처리량과 지연 시간 요구 사항으로 인해 이러한 모델의 채택이 제한되고 있습니다. 이러한 격차를 줄이기 위해 구조적 가지치기와 같은 모델 압축 기술이 추론 효율성을 개선하는 데 사용되고 있습니다. 그러나 대부분의 기존 신경망 추론 런타임은 구조적 희소성에 대한 적절한 지원이 부족합니다. 본 논문에서는 가중치가 일정한 블록 크기로 가지치기된 Transformer 기반 언어 모델을 위한 효율적인 희소 딥러닝 추론 소프트웨어 스택을 제안합니다. 우리의 희소 소프트웨어 가속기는 Intel Deep Learning Boost를 활용하여 CPU에서 희소 행렬-밀집 행렬 곱셈(일반적으로 SpMM로 약칭됨)의 성능을 극대화합니다. 우리의 SpMM 커널은 5가지 대표적인 희소 비율(70%, 75%, 80%, 85%, 90%)에서 다양한 GEMM 형태에 대해 기존의 희소 라이브러리(oneMKL, TVM, LIBXSMM)보다 한 차원 높은 성능을 보여줍니다. 또한, 우리의 SpMM 커널은 산업계에서 널리 사용되는 최적화된 밀집 라이브러리인 oneDNN의 밀집 GEMM 커널보다 최대 5배의 속도 향상을 보입니다. 우리는 Bert-Mini, DistilBERT, Bert-Base, BERT-Large와 같은 널리 사용되는 Transformer 기반 언어 모델에 희소 가속기를 적용했습니다. 우리의 희소 추론 소프트웨어는 Amazon Web Services의 Xeon에서 프록시 생산 지연 시간 제약 하에서 Neural Magic의 Deepsparse와 동일한 구성에서 최대 1.5배의 속도 향상을 보여줍니다. 또한, 우리의 솔루션을 ONNX Runtime과 PyTorch라는 두 가지 프레임워크 기반 추론 솔루션과 비교하여, Xeon에서 지연 시간 제약 하에서 ONNX Runtime보다 최대 37배, PyTorch보다 최대 345배의 속도 향상을 입증했습니다. 모든 소스 코드는 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