Large language models (LLMs) propel the prosperity of interactive AI applications showcased by ChatGPT that demand timely response of inference services. However, LLM inference is computation intensive and memory intensive, and improper parameter configuration at LLM platforms may exacerbate the inference time. In this paper, we analyze the impact of LLM output token distribution on the inference queueing delay, where the max-token clipping and the batched inference are considered. By formulating an M/G/1 model, we observe that enforcing a maximum output token limit on a very small fraction of inference requests can significantly reduce the queueing delay, and our model facilitates the selection of the optimal limit. For the batch inference, we model the service process as a bulk queue in which the batch processing time is affected by the batch size and the maximum token size inside this batch jointly. The queueing delays of the batching of all buffered requests (dynamic batching), the batching of constant number of requests (fixed batching), and the batching without intra-batch waiting (elastic batching) are derived. Experimental results show that our mathematical models coincide with the event-driven simulations well.


翻译:大语言模型(LLMs)推动了以ChatGPT为代表的交互式人工智能应用的繁荣,这类应用对推理服务的实时响应提出了更高要求。然而,LLM推理具有计算密集与内存密集的特性,且LLM平台中不当的参数配置可能进一步加剧推理耗时。本文分析了LLM输出令牌分布对推理排队延迟的影响,其中考虑了最大令牌截断与批处理推理两种机制。通过建立M/G/1排队模型,我们发现对极少比例的推理请求施加最大输出令牌限制可显著降低排队延迟,该模型为最优限制值的选取提供了依据。针对批处理推理,我们将服务过程建模为批量队列,其中批处理时间同时受批次大小与该批次内最大令牌长度的共同影响。本文推导了全缓冲请求批处理(动态批处理)、固定数量请求批处理(固定批处理)以及无批内等待批处理(弹性批处理)三种策略下的排队延迟。实验结果表明,我们的数学模型与事件驱动仿真结果高度吻合。

0
下载
关闭预览

相关内容

 DiffRec: 扩散推荐模型(SIGIR'23)
专知会员服务
48+阅读 · 2023年4月16日
AAAI 2022 | ProtGNN:自解释图神经网络
专知
10+阅读 · 2022年2月28日
图机器学习 2.2-2.4 Properties of Networks, Random Graph
图与推荐
10+阅读 · 2020年3月28日
【NeurIPS2019】图变换网络:Graph Transformer Network
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员