[Paper Review] SARATHI: Efficient LLM Inference by Piggybacking Decodes with Chunked Prefills
Sarathi introduces chunked-prefills and decode-maximal batching to piggyback decodes on prefill, achieving higher decode and end-to-end throughput and reducing pipeline bubbles across models and hardware.
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.
Motivation & Objective
- Address inefficiencies in LLM inference due to the mismatch between prefill and decode compute.
- Reduce pipeline bubbles in pipeline-parallel deployments by creating uniform, compute-saturated batches.
- Introduce techniques that enable decodes to piggyback on prefills to improve overall throughput.
- Evaluate performance across models and hardware to demonstrate scalability and practicality.
Proposed method
- Introduce chunked-prefills to split a prefill request into equal-sized compute-sized chunks.
- Propose decode-maximal batching to form batches with one prefill chunk and piggybacked decodes on remaining slots.
- Fuse linear operations for decodes with prefills to convert decode-time from memory-bound to compute-bound.
- Analyze the trade-off between prefill chunk size and piggybacked decode count using the P:D ratio and tile-size considerations.
- Provide an implementation on top of nanoGPT and compare against Orca-like iteration-level scheduling.
Experimental results
Research questions
- RQ1What is the impact of Sarathi on decode throughput and end-to-end LLM throughput across different sequence lengths, batch sizes, and P:D ratios?
- RQ2How does Sarathi compare to existing iteration-level scheduling mechanisms like Orca in terms of throughput and efficiency?
- RQ3What is the effect of Sarathi on GPU pipeline bubbles and the throughput of pipeline-parallel models?
- RQ4What are the overheads associated with chunked-prefills and decode-maximal batching, and how do they scale?
Key findings
- Decode throughput can improve by up to 10× for LLaMA-13B on an A6000, with end-to-end throughput up to 1.33×.
- For LLaMA-33B on an A100, decode throughput improves up to 4.25×, with end-to-end throughput up to 1.25×.
- When used with pipeline parallelism on GPT-3, pipeline bubbles reduce by 6.29×, yielding end-to-end throughput improvement of 1.91×.
- Across evaluation scenarios, Sarathi demonstrates significant improvements in decode throughput and end-to-end throughput across models and hardware.
- Decode-maximal batching converts decode work from memory-bound to compute-bound by reusing model weights and fusing computations.
- Chunked-prefills and decode-maximal batching enable multiple hybrid batches from a single prefill, improving coverage of decodes that piggyback.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.