用模型自生成嵌入预测输出长度,优化大模型调度效率
Don't Stop Me Now: Embedding Based Scheduling for LLMs
- 利用模型内部嵌入做轻量级预测,实时估算请求剩余长度
- 提出带有限抢占的预测式最短剩余时间调度,降低延迟30%以上
- 适合高并发交互式大模型系统,兼顾性能与内存开销
高效调度对交互式大语言模型应用至关重要,低请求完成时间直接影响用户参与度。基于大小的调度算法如最短剩余处理时间(SRPT)通过已知或估计的请求大小来减少平均完成时间,并允许新到达的短任务抢占长任务。然而,在大模型系统中应用此类方法面临两大挑战:首先,准确预测输出长度通常困难且资源密集,导致当前主流系统默认采用先到先服务策略,引发队头阻塞并降低系统效率;其次,抢占会增加额外内存开销,因需保存未完成请求的中间状态。本文提出TRAIL,一种从目标大模型自身获取输出预测的方法:每生成一个输出标记后,复用其内部结构的嵌入作为输入,通过轻量级分类器预测各运行请求的剩余长度。基于这些预测,我们设计了一种考虑内存开销的预测式SRPT变体,允许早期执行时抢占,但在接近完成时限制抢占以优化资源利用。理论上,我们在M/G/1队列模型中推导出该变体的闭式公式,证明其潜在价值。在系统实现中,我们将此抢占策略与嵌入预测方法结合,实测显示显著提升调度效率。
原文摘要 · Abstract (English)
Efficient scheduling is crucial for interactive Large Language Model (LLM) applications, where low request completion time directly impacts user engagement. Size-based scheduling algorithms like Shortest Remaining Process Time (SRPT) aim to reduce average request completion time by leveraging known or estimated request sizes and allowing preemption by incoming jobs with shorter service times. However, two main challenges arise when applying size-based scheduling to LLM systems. First, accurately predicting output lengths from prompts is challenging and often resource-intensive, making it impractical for many systems. As a result, the state-of-the-art LLM systems default to first-come, first-served scheduling, which can lead to head-of-line blocking and reduced system efficiency. Second, preemption introduces extra memory overhead to LLM systems as they must maintain intermediate states for unfinished (preempted) requests. In this paper, we propose TRAIL, a method to obtain output predictions from the target LLM itself. After generating each output token, we recycle the embedding of its internal structure as input for a lightweight classifier that predicts the remaining length for each running request. Using these predictions, we propose a prediction-based SRPT variant with limited preemption designed to account for memory overhead in LLM systems. This variant allows preemption early in request execution when memory consumption is low but restricts preemption as requests approach completion to optimize resource utilization. On the theoretical side, we derive a closed-form formula for this SRPT variant in an M/G/1 queue model, which demonstrates its potential value. In our system, we implement this preemption policy alongside our embedding-based prediction method.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。