用强化学习动态调度推理任务,多卡场景下性能提升超3倍。
Adaptive Inference Batching using Policy Gradients

- 用强化学习自动优化请求批处理和路由策略。
- 多卡异构环境下吞吐量提高60%,延迟降低25%。
- 适合高并发、资源竞争复杂的生产推理系统。
推理服务系统需在突发、异构负载下平衡吞吐量与延迟,但行业标准仍依赖需人工调优的静态批处理策略,无法自适应流量变化。本文研究强化学习(RL)是否能学习出优于传统启发式算法的自适应批处理与路由策略,在基于离散事件的仿真器上训练REINFORCE和PPO代理,该仿真器经排队论和真实生产数据(Azure Functions、BurstGPT)验证。将问题建模为马尔可夫决策过程(MDP),状态包括队列状态、请求类型和GPU可用性,评估涵盖标准泊松流量、极端突发、真实世界轨迹及异构多卡路由场景。核心发现:在单卡场景下,经过良好调优的静态批处理策略已接近最优,RL仅带来+0.1%至+1.0%的边际提升;而在多卡异构路由中,快慢请求争夺共享资源时,智能体发现了一种工作负载隔离策略,消除队首阻塞,相比轮询(Round-Robin)提升3.5倍(348%),较最强启发式基线(最短队列)提升48%,同时实现60%更高的吞吐量和25%更低延迟,且满足SLA约束。该策略在未见过的突发和真实流量上具有良好泛化能力,采用注意力增强的策略网络比MLP基线收敛快约20%。结果表明,强化学习在组合型、多资源决策中优于人工设计启发式算法,而非单一资源的时间调度,这一实践差异对判断学习策略在生产推理基础设施中的工程成本合理性具有指导意义。
原文摘要 · Abstract (English)
Inference serving systems must balance throughput and latency under bursty, heterogeneous workloads, yet the industry standard remains static batching policies that require manual tuning and cannot adapt to shifting traffic. We investigate whether reinforcement learning (RL) can learn adaptive batching and routing policies that outperform these heuristics, training REINFORCE and PPO agents on a discrete-event simulator validated against queuing theory and production traces (Azure Functions, BurstGPT). We formulate the problem as an MDP over queue state, request type and GPU availability, evaluating across standard Poisson traffic, extreme bursts, real-world traces and heterogeneous multi-GPU routing. Our central finding is a clear boundary condition for RL's value in systems problems. In single-GPU settings, a well-tuned static batching policy is already near-optimal under Poisson-like arrivals and RL offers only marginal gains (+0.1% to +1.0%). In multi-GPU heterogeneous routing, however, where fast and slow requests compete for shared resources, the agent discovers a workload-segregation policy that eliminates Head-of-Line blocking, yielding a 3.5x (348%) improvement over Round-Robin and a 48% improvement over the strongest heuristic baseline (Shortest-Queue), with 60% higher throughput and 25% lower latency while respecting SLA constraints. The policy generalizes to unseen bursty and real-world traffic despite training only on synthetic Poisson arrivals and an attention-augmented policy network converges roughly 20% faster than an MLP baseline. These results suggest RL's advantage over engineered heuristics concentrates in combinatorial, multi-resource decisions rather than single-resource temporal scheduling, a practical distinction for deciding where learned policies justify their engineering cost in production inference infrastructure.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。