为大模型服务端优化思考令牌分配,平衡准确率与延迟。
Queueing-Aware Optimization of Reasoning Tokens for Accuracy-Latency Trade-offs in LLM Servers
- 根据任务类型动态分配内部思考令牌,控制计算开销。
- 最优分配使准确率-延迟权衡达到理想状态,系统稳定且收敛。
- 方法适用于高并发异构请求场景,适合部署在生产级推理服务中。
我们研究单一大型语言模型(LLM)服务器如何服务来自N种不同任务类型的异构查询流。查询按泊松过程到达,每类任务出现概率已知。对每类任务,服务器分配固定数量的内部思考令牌,决定其计算投入。令牌分配引发准确率-延迟权衡:服务时间近似线性依赖于分配令牌数,而正确响应概率呈现递减收益。在先进先出(FIFO)调度下,系统构成M/G/1队列,平均系统时长取决于服务时间分布的一阶和二阶矩。我们构建约束优化问题,最大化加权平均准确率目标,同时惩罚平均系统时长,受限于令牌预算与队列稳定性条件。目标函数在稳定区域内严格凹,确保最优解存在且唯一。一阶最优条件导出耦合投影不动点表征,并提出迭代求解方法及收缩性显式条件。此外,设计了具有可计算全局步长边界的投影梯度法,保证在非收缩区域仍收敛。最终通过四舍五入获得整数令牌分配,仿真验证性能损失较小。
原文摘要 · Abstract (English)
We consider a single large language model (LLM) server that serves a heterogeneous stream of queries belonging to $N$ distinct task types. Queries arrive according to a Poisson process, and each type occurs with a known prior probability. For each task type, the server allocates a fixed number of internal thinking tokens, which determines the computational effort devoted to that query. The token allocation induces an accuracy-latency trade-off: the service time follows an approximately affine function of the allocated tokens, while the probability of a correct response exhibits diminishing returns. Under a first-in, first-out (FIFO) service discipline, the system operates as an $M/G/1$ queue, and the mean system time depends on the first and second moments of the resulting service-time distribution. We formulate a constrained optimization problem that maximizes a weighted average accuracy objective penalized by the mean system time, subject to architectural token-budget constraints and queue-stability conditions. The objective function is shown to be strictly concave over the stability region, which ensures existence and uniqueness of the optimal token allocation. The first-order optimality conditions yield a coupled projected fixed-point characterization of the optimum, together with an iterative solution and an explicit sufficient condition for contraction. Moreover, a projected gradient method with a computable global step-size bound is developed to guarantee convergence beyond the contractive regime. Finally, integer-valued token allocations are attained via rounding of the continuous solution, and the resulting performance loss is evaluated in simulation results.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。