基于采样与仿真的多LLM应用离线推理端到端效率提升
Improving the End-to-End Efficiency of Offline Inference for Multi-LLM Applications Based on Sampling and Simulation
AI总结:
针对多LLM离线推理调度的NP难问题,提出采样估输出长度+仿真测延迟的方法与贪心调度策略,构建SamuLLM框架,实现单节点多GPU下1.0-2.4倍端到端加速。
摘要:
随着大语言模型(LLM)在众多任务中取得巨大成功,它们已被应用于各类场景。现有大量研究聚焦于单LLM应用的效率优化(如任务卸载、请求调度、并行策略选择),但多LLM应用受到的关注较少,尤其是离线推理场景。本文旨在提升单节点多GPU环境下多LLM应用的离线端到端推理效率。该问题包含两个关键决策:(1)确定每次并发运行哪些LLM(无需同时运行所有模型);(2)为每个LLM选择并行策略。该问题属于NP难问题。朴素方案效果不佳,因为模型完成一组请求的运行时间取决于请求负载与所选并行策略,且缺乏准确的运行时间估算模型。由于LLM的输出长度在运行前未知,为估算模型运行时间,我们提出一种先采样后仿真的方法:首先通过预先从大规模数据集中得到的经验累积函数进行采样,估算输出长度,再据此仿真LLM推理过程。基于仿真结果,我们估算每轮迭代的延迟,进而得到总延迟。我们提出一种贪心方法,用于优化应用中LLM在多GPU间的调度。随后我们提出SamuLLM框架,包含两个阶段:规划阶段调用贪心方法为应用生成调度方案,运行阶段执行应用并根据运行时信息动态调整模型调度。在3个应用及1个混合应用上的实验表明,与对比方案相比,SamuLLM可实现1.0-2.4倍的端到端加速比。
英文摘要:
As large language models (LLMs) have shown great success in many tasks, they are used in various applications. While a lot of works have focused on the efficiency of single-LLM application (e.g., offloading, request scheduling, parallelism strategy selection), multi-LLM applications receive less attention, particularly in offline inference scenarios. In this work, we aim to improve the offline end-to-end inference efficiency of multi-LLM applications in the single-node multi-GPU environment. The problem involves two key decisions: (1) determining which LLMs to run concurrently each time (we may not run all the models at the same time), and (2) selecting a parallelism strategy to use for each LLM. This problem is NP-hard. Naive solutions may not work well because the running time for a model to complete a set of requests depends on the request workload and the selected parallelism strategy, and they lack an accurate model of the running time. As the LLM output lengths are unknown before running, to estimate the model running time, we propose a sampling-then-simulation method which first estimates the output lengths by sampling from an empirical cumulative function we obtained from a large dataset in advance, and then simulates the LLM inference process accordingly. Based on the simulation, we estimate the per-iteration latencys to get the total latency. A greedy method is proposed to optimize the scheduling of the LLMs in the application across the GPUs. We then propose a framework SamuLLM which contains two phases: planning, which calls the greedy method for an application and running, which runs the application and dynamically adjust the model scheduling based on the runtime information. Experiments on 3 applications and a mixed application show that SamuLLM can achieve 1.0-2.4$\times$ end-to-end speedups compared to the competitors.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。