[논문 리뷰] QServe: W4A8KV4 Quantization and System Co-design for Efficient LLM Serving
논문은 QoQ W4A8KV4 양자화와 LLM 서빙을 가속화하기 위한 co-designed QServe 시스템을 제안하며, TensorRT-LLM 및 기존 4비트 방법에 비해 상당한 처리량 향상을 달성한다.
Quantization can accelerate large language model (LLM) inference. Going beyond INT8 quantization, the research community is actively exploring even lower precision, such as INT4. Nonetheless, state-of-the-art INT4 quantization techniques only accelerate low-batch, edge LLM inference, failing to deliver performance gains in large-batch, cloud-based LLM serving. We uncover a critical issue: existing INT4 quantization methods suffer from significant runtime overhead (20-90%) when dequantizing either weights or partial sums on GPUs. To address this challenge, we introduce QoQ, a W4A8KV4 quantization algorithm with 4-bit weight, 8-bit activation, and 4-bit KV cache. QoQ stands for quattuor-octo-quattuor, which represents 4-8-4 in Latin. QoQ is implemented by the QServe inference library that achieves measured speedup. The key insight driving QServe is that the efficiency of LLM serving on GPUs is critically influenced by operations on low-throughput CUDA cores. Building upon this insight, in QoQ algorithm, we introduce progressive quantization that can allow low dequantization overhead in W4A8 GEMM. Additionally, we develop SmoothAttention to effectively mitigate the accuracy degradation incurred by 4-bit KV quantization. In the QServe system, we perform compute-aware weight reordering and take advantage of register-level parallelism to reduce dequantization latency. We also make fused attention memory-bound, harnessing the performance gain brought by KV4 quantization. As a result, QServe improves the maximum achievable serving throughput of Llama-3-8B by 1.2x on A100, 1.4x on L40S; and Qwen1.5-72B by 2.4x on A100, 3.5x on L40S, compared to TensorRT-LLM. Remarkably, QServe on L40S GPU can achieve even higher throughput than TensorRT-LLM on A100. Thus, QServe effectively reduces the dollar cost of LLM serving by 3x. Code is available at https://github.com/mit-han-lab/omniserve.
연구 동기 및 목표
- 클라우드 시장에서 W8A8 및 W4A16 양자화를 넘어서는 효율적인 LLM 서빙의 필요성을 제시한다.
- 정밀도 손실을 통제하면서 처리량을 극대화하기 위해 4비트 가중치, 8비트 활성화, 4비트 KV 캐시 양자화(W4A8KV4)를 도입한다.
- 추론 시 GPU에서 런타임 오버헤드를 최소화하기 위한 시스템-소프트웨어 및 알고리즘 공동 설계(QoQ 및 QServe)를 개발한다.
- SmoothAttention 및 기타 양자화 최적화를 통해 KV4 양자화로 인한 정확도 저하를 완화한다.
- A100 및 L40S GPU에서 다수의 LLM에 대한 실세계 처리량 향상을 시연한다.
제안 방법
- QoQ (Quattuor-Octō-Quattuor) 양자화를 점진적 그룹 양자화와 함께 도입하여 W4A8KV4 계산을 INT8 텐서 코어에서 가능하게 한다.
- key 활성화를 형상화하여 KV4 양자화로 인한 정확도 손실을 줄이기 위한 SmoothAttention을 개발한다.
- W4A8 GEMM의 메인 루프에서 디퀀타이제이션 대기시간을 줄이기 위해 계산 인식 가중치 재배열 및 레지스터 수준 병렬성을 설계한다.
- 메모리 바운드 어텐션 커널을 달성하고 높은 처리량을 유지하기 위해 GEMM 커널에 디퀀타이제이션을 융합한다.
- W4A8 입력, FP16 출력, 헤드별 동적 KV 캐시 양자화, 진행 중 배치 처리를 다루는 QServe 런타임을 구현한다.
- 어텐션 커널을 메모리 바운드로 만들고 메인 루프에서 CUDA 코어 오버헤드를 최소화하기 위한 최적화를 제공한다.
실험 결과
연구 질문
- RQ1QoQ와 함께 W4A8KV4 양자화가 클라우드 환경에서 기존 8비트 및 4비트 시스템보다 엔드-투-엔드 LLM 서빙 처리량을 더 높게 제공할 수 있는가?
- RQ2LLM의 GEMM 메인 루프에서 디퀀타이제이션 오버헤드를 최소화하기 위한 양자화, 스케줄링 및 커널 설계 전략은 무엇인가?
- RQ3Llama 및 Qwen 모델에서 KV4 양자화 아래 SmoothAttention이 정확도 보전에 얼마나 효과적인가?
- RQ4계산 인식 가중치 재배열 및 융합 KV4 어텐션이 서로 다른 GPU 아키텍처(A100 대 L40S)에서 전반적인 서빙 처리량에 어떤 영향을 미치는가?
- RQ5실세계 서빙 시나리오에서 QServe의 실용적인 처리량 및 비용 이점은 TensorRT-LLM, Atom, QuaRot와 비교했을 때 무엇인가?
주요 결과
- QServe는 A100 GPU에서 가장 좋은 TensorRT-LLM 구성 대비 Llama-3-8B에서 1.2-2.4×, Qwen1.5-72B에서 2.4×의 처리량을 달성한다.
- 테스트 모델에서 A100 GPU에서 Atom 및 QuaRot보다 2.5-2.9× 더 높은 처리량을 제공한다.
- L40S GPU에서 QServe는 TensorRT-LLM 대비 1.5-3.5×의 처리량 향상을 달성하며, 여덟 모델 중 여섯은 A100 성능에 필적하거나 이를 상회하고 비용은 감소한다.
- QServe는 베이스라인 시스템에 비해 LLM 서빙 비용을 약 3배 감소시킨다.
- QoQ는 계산이 INT8 텐서 코어에서 실행되도록 보장하고 메인 루프 오버헤드를 최소화하여 W4A8 KV4 GEMM을 효율적으로 수행하게 한다.
- SmoothAttention은 KV4 어텐션에서 KV4 양자화로 인한 정확도 손실을 효과적으로 완화한다.
이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.