Skip to main content
QUICK REVIEW

[논문 리뷰] FlashDecoding++: Faster Large Language Model Inference on GPUs

Ke Hong, Guohao Dai|arXiv (Cornell University)|2023. 11. 02.
Topic ModelingComputer Science인용 수 14
한 줄 요약

FlashDecoding++은 주의(attention) 소프트맥스 동기화, 평면 GEMM 활용, 데이터 흐름 적응성을 최적화하여 Hugging Face 및 기타 기준 대비 NVIDIA 및 AMD GPU에서 상당한 속도 향상을 달성하는 빠른 LLM 추론 엔진이다.

ABSTRACT

As the Large Language Model (LLM) becomes increasingly important in various domains. However, the following challenges still remain unsolved in accelerating LLM inference: (1) Synchronized partial softmax update. The softmax operation requires a synchronized update operation among each partial softmax result, leading to ~20% overheads for the attention computation in LLMs. (2) Under-utilized computation of flat GEMM. The shape of matrices performing GEMM in LLM inference is flat, leading to under-utilized computation and >50% performance loss after padding zeros in previous designs. (3) Performance loss due to static dataflow. Kernel performance in LLM depends on varied input data features, hardware configurations, etc. A single and static dataflow may lead to a 50.25% performance loss for GEMMs of different shapes in LLM inference. We present FlashDecoding++, a fast LLM inference engine supporting mainstream LLMs and hardware back-ends. To tackle the above challenges, FlashDecoding++ creatively proposes: (1) Asynchronized softmax with unified max value. FlashDecoding++ introduces a unified max value technique for different partial softmax computations to avoid synchronization. (2) Flat GEMM optimization with double buffering. FlashDecoding++ points out that flat GEMMs with different shapes face varied bottlenecks. Then, techniques like double buffering are introduced. (3) Heuristic dataflow with hardware resource adaptation. FlashDecoding++ heuristically optimizes dataflow using different hardware resource considering input dynamics. Due to the versatility of optimizations in FlashDecoding++, FlashDecoding++ can achieve up to 4.86x and 2.18x speedup on both NVIDIA and AMD GPUs compared to Hugging Face implementations. FlashDecoding++ also achieves an average speedup of 1.37x compared to state-of-the-art LLM inference engines on mainstream LLMs.

연구 동기 및 목표

  • 현실 세계 배치에서의 높은 연산 비용으로 인한 더 빠른 LLM 추론을 촉진한다.
  • 디코드 단계 GEMM/attenton의 병목 현상을 식별하고 대상 최적화를 제안한다.
  • 다른 하드웨어 백엔드 및 입력 동역학에 적응하는 통합 프레임워크를 개발한다.
  • 다양한 모델과 GPU에서 최첨단 추론 엔진에 비해 성능 향상을 입증한다.

제안 방법

  • attention의 교차 부분 동기화를 제거하기 위해 단일 최대값을 갖는 비동기 소프트맥스를 도입한다.
  • 메모리 대기 시간을 가리기 위해 8로 패딩하고 이중 버퍼링을 적용하여 flat GEMM을 최적화한다.
  • 워크로드 급증 지점을 기반으로 CUDA 코어와 텐서 코어 구현 간 선택하는 휴리스틱 데이터 흐름을 개발한다.
  • GEMV/GEMM 형태를 최적 커널에 매핑하기 위해 오프라인 조회 기반 의사결정 흐름을 프로파일링하고 구축한다.
  • Llama2, OPT, ChatGLM2 모델을 사용하고 다수의 기준선에 대하여 NVIDIA 및 AMD GPU에서 평가한다.

실험 결과

연구 질문

  • RQ1단일 최대값을 갖는 비동기 소프트맥스가 부분 소프트맥스 계산에서 동기화 오버헤드를 제거할 수 있는가?
  • RQ2패딩으로 인한 낭비 없이 decode-phase LLM 워크로드의 활용도를 높이기 위해 flat GEMM을 어떻게 최적화할 수 있는가?
  • RQ3휴리스틱 데이터 흐름이 다양한 입력 동역학 및 하드웨어 구성에서 최적의 하드웨어 커널로 GEMV/GEMM 워크로드를 적응적으로 라우팅하여 처리량을 최대화할 수 있는가?
  • RQ4주류 GPU에서 Hugging Face 및 기타 최첨단 LLM 추론 엔진에 대한 FlashDecoding++의 성능 향상은 무엇인가?

주요 결과

  • decode 단계에서 NVIDIA 및 AMD GPU에서 Hugging Face 대비 최대 4.86× 속도 향상을 달성한다.
  • AMD GPU에서 Hugging Face 대비 최대 3.93× 속도 향상을 달성한다.
  • 다양한 모델에 걸쳐 최첨단 LLM 추론 엔진인 FlashDecoding 대비 평균 1.37× 속도 향상을 제공한다.
  • FlashDecoding과 비교하여 Tesla A100에서 평균 1.37×의 속도 향상을 달성한다.
  • Llama2, OPT, ChatGLM2를 포함한 여러 모델에서 경쟁력 있는 성능을 제공한다.
  • 비대칭 소프트맥스, 이중 버퍼링된 flat GEMM, 그리고 백엔드 간 하드웨어 적응 데이터 흐름의 효과를 입증한다.

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.