Skip to main content
QUICK REVIEW

[논문 리뷰] Efficient LLM Inference on CPUs

Haihao Shen, Hanwen Chang|arXiv (Cornell University)|2023. 11. 01.
Topic Modeling인용 수 10
한 줄 요약

본 논문은 자동 INT4 가중치 전용 양자화 흐름과 CPU 최적화 LLM 런타임을 도입하여 CPU에서 추론을 가속하고, 최소한의 정확도 손실로 토큰당 지연을 빠르게 달성합니다. 3B에서 20B 매개변수의 LLM들에 대해 단일 소켓 4th Gen Intel Xeon 프로세서에서의 결과를 보여줍니다.

ABSTRACT

Large language models (LLMs) have demonstrated remarkable performance and tremendous potential across a wide range of tasks. However, deploying these models has been challenging due to the astronomical amount of model parameters, which requires a demand for large memory capacity and high memory bandwidth. In this paper, we propose an effective approach that can make the deployment of LLMs more efficiently. We support an automatic INT4 weight-only quantization flow and design a special LLM runtime with highly-optimized kernels to accelerate the LLM inference on CPUs. We demonstrate the general applicability of our approach on popular LLMs including Llama2, Llama, GPT-NeoX, and showcase the extreme inference efficiency on CPUs. The code is publicly available at: https://github.com/intel/intel-extension-for-transformers.

연구 동기 및 목표

  • CPU 하드웨어에서 대형 언어 모델(LLMs)의 효율적인 배치를 촉진한다.
  • Intel Neural Compressor를 활용한 자동 INT4 가중치 전용 양자화 흐름을 제안한다.
  • 최적화 커널을 갖춘 CPU-맞춤 텐서 라이브러리 및 LLM 런타임을 개발한다.
  • 4th Gen Intel Xeon 프로세서에서 인기 있는 LLMs(3B–20B)에 걸친 정확도와 성능을 시연한다.

제안 방법

  • GPTQ, SignRound, AWQ, TEQ, RTN를 지원하고 조정 가능한 입도(granularity)를 제공하는 Intel Neural Compressor를 이용한 자동 INT4 양자화 흐름(그룹 크기 예: 32, 64, 128, ... 1024)을 사용.
  • FP32 기준선에 비해 정확도 손실이 <1%인 고품질 INT4 모델의 생성을 달성.
  • ggml에서 영감을 얻은 CPU 중심 텐서 라이브러리로, ISA 범위(AVX2, AVX512, AVX512_VNNI, AMX) 전반의 INT4 커널 및 동적 입력 양자화를 지원.
  • KV-cache 최적화와 CPU-텐서 백엔드를 갖춘 LLM 런타임 설계로 디코더 전용 트랜스포머 추론을 효율적으로 가능하게 한다.
  • 4th Gen Intel Xeon scalable 프로세서에서 오픈 소스 LLMs(3B–20B)에 대한 평가를 ggml 기반 구현과 비교한다.
Figure 1: The left part is the automatic INT4 quantization flow: given a FP32 model, the flow takes the default INT4 quantization recipes and evaluates the accuracy of INT4 model; the recipe tuning loop is optional, if INT4 model can meet the accuracy target. The right part is a simplified runtime f
Figure 1: The left part is the automatic INT4 quantization flow: given a FP32 model, the flow takes the default INT4 quantization recipes and evaluates the accuracy of INT4 model; the recipe tuning loop is optional, if INT4 model can meet the accuracy target. The right part is a simplified runtime f

실험 결과

연구 질문

  • RQ1다양한 LLM에 대해 자동 INT4 양자화가 FP32 기준선에 비해 정확도 손실이 <1%인 INT4 모델을 생성할 수 있는가?
  • RQ2다음 토큰 생성을 위한 지연 시간에서 CPU 최적화 LLM 런타임은 ggml 기반 기준 대비 어떤 성능을 보이는가?
  • RQ3단일 소켓 4th Gen Intel Xeon CPU에서 3B–20B 매개변수 LLM을 배치할 때 실질적인 지연 및 정확도 이득은 무엇인가?
  • RQ4CPU에서 LLM 추론 속도에 가장 큰 기여를 하는 특정 CPU 커널 및 KV-cache 최적화는 무엇인가?

주요 결과

  • INT4 모델은 다수의 LLM에서 FP32 기준선 대비 정확도가 <1% 이내에 달한다(예: GPT-J 6B, Llama-2 7B, Llama 7B, GPT-NeoX 20B, Falcon 7B).
  • LLM 런타임은 그룹 크기 128에서 ggml 기반 솔루션 대비 최대 1.6x, 그룹 크기 32에서 1.3x 더 빠른 다음 토큰 지연을 보인다.
  • CPU 하드웨어에서 4th Gen Intel Xeon Scalable 프로세서의 단일 소켓에서 6B–20B 모델의 토큰당 생성 지연은 20 ms에서 80 ms 사이이다.
  • 자동 INT4 양자화와 CPU 최적화 런타임을 결합한 엔드투엔드 파이프라인은 CPU에서 정확도를 유지하면서 효율적인 LLM 추론을 제공한다.
Figure 2: Key components in LLM runtime: general and LLM specialized.
Figure 2: Key components in LLM runtime: general and LLM specialized.

더 나은 연구,지금 바로 시작하세요

연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.