Paper commentary
Reducing Batch Makespan for LLM Agent Workloads through Inference-Environment Coordination
Trajectory-aware routing and capacity-separated scheduling shorten agent batch makespan
- Problem Agent batches run slowly because a few long trajectories set the finish time, and a fixed cache split between KV cache and recurrent state wastes memory. Environment capacity limits also couple tightly to inference concurrency.
- Method The authors size the cache split from each workload's footprint before serving starts. They route each trajectory by a shared label, and they decouple sample admission from environment execution, using CAAS to dispatch deeper chains first.
- Results Live evaluations with Ling-3.0-Flash and Ling-3.1-Flash on BFCL, SWE-bench Multilingual, WideSearch and MCP-Atlas cut makespan by 10.4% to 65.0% while evaluation scores stay aligned.
Where batch agent runs get stuck
Each agent sample alternates between an LLM inference turn and an environment step until a final response or terminal action ends it. A batch is only done when every sample is done, so a few slow chains set the finish time for the whole run. The authors therefore target batch makespan, the elapsed time until all trajectories complete, rather than per-request latency.
Successive turns share a growing input prefix, so the authors reuse cache across turns to cut recomputation. Hybrid models such as Ling-3.0-Flash need a KV cache, which grows with context, and a recurrent state, which has a fixed size per request. SGLang keeps these two states in separate pools inside one shared cache-memory budget. A fixed split can exhaust one pool while the other sits partly unused, which caps how many trajectories keep their caches together.
A request can also wait long enough for its cached state to be evicted before it runs. Finding reuse by token-prefix matching adds heavy computational overhead, so the authors use a shared trajectory label instead.
Environment capacity adds a second limit, and a single sample-concurrency limit ties that capacity to inference. Raising the shared limit can overload environment tools, while lowering it leaves inference workers without ready requests. The order in which waiting environment jobs run decides when each trajectory returns to inference. Repeated waits can defer a long trajectory's later stages, so a few long trajectories stretch the batch tail.
Sizing the cache split before serving
The cache split is sized from the workload's own footprints before serving starts, then kept fixed during serving. The average number of KV-cache entries is measured for a complete trajectory at its final inference turn. Each inference request occupies a fixed number of recurrent-state slots, so the recurrent footprint is a constant per request.
The final-turn KV-cache allocation is a conservative estimate, since accumulated context grows across turns, though it isn't a strict upper bound.
Dividing each pool by its per-trajectory footprint gives a count of trajectories that the pool can hold. The joint capacity is the minimum of the two counts, because a trajectory keeps its reuse only when both its KV cache and recurrent state stay resident. Balancing sets the two counts equal, which yields the balancing ratio rbal(D) equal to Sstate times cstate divided by Lkv(D) times ckv.
Optional local calibration can select a nearby ratio that performs better, so the chosen value r-hat may differ from rbal.
The reference concurrency is the continuous capacity rounded down per worker, and the aggregate across W homogeneous workers is W times that floor. The reference concurrency isn't a hard cap, since timely cache reuse may support more concurrent trajectories. The model ignores recurrent-state slot granularity, KV-page granularity and runtime fragmentation, so it works as a heuristic rather than an exact bound.
The Section 5.2.1 results show that these model-derived ratios and reference concurrencies give effective operating points on the evaluated workloads.
Routing and queue priority from one trajectory label
Token-prefix matching is costly, so the paper uses one shared trajectory label as a cheap signal for both routing and queue ordering. The label serves as an affinity key at the router and lets each worker screen waiting requests before it queries the prefix cache. This only works if every inference request in a trajectory carries the same label.
Load-bounded consistent hashing (LBCH) adapts consistent hashing with bounded loads to per-turn routing, using the label for affinity and in-flight request counts for load control.
The workers sit on a hash ring, and the label hashes to a position whose first clockwise worker is the home worker. A worker is eligible when its count of queued or running requests is at most the total in-flight load plus one, divided by the worker count, times α. The factor α is at least 1, and values above 1 allow controlled load skew in favor of affinity.
If the home worker is ineligible, the router walks clockwise and picks the first eligible successor, falling back to the home worker when none qualifies.
Routing-prefix (RP) scheduling works inside each worker, where it keeps a label set A of recently admitted trajectories with capacity CA. Waiting requests whose labels are in A form the first tier, and only those requests trigger a PrefixHit lookup. Within the first tier, a longer prefix hit ranks earlier, and queue-entry time breaks ties.
The existing batch builder then admits requests in this order, and LRUUpdate refreshes A from the admitted labels. The label set records recent admissions rather than GPU cache residency, so a label can outlive its cached state. CA defaults to the floor of the joint capacity at the selected ratio, matching the label set to what one worker can retain.
In SGLang, LBCH runs in the router and RP runs as a scheduling policy in each worker, both reading the same label from request metadata.
Coupling admission and environment execution
Sample admission and environment execution get separate limits, so inference can keep more trajectories ready while environment jobs queue. A single shared limit, as in the MCP-Atlas and τ3-bench harnesses, couples the two stages and can overload the environment or starve inference. The sample-admission limit CS bounds active samples, and each sample holds its slot from admission to completion, including while it waits.
The environment-execution limit CE caps how many environment jobs run at once, and each stage is a non-preemptive job. A unified gate would set CS as the minimum of the inference reference concurrency and CE. The default decoupled choice sets CS equal to the inference reference concurrency alone, and pending jobs keep sample slots without taking execution slots.
CAAS orders pending environment jobs, and it only changes which job dispatches next, not the agent's actions or job service times. Each job gets a priority key when it joins the pending queue, and the key stays fixed while the job waits. The key has four parts: the arrival band gj, the negated chain depth -nj, the duration bucket cj, and the global entry sequence ej.
The arrival band is the slot-request time aj divided by B and rounded down, so earlier bands are served first. Depth counts completed inference turns, so deeper revealed chains go ahead of shallower ones within a band. Within a band and depth, a shorter estimated inference return wins, and entry order resolves any remaining ties. CAAS needs no sample profiles or length predictions, because it uses only the completed turns observed in the current run.
The arrival band matters because depth alone would let returning trajectories keep overtaking shallower jobs in earlier bands. A small B keeps arrival order dominant, while a large B gives chain depth more influence. Section 5.3 reports that CAAS reduces batch tail and makespan over FCFS after capacity separation.
Replay evidence for cache allocation and scheduling under cache pressure
The authors start from a model-derived operating point on a single TP4 worker with FCFS scheduling, where SWE has r_bal of 0.09 and C_ref of 98. The model-derived points come close to the best measured makespans on all three workloads, which leaves only modest room for local search. The analytical model ignores allocation granularity and runtime fragmentation, yet it still gives a workable heuristic for picking the cache ratio and concurrency together.
At a fixed ratio, pushing concurrency past the reference can cause sharp slowdowns and, on SWE, six-hour timeouts. At low concurrency, makespan barely changes with the ratio, because both pools have enough room to keep reusable state.
Cache reuse breaks down inside a specific band of concurrency, and that band depends on the cache ratio. On SWE, raising C_S from 147 to 157 pushed new-prefill work to about eleven times its previous level. Output throughput fell even though more requests sat in the engine, which the authors attribute to memory pressure evicting reusable entries.
So the cache ratio and sample concurrency have to be chosen together rather than one after the other.
With the cache ratio fixed at the balanced allocation, the authors compared FCFS, LPM, DFS-weight and routing-prefix on a single worker. At the two highest concurrency levels, all three cache-aware policies beat FCFS on the three workloads. On SWE at C_S of 289, FCFS hit the 13-hour limit, while routing-prefix finished in 128.2 minutes. Routing-prefix was shorter than LPM and DFS-weight at most tested settings, though not at every one.
Routing-prefix kept cache reuse high as concurrency grew, with little extra prefill work.
The routing results show what LBCH adds on top of the in-worker policy. LBCH achieved lower request-count imbalance than CA and CH on all three workloads. LBCH holds reuse while spreading in-flight requests more evenly across the two workers. The authors didn't test whether this balance holds beyond the two-worker setting in this replay.
Capacity separation and CAAS when the environment is the limit
Capacity separation starts from MCP-Atlas trajectories replayed on two TP4 workers running routing-prefix scheduling and LBCH. The authors set the environment-execution limit CE to 3 or 5, and compare unified admission against decoupled admission at CS values of 10, 25 and 50. Both settings use FCFS job scheduling, so this comparison isolates the admission limit alone.
Moving from the unified baseline to CS = 10 cuts makespan by roughly one third at both CE values. Beyond that point, makespan fluctuates within a narrow range at CS = 25 and 50. Extra samples past that point mostly wait for environment results, which is why the gains level off. At matched sample concurrency, CE = 5 keeps more inference requests in flight and gives shorter makespans than CE = 3.
CAAS is compared with FCFS at CS = 50, changing only the job ordering while the inference configuration and recorded workload stay fixed. At CS = 50, CAAS reduces makespan relative to FCFS by 1.9% at CE = 3 and by 3.5% at CE = 5. CAAS shortens that tail relative to FCFS by 19.0% at CE = 3 and by 21.4% at CE = 5. CAAS reaches 95% completion later than FCFS, yet it finishes the batch earlier.
Prioritizing trajectories with greater revealed depth delays some others, but it lets the later stages of deep chains run sooner. The authors attribute these gains to dispatch order alone, since job service times are unchanged.
Live validation on two Ling models
Ling-3.0-Flash has 124B total and 5.1B active parameters, while Ling-3.1-Flash has 560B total and 25B active parameters. The two models ran on two TP4 workers over eight H20 GPUs and on two TP8 workers over sixteen H20 GPUs, respectively. BFCL-v4 was dropped for Ling-3.1-Flash because its scores were nearly saturated and the authors no longer use it in model development.
Only cache allocation, sample concurrency, scheduling and routing change, and for MCP-Atlas also capacity separation and job ordering. Live makespan counts all samples and retry time, so samples that are retried or ultimately fail aren't excluded.
Each SWE comparison adds a Baseline-2 that uses the optimized sample concurrency but keeps the baseline cache allocation and inference policies. Each metric in Table 2 is averaged over three runs per configuration. For Ling-3.0-Flash, the optimized configuration cut mean makespan by 28.1% on BFCL, 10.4% on SWE and 37.5% on WideSearch. For Ling-3.1-Flash, the cuts were 20.9% on SWE and 21.9% on WideSearch, which the authors read as evidence of scaling to larger models.
On SWE, Baseline-2 fell to 87.5% cache reuse on Ling-3.0-Flash, against 98.6% for Opt. Opt cut makespan by 24.4% at that same sample concurrency. The authors attribute the drop to cache pressure, where eviction adds recomputation that can offset parallelism gains. On Ling-3.1-Flash, Opt kept 98.3% reuse versus 80.4% for Baseline-2 and cut makespan by 39.1%.
On BFCL and WideSearch, optimized runs were faster despite higher worker-load imbalance, with cache reuse comparable to the baselines.
Compared with Baseline-2, Opt cut TTFT by 24.9% on Ling-3.0-Flash and by 50.2% on Ling-3.1-Flash. TPOT fell by 51.1% and 40.2% for the same two models. Against Baseline-1, Opt runs at higher concurrency, so its per-request TTFT and TPOT rise even though the batch finishes sooner.
Limits of the evidence
Replay measures execution efficiency, not whether generated text matches the recorded action. No environment actions execute during replay, so the runs never test real tool outcomes. The cache sweeps and the in-worker scheduling comparisons run on a single TP4 worker. The CAAS experiments, in contrast, use two TP4 workers with routing-prefix scheduling and LBCH.
The label set records recent batch admissions, not GPU cache residency, so the two can disagree. A label removed from the set leaves its cached state on the worker, and that request skips the prefix lookup. LBCH needs every inference request of a trajectory to carry the same trajectory label. Cross-worker cache transfer is outside the scope of this work, so a turn reuses cache only on the worker that holds it.
The capacity model treats cache memory as continuously divisible, so it leaves out slot granularity and fragmentation. The authors note that the balancing ratio may not be optimal in practice, so the balance point is an estimate. CAAS reduces makespan relative to FCFS by only 1.9% at CE = 3 and 3.5% at CE = 5.
Relative to Baseline-1, the optimized configuration runs at higher concurrency, which raises its per-request TTFT and TPOT. Its batch makespan is still shorter, so the paper separates batch efficiency from per-request latency. The live study covers four named benchmarks, and Ling-3.1-Flash wasn't run on BFCL-v4. Each live configuration is averaged over three runs, and stochastic sampling still shifts token counts across runs.
Paper info
- Authors
- Wei Feng, Meiling Chen, Boxiao Chen, Lu Liu, Bin Zi, Libin Ye, Xingyu Lu, Lei Xu, Jun Zhou
- Venue
- arXiv · Preprint
- First published
- 2026-11-12
- Added
- 2026-11-13
- Updated
- 2026-11-12
- Version
- v1
- arXiv
- 2611.16661
- Category
- cs.DC · cs.AI
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
Efficient batch execution of agent tasks is critical to LLM training and development workflows, including benchmark evaluation, synthetic-data generation, and RL rollouts. Since these tasks alternate between LLM inference and environment interaction, we present coordinated optimizations to reduce batch makespan, the time required to complete all tasks in a batch. For hybrid LLMs, a workload-based resource model guides GPU-memory allocation between key-value (KV) cache and recurrent state and provides a reference sample concurrency to exploit parallelism while limiting recomputation. Trajectory-aware routing and scheduling promote cache reuse while balancing worker load. Under constrained environment capacity, we decouple sample admission from environment execution and introduce Chain-Advancing Action Scheduling (CAAS), which prioritizes long chains using observed progress to shorten the batch tail. Controlled replay combines actual inference with recorded environment responses and durations for ablations of individual optimizations. Live evaluations with Ling-3.0-Flash and Ling-3.1-Flash on the BFCL, SWE-bench Multilingual, WideSearch, and MCP-Atlas benchmarks demonstrate makespan reductions of 10.4% to 65.0%, while evaluation scores remain aligned. Furthermore, these methods have been successfully applied to training and evaluation workflows for the Ling-3.x model series, accelerating the model-development cycle.
Quote from the paper
Wei Feng, Meiling Chen, Boxiao Chen, Lu Liu, Bin Zi, Libin Ye, Xingyu Lu, Lei Xu, Jun Zhou (2026). Reducing Batch Makespan for LLM Agent Workloads through Inference-Environment Coordination. arXiv:2611.16661v1. https://arxiv.org/abs/2611.16661v1
BibTeX
@misc{feng2026reducing,
title = {{Reducing Batch Makespan for LLM Agent Workloads through Inference-Environment Coordination}},
author = {Wei Feng and Meiling Chen and Boxiao Chen and Lu Liu and Bin Zi and Libin Ye and Xingyu Lu and Lei Xu and Jun Zhou},
year = {2026},
eprint = {2611.16661},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.16661v1}
}