通过采样模拟提升多大模型离线推理效率,实现1.0至2.4倍加速。
Improving the End-to-End Efficiency of Offline Inference for Multi-LLM Applications Based on Sampling and Simulation
- 先采样估计输出长度,再仿真推算推理耗时,精准预测延迟。
- 提出贪心调度算法,在单节点多GPU上优化模型并发与并行策略。
- 框架动态调整调度,适合需高效运行多个大模型的离线应用。
随着大语言模型在诸多任务中取得成功,其被广泛应用于各类场景。现有研究多关注单模型应用的效率(如卸载、请求调度、并行策略选择),而对多模型应用尤其是离线推理场景的关注较少。本文旨在提升单节点多GPU环境下多大模型应用的离线端到端推理效率。核心问题包含两个决策:一是每次选择哪些模型并发运行(并非全部同时运行),二是为每个模型选择合适的并行策略。该问题为NP难问题。朴素方法效果不佳,因模型完成一组请求的时间依赖于请求负载和并行策略,且缺乏准确的运行时间模型。由于大模型输出长度在运行前未知,我们提出一种采样-仿真方法:首先通过预先从大规模数据集获取的经验累积函数进行采样以估计输出长度,再据此仿真推理过程,从而估算每轮延迟,得到总延迟。基于此,提出贪心调度算法优化模型在各GPU上的调度。进而构建框架SamuLLM,包含规划阶段(调用贪心算法)和运行阶段(根据实时信息动态调整调度)。在3个独立应用及混合应用上的实验表明,SamuLLM相比竞品可实现1.0至2.4倍的端到端加速。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。