Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve

LLM MQIA AI Systems and Hardware OLPP DPS
2024年03月04日
每个LLM服务请求都经过两个阶段。第一个是预填充,它处理整个输入提示以生成一个输出标记,第二个是解码,它逐个生成其余的输出标记。预填充迭代具有很高的延迟,但由于输入提示的并行处理而饱和GPU计算。相比之下,解码迭代具有低延迟,但计算利用率也很低,因为解码迭代仅处理每个请求的单个标记。这使得批处理对解码非常有效,因此对于整体吞吐量也是如此。然而,批处理多个请求会导致预填充和解码迭代的交错,这使得实现高吞吐量和低延迟变得具有挑战性。 我们引入了一种高效的LLM推理调度程序Sarathi-Serve,其灵感来自于我们最初在Sarathi中提出的优化吞吐量的技术。 Sarathi-Serve利用Sarathi中的分块预填充,创建无停顿的调度表,可以在不暂停正在进行的解码的情况下批量添加新请求。无停顿调度可以在最小化批处理对延迟的影响的同时,通过大批量大小提高吞吐量。我们的评估表明,Sarathi-Serve在单个A100 GPU上可将Mistral-7B的服务吞吐量提高高达2.6倍,在8个A100 GPU上可将Falcon-180B的服务吞吐量提高高达6.9倍,超过了Orca和vLLM。
Each LLM serving request goes through two phases. The first is prefill which processes the entire input prompt to produce one output token and the second is decode which generates the rest of output tokens, one-at-a-time. Prefill iterations have high latency but saturate GPU compute due to parallel processing of the input prompt. In contrast, decode iterations have low latency but also low compute utilization because a decode iteration processes only a single token per request. This makes batching highly effective for decodes and consequently for overall throughput. However, batching multiple requests leads to an interleaving of prefill and decode iterations which makes it challenging to achieve both high throughput and low latency. We introduce an efficient LLM inference scheduler Sarathi-Serve inspired by the techniques we originally proposed for optimizing throughput in Sarathi. Sarathi-Serve leverages chunked-prefills from Sarathi to create stall-free schedules that can add new requests in a batch without pausing ongoing decodes. Stall-free scheduling unlocks the opportunity to improve throughput with large batch sizes while minimizing the effect of batching on latency. Our evaluation shows that Sarathi-Serve improves serving throughput within desired latency SLOs of Mistral-7B by up to 2.6x on a single A100 GPU and up to 6.9x for Falcon-180B on 8 A100 GPUs over Orca and vLLM.
许愿