arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.04785cs.DC
收藏

通过生成长度预测实现 LMaaS 的高效批量服务

Enabling Efficient Batch Serving for LMaaS via Generation Length Prediction

Ke Cheng, Wen Hu, Zhi Wang, Peng Du, Jianguo Li, Sheng Zhang

AI总结:

本文提出 Magnus 系统,利用用户输入长度及语义特征预测 LMaaS 请求的生成长度,并通过相似长度分批、自适应批量大小和 HRRN 调度,显著提升吞吐量并降低响应时间。

摘要:

如今,大语言模型(LLMs)以服务形式发布,并可通过 API 被各种应用访问,这也被称为语言模型即服务(LMaaS)。在不知道请求生成长度的情况下,现有服务系统以先到先服务(FCFS)方式和固定批量大小来服务请求,这会导致两个影响批量服务效率的问题。第一,一个批次中请求的生成长度各不相同,生成长度较短的请求必须在批量服务过程中等待生成长度较长的请求完成。第二,生成长度较长的请求在服务期间会消耗更多内存。由于不知道批次内请求的生成长度,批量大小总是被设置得很小,以避免内存不足(OOM)错误,从而阻碍了 GPU 被充分利用。在本文中,我们发现 LMaaS 场景中大量流行应用的用户原始输入长度与生成长度之间存在正相关关系。基于这一观察,我们提出了 Magnus,它能够利用用户输入长度、应用级和用户级语义特征准确预测请求的生成长度。据此,Magnus 可以通过将生成长度相近的请求组合成批次,并采用自适应批量大小来实现高请求吞吐量。此外,Magnus 还可以采用最高响应比优先(HRRN)策略调度批次,以减少请求响应时间。在我们的测试平台上进行的实验表明,与基线相比,Magnus 将请求吞吐量最多提高了 234%,并将响应时间最多降低了 89.7%。

英文摘要:

Nowadays, large language models (LLMs) are published as a service and can be accessed by various applications via APIs, also known as language-model-as-a-service (LMaaS). Without knowing the generation length of requests, existing serving systems serve requests in a first-come, first-served (FCFS) manner with a fixed batch size, which leads to two problems that affect batch serving efficiency. First, the generation lengths of requests in a batch vary, and requests with short generation lengths must wait for requests with long generation lengths to finish during the batch serving procedure. Second, requests with longer generation lengths consume more memory during serving. Without knowing the generation lengths of batched requests, the batch size is always set small to avoid the out-of-memory (OOM) error, thus preventing the GPU from being fully utilized. In this paper, we find that a significant number of popular applications in the LMaaS scenario have a positive correlation between the generation length and the length of raw user input. Based on this observation, we propose Magnus, which can accurately predict the request generation length with the user input length, application-level, and user-level semantic features. Accordingly, Magnus can achieve high request throughput by batching requests of similar generation lengths together with adaptive batch sizes. Besides, Magnus can also schedule batches with the highest response ratio next (HRRN) policy to reduce request response time. Experiments conducted on our testbed show that Magnus improves request throughput by up to 234\% and reduces response time by up to 89.7\% compared to baselines.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑