[논문 리뷰] SARATHI: Efficient LLM Inference by Piggybacking Decodes with Chunked Prefills
Sarathi는 chunked-prefills와 decode-maximal batching을 도입하여 prefill에 디코드를 끼워넣을 수 있게 하고 디코드 및 엔드-투-엔드 처리량을 높이며 모델과 하드웨어 전반의 파이프라인 버블을 줄입니다.
Large Language Model (LLM) inference consists of two distinct phases - prefill phase which processes the input prompt and decode phase which generates output tokens autoregressively. While the prefill phase effectively saturates GPU compute at small batch sizes, the decode phase results in low compute utilization as it generates one token at a time per request. The varying prefill and decode times also lead to imbalance across micro-batches when using pipeline parallelism, resulting in further inefficiency due to bubbles. We present SARATHI to address these challenges. SARATHI employs chunked-prefills, which splits a prefill request into equal sized chunks, and decode-maximal batching, which constructs a batch using a single prefill chunk and populates the remaining slots with decodes. During inference, the prefill chunk saturates GPU compute, while the decode requests 'piggyback' and cost up to an order of magnitude less compared to a decode-only batch. Chunked-prefills allows constructing multiple decode-maximal batches from a single prefill request, maximizing coverage of decodes that can piggyback. Furthermore, the uniform compute design of these batches ameliorates the imbalance between micro-batches, significantly reducing pipeline bubbles. Our techniques yield significant improvements in inference performance across models and hardware. For the LLaMA-13B model on A6000 GPU, SARATHI improves decode throughput by up to 10x, and accelerates end-to-end throughput by up to 1.33x. For LLaMa-33B on A100 GPU, we achieve 1.25x higher end-to-end-throughput and up to 4.25x higher decode throughput. When used with pipeline parallelism on GPT-3, SARATHI reduces bubbles by 6.29x, resulting in an end-to-end throughput improvement of 1.91x.
연구 동기 및 목표
- prefill과 디코드 계산 사이의 불일치로 인한 LLM 추론의 비효율성 해결.
- uniform하고 계산 포화(batch) 생성으로 파이프라인 병렬 배포에서 파이프라인 버블 감소.
- prefill에 디코드를 끼워넣어 전체 처리량을 개선하는 기술 도입.
- 다양한 모델과 하드웨어에서 성능을 평가하여 확장성과 실용성을 입증합니다.
제안 방법
- (prefill 요청을 동등한 크기의 계산 단위로 분할하기 위해 chunked-prefills 도입.)
- (prefill 청크 중 하나와 남은 슬롯에 끼워넣은 디코드를 사용하여 배치를 형성하는 decode-maximal batching 제안)
- (디코드의 선형 연산을 prefills와 합성하여 디코드 시간을 메모리 바운드에서 계산 바운드로 전환)
- (prefill 청크 크기와 끼워넣기 디코드 수 사이의 트레이드오프를 P:D 비율 및 타일 사이즈 고려를 통해 분석)
- (nanoGPT 위에 구현하고 Orca와 같은 반복 수준 스케줄링과 비교)
실험 결과
연구 질문
- RQ1Sarathi가 서로 다른 시퀀스 길이, 배치 크기 및 P:D 비율에서 디코드 처리량과 엔드-투-엔드 LLM 처리량에 미치는 영향은 무엇인가?
- RQ2Sarathi가 Orca와 같은 기존의 반복 수준 스케줄링 메커니즘과 비교하여 처리량과 효율성 측면에서 어떤 차이가 있는가?
- RQ3Sarathi가 GPU 파이프라인 버블 및 파이프라인 병렬 모델의 처리량에 미치는 영향은 무엇인가?
- RQ4chunked-prefills 및 decode-maximal batching에 따른 오버헤드는 무엇이며 어떻게 스케일링되는가?
주요 결과
- LLaMA-13B를 A6000에서 실행할 때 decode 처리량이 최대 10배 향상되고 엔드-투-엔드 처리량은 최대 1.33배까지 증가합니다.
- LLaMA-33B를 A100에서 실행할 때 decode 처리량이 최대 4.25배 향상되고 엔드-투-엔드 처리량은 최대 1.25배까지 증가합니다.
- GPT-3의 파이프라인 병렬성에서 파이프라인 버블이 6.29배 감소하여 엔드-투-엔드 처리량이 1.91배 증가합니다.
- 평가 시나리오 전반에 걸쳐 Sarathi는 모델과 하드웨어 전반에서 디코드 처리량과 엔드-투-엔드 처리량 모두에 대해 의미 있는 향상을 보여줍니다.
- decode-maximal batching은 모델 가중치를 재사용하고 연산을 융합하여 디코드 작업을 메모리 바운드에서 계산 바운드로 전환합니다.
- chunked-prefills와 decode-maximal batching은 단일 prefill에서 여러 하이브리드 배치를 가능하게 하여 끼워넣기 디코드의 커버리지를 향상시킵니다.
이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.