[논문 리뷰] ZeroQuant: Efficient and Affordable Post-Training Quantization for Large-Scale Transformers
ZeroQuant는 미세한 가중치 및 활성화 양자화, 경량의 계층별 지식 증류(LKD), 그리고 대형 트랜스포머에서 최소한의 정확도 손실과 실질적인 속도 향상을 가능하게 하는 INT8/INT4-INT8 혼합 정밀도를 지원하는 최적화 백엔드를 갖춘 엔드-투-엔드 PTQ 파이프라인을 제공합니다.
How to efficiently serve ever-larger trained natural language models in practice has become exceptionally challenging even for powerful cloud servers due to their prohibitive memory/computation requirements. In this work, we present an efficient and affordable post-training quantization approach to compress large Transformer-based models, termed as ZeroQuant. ZeroQuant is an end-to-end quantization and inference pipeline with three main components: (1) a fine-grained hardware-friendly quantization scheme for both weight and activations; (2) a novel affordable layer-by-layer knowledge distillation algorithm (LKD) even without the access to the original training data; (3) a highly-optimized quantization system backend support to remove the quantization/dequantization overhead. As such, we are able to show that: (1) ZeroQuant can reduce the precision for weights and activations to INT8 in a cost-free way for both BERT and GPT3-style models with minimal accuracy impact, which leads to up to 5.19x/4.16x speedup on those models compared to FP16 inference; (2) ZeroQuant plus LKD affordably quantize the weights in the fully-connected module to INT4 along with INT8 weights in the attention module and INT8 activations, resulting in 3x memory footprint reduction compared to the FP16 model; (3) ZeroQuant can be directly applied to two of the largest open-sourced language models, including GPT-J6B and GPT-NeoX20, for which our INT8 model achieves similar accuracy as the FP16 model but achieves up to 5.2x better efficiency.
연구 동기 및 목표
- 메모리와 연산 제약 하에서 점점 더 큰 NLP 모델을 배포해야 할 필요성을 제시한다.
- 재훈련 없이 정확성을 보존하는 포스트-트레이닝 양자화 파이프라인을 제안한다.
- 미세한 가중치/활성화 양자화로 하드웨어 인식 양자화 체계를 도입한다.
- 학습 데이터 없이 작동하는 경량의 레이어별 지식 증류 방법을 제시한다.
- 추론 중 양자화 오버헤드를 최소화하는 시스템 수준 최적화를 선보인다.
제안 방법
- 미세한 하드웨어 친화적 양자화를 적용합니다: 그룹별 가중치 양자화와 토큰별 활성화 양자화.
- 원래의 비양자화 계층을 교사로 사용하여 한 번에 한 층씩 양자화하는 Layer-by-layer Knowledge Distillation(LKD)을 도입합니다.
- 데이터 이동을 줄이기 위해 토큰별 양자화를 선행 연산과 융합하는 고도로 최적화된 추론 백엔드를 개발합니다.
- CUTLASS 기반 INT8 GeMM 커널 및 커널 융합을 활용하여 양자화/역양자화 오버헤드를 최소화합니다.
- 가중치/활성화에 대한 INT8 양자화를 BERT 및 GPT-3 스타일 모델에서 최소한의 정확도 손실로 시연하고, LKD를 적용한 INT4/INT8 혼합 정밀도를 시연합니다.
- GPT-J(6B) 및 GPT-NeoX(20B)로의 확장성과 상당한 효율성 향상을 보여줍니다.
실험 결과
연구 질문
- RQ1훈련 데이터에 접근하지 않고도 포스트-트레이닝 양자화가 대형 Transformer 모델을 INT8 또는 INT4로 양자화하여 최소한의 정확도 손실을 가져올 수 있나요?
- RQ2레이어별 증류 접근법(LKD)이 전체 재훈련이나 원본 데이터 접근 없이 초저정밀 양자화를 가능하게 하나요?
- RQ3대규모 트랜스포머에 대해 어떤 하드웨어 인식 양자화 전략(그룹별 가중치, 토큰별 활성화)이 정확도/지연 간 최적의 trade-off를 제공하나요?
- RQ4커널 융합, 백엔드 등 시스템 수준 최적화가 양자화된 트랜스포머에 실제 지연 혜택을 제공하는 정도는 얼마나 되나요?
- RQ5ZeroQuant가 수십억 매개변수 모델로 확장하고 경쟁력 있는 정확도를 유지하면서 상당한 처리량 향상을 달성할 수 있나요?
주요 결과
- INT8 quantization of weights and activations for BERT and GPT-3-style models yields substantial speedups with minimal accuracy loss compared to FP16 (up to 5.19x on BERT-base and 4.16x on GPT-3-350M).
- LKD enables INT4/INT8 mixed-precision quantization with ~3x memory footprint reduction versus FP16, with modest accuracy loss and fast quantization (e.g., ~33s for BERT-base quantization).
- ZeroQuant-LKD achieves strong results on GPT-J-6B and GPT-NeoX-20B, delivering up to 5.2x efficiency gains and reduced GPU requirements/latency (e.g., GPT-NeoX-20B from 2 GPUs to 1, latency 65ms to 25ms).
- Kernel fusion and a CUTLASS-based INT8 GeMM backend substantially reduce quantization/dequantization overhead and improve latency for INT8 transformer inference.
- On GPT-3-style models, accuracy is more robust for accuracy tasks than generation tasks under quantization, with ZeroQuant narrowing the gap to PTQ (W8A8) and outperforms W4/8 schemes with LKD.
- Ablation studies show group-wise weight quantization plus token-wise activation quantization yields meaningful accuracy gains, further boosted by LKD.
더 나은 연구,지금 바로 시작하세요
연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.
카드 등록 없음 · 무료 플랜 제공
이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.