[论文解读] S$^{3}$: Increasing GPU Utilization during Generative Inference for Higher Throughput
S3 预测输出序列长度以进行批量化与生成性推理的调度,在处理预测错误的同时提升基于 Transformer 的 LLM 的 GPU 利用率与吞吐量。
Generating texts with a large language model (LLM) consumes massive amounts of memory. Apart from the already-large model parameters, the key/value (KV) cache that holds information about previous tokens in a sequence can grow to be even larger than the model itself. This problem is exacerbated in one of the current LLM serving frameworks which reserves the maximum sequence length of memory for the KV cache to guarantee generating a complete sequence as they do not know the output sequence length. This restricts us to use a smaller batch size leading to lower GPU utilization and above all, lower throughput. We argue that designing a system with a priori knowledge of the output sequence can mitigate this problem. To this end, we propose S$^{3}$, which predicts the output sequence length, schedules generation queries based on the prediction to increase device resource utilization and throughput, and handle mispredictions. Our proposed method achieves 6.49$ imes$ throughput over those systems that assume the worst case for the output sequence length.
研究动机与目标
- 在自回归 LLM 推理中,由于 KV 缓存增长引发的内存受限的 GPU 利用率问题提供动机。
- 提出一个序列长度预测与调度框架(S3),在时延 SLO 下提升吞吐量。
- 开发处理预测错误并在不损害模型完整性的前提下保持可靠性的机制。
- 在不同模型规模下展示相较基线系统的吞吐量改进。
提出的方法
- 微调基于 DistilBERT 的预测器,将输出序列长度分为 10 个桶并达到高准确性(例如在 Alpaca 上为 98.61%)。
- 实现一个长度感知的调度器,采用等价于装箱问题的分组打包风格进行请求批处理,只有单一的 HBM 容量约束且受 ORCA 启发的选择性批处理。
- 使用监督器检测预测错误,提前裁剪过长的 KV 缓存、重新定位数据并在线重新训练预测器。
- 在 FasterTransformer 上集成预测器、调度器和监督器,在不超过内存约束的前提下最大化吞吐量。
- 将大模型按流水线划分到多张 GPU,以实现更高的批量大小并维持吞吐量。
![Figure 1 : Latency versus throughput trade-off among different models (left) and the number of GPUs (right, distributing GPT-3 to 6, 8, and 10 GPUs) when generating 60 tokens, inspired by FlexGen [ 6 ] . The markers in the lines represent batch sizes, from 1 to the maximum batch size that can be loa](https://ar5iv.labs.arxiv.org/html/2306.06000/assets/x1.png)
实验结果
研究问题
- RQ1在不超过 GPU HBM 容量的前提下,预测输出序列长度是否可以增加可达到的批量大小?
- RQ2在在线(SLO)与离线情境下,长度感知调度对吞吐量和延迟有何影响?
- RQ3监督器在处理预测错误和内存碎片方面的开销与鲁棒性如何?
主要发现
- S3 在假设最坏输出长度的系统上实现了最多 6.49× 的吞吐量提升。
- 在在线情境中,若每个标记的延迟 SLO 为 0.1875 秒,S3 生成的序列数量最多比 ORCA 多 6.49×,且满足相同的 SLO。
- S3 的性能可与 Oracle(完美预测器)相匹配,差异为 9.34%–40.52%,视模型大小而定,尽管事先并不知道准确的输出长度。
- 在 6 个 GPU 下使用 S3 的吞吐量几乎等同于未使用 S3 的 10 GPU 系统,从而提升成本效率。
- 预测器在桶预测上的准确率高达 98.61%(在 Alpaca 上),且预测器延迟极小,为 3.7 ms。
- 开销与预测错误惩罚较小(平均约为生成时间的 11%),且在较长的生成过程中摊销。

更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。