← Back to Research/Experiments

Two Scheduling Decisions, One Rule

A program-aware scheduler sorts by context size twice: at admission and at eviction. The two sorts hurt opposite ends of the size distribution, and neither shows up in throughput or mean latency.

15 September 2026

ThunderAgent is a program-aware scheduler for agentic LLM inference (ICML 2026 Spotlight). It schedules whole agent trajectories, called programs, instead of single calls. It already ships as the rollout gateway in SkyRL and inside NVIDIA Dynamo.

I went looking for eviction churn and found something narrower: one sort rule, applied at two decision points, harming opposite populations. Throughput is fine. Mean latency is fine. One group waits 447 seconds to start.

  1. The short report. The four-page brief. Six minutes, every number linked.
  2. The setup. Why RL rollouts care about makespan, not mean latency.
  3. Eviction is smallest-first. 40 of 40 decisions picked the smallest eligible program.
  4. The confound, controlled. Short programs are not just eligible more often.
  5. Admission is smallest-first too. The same sort, one decision earlier.
  6. The trap. A correlation saying bigger contexts run faster.
  7. Intervention A, admission order. FIFO wins makespan in every seed.
  8. Intervention B, fatigue-aware eviction. Worst-case protection, not a speedup.
  9. Limits. What is a source fact and what is scale-dependent.
vllm serve Qwen/Qwen3-0.6B terminal output nvidia-smi output showing one NVIDIA L4
External measurement brief Four pages · six minutes
What smallest-first ordering costs at the edges
An external measurement of ThunderAgent's admission and eviction paths
Pinned commit
57ba070ae6e794931c5451c8ccf5cf16100f964b

ThunderAgent optimizes every scheduling decision by instantaneous token count. That is correct for the objective it targets, and the eviction side is proven optimal in Lemma 4.1 of the paper. This brief is not about that. It is about a second place the same ordering rule applies — admission of new programs — where it produces something the paper's own Appendix E argument (program-level latency matters more than per-step latency) would predict should not happen.

The headline numberBurst arrival · three seeds

Under burst arrival, a program's wait for its first response scales almost linearly with its prompt size.

Start tokTime to first responseSeconds
1,444 0.5
3,477 103.9
5,186 142.4
7,092 303.0
8,046 404.4
corr(prompt size, first-response latency)
Across three seeds
Computed by admission_check.py L22–31

About 75% of programs waited over 20 seconds just to start — 48/64, 51/64, 47/64.

Every step after the first averaged 0.6 s. This is purely a first-request effect.

Smallest-first ordering · Admission & eviction 1 / 4
Where it comes from

In _resume_paused_programs, every waiting program is sorted globally, smallest tokens first, before being split into priority groups:

paused_programs = self._get_paused_programs_sorted(ascending=True)

Since new_program_group inherits that ordering, brand-new programs are admitted smallest-first, identical to how running programs are evicted smallest-first. Under a burst of simultaneous arrivals, large-prompt programs land at the back of the queue and stay there.

Source of the ordering
scheduler/router.py#L846 — commit 7ddc861.
Why this matters specifically for you
01
Burst arrival is not a synthetic artifact. It is the normal shape of RL rollout launch: every trajectory in a batch fires at the start of a training step.
02
ThunderAgent is already the rollout gateway in SkyRL (SWE Agent rollout 3× faster on 40 H100s, PR #1645) and integrated into NVIDIA Dynamo (PR #9448; program abstraction as a first-class scheduling unit, PR #8789).
03
In GRPO-style training, a group of rollouts sharing one prompt must all finish before advantages compute. Group members share a prompt, so they share similar token counts — the ordering does not spread across a group, it targets whole groups at once.
The clearest illustration

Two groups, same run, same 43,216-token capacity.

Small-prompt group 1,504 tok104.6 s
admit 2.0 s · execute 102.6 s
Large-prompt group 8,120 tok518.5 s
admit 447.2 s · execute 71.4 s

The small group gets in almost instantly and pays on the back end. The large group is never touched once running, and pays entirely on the front end — nearly 5× longer overall.

corr(group size, evictions on that group) across three seeds: −0.840 · −0.841 · −0.900

The two effects are statistically independent — each drives its own phase.

Admission waitExecution time
Prompt size+0.82−0.43
Eviction count−0.34+0.69

The negative size-vs-execution number initially looked odd — bigger prompts should execute slower, not faster. Partial-correlation testing shows it collapses from −0.43 to −0.13 once eviction count is held fixed. Large programs execute faster only because they are essentially never evicted — not because size itself helps.

Mechanism · Consequence 2 / 4
Scope and setupRead before the numbers travel
Hardware & stack
1× NVIDIA L4 (23 GB)
vLLM 0.27.1 · Qwen3-0.6B
single backend
Capacity
KV cache 43,216 tok
contexts 1,500–8,000 tok
Method
3 seeds throughout
synthetic agent workload driving the real, unmodified scheduler via program_id
Scale caveat

This is far smaller than your 8× H100 evaluations. The ordering mechanism is confirmed directly in source, so it will hold at any scale — but the absolute wait times (up to 447 s here) will differ at production scale and should not be read as production numbers.

Full setup, logs, every scriptgithub.com/SARPAT/thunderagent-churn-study
The one open question
Is smallest-first admission for brand-new programs a deliberate choice, or a side effect of new_program_group reusing the same sort used for resuming previously-paused programs?

If deliberate, the tradeoff — maximize concurrent programs per unit of KV cache, at the cost of large-prompt TTFT under burst load — is a reasonable one. It just seemed worth surfacing given where the system is now deployed.

Nothing here contradicts the paper. The eviction policy does exactly what Lemma 4.1 says it should.

The admission path applies the same logic to a different decision, under conditions — burst arrival, grouped rollouts — the original eviction analysis did not model. That combination is the entire finding.

Full raw data, all analysis scripts, and every log referenced above are in the linked repository, including three independent replications of every number cited here. 3 / 4
A tested alternativeWhat we tried · what it cost

The bias above raises an obvious question: what would changing it cost? new_program_group's sort was patched behind an environment variable, isolated so eviction and resume ordering stay untouched — three admission orderings, three seeds each, same workload, same eviction path.

Smallest-first · router.py#L846
Smallest new program first · upstream
FIFO
Arrival order, size-blind
Largest-first
Largest new program first
Results · three seeds per armcompare_admission.py · nine result files
Smallest-firstFIFOLargest-first
corr(size, TTFT)+0.855 / +0.747 / +0.868+0.272 / +0.230 / +0.406+0.113 / −0.019 / +0.330
Large/small wait ratio9.4× / 8.7× / 9.8×4.8× / 3.9× / 2.6×1.3× / 1.6× / 1.6×
Makespan526 / 512 / 516 s504 / 495 / 498 s489 / 508 / 508 s
Worst group completion518 / 496 / 503 s488 / 474 / 480 s472 / 491 / 492 s
Mean group completion259 / 285 / 272 s289 / 286 / 300 s341 / 367 / 334 s
Total evictions (mean)17.722.326.0

FIFO wins on makespan and worst-group completion in all three seeds — costing ~20–30 s of mean group completion, and cutting the size-fairness ratio from roughly 9.3× to 3.8×.

Largest-first's seed-100 makespan win (−7.1%) did not replicate in seeds 101 or 102 (+0.6%, −1.6%). Treat that arm's seed-100 result as noise, not a finding.

Why this pattern shows up

A standard scheduling result: shortest-processing-time ordering minimizes mean flow time — upstream's actual behaviour on that metric — while longest-processing-time ordering minimizes makespan. FIFO lands between the two.

That matters for synchronous RL rollouts: a training step is gated on the group that finishes last, not the average one. Mean completion is close to irrelevant there; makespan blocks the next step.

The eviction follow-upwhy_more_evictions.py · burst_check.py
Small-1stFIFO
Max evictions on one program3.32.7
Gini (eviction spread)0.8470.770
Capacity breaches per run15.321.0
Evictions per breach1.151.06

FIFO breaches KV capacity more often — a size-mixed resident population oscillates near the limit — but each breach is smaller, not larger, and the extra events don't concentrate. A real but shallow cost.

Does claim
Across three seeds, FIFO improves makespan, worst-case group completion and size fairness, at a modest, well-understood cost.
Does not claim
That FIFO is the right default generally — one workload shape: burst arrival, group-structured, single backend.
Does not claim
That the percentages transfer to production scale. The pattern should hold; the seconds came from one L4, 0.6B model.
The patch tested here is a ~15-line change isolated to one sort call in new_program_group, resume ordering for running programs untouched; full patch, harness and replication instructions are in the linked repository. Links on this page are branch-pinned, pending the verification pass applied to pages 1–3. 4 / 4

Detailed explanation

The report above is the claim. What follows is how I got there, including two hypotheses that failed and one result that did not replicate.

sorted ascending by token count ADMISSION new programs enter EVICTION running programs paused smallest admitted first smallest evicted first LARGE programs wait up to 447 s to start SMALL programs are evicted 3 to 4x over corr(size, TTFT) = +0.855 corr(size, evictions) = −0.84 one rule, two decision points, opposite victims
Figure 1: One ascending sort by token count feeds two scheduler decisions. Admission delays the largest programs; eviction repeatedly pauses the smallest. Blue marks the population harmed at admission, amber the population harmed at eviction, in every figure below.

2. The setup

  • The rule. When KV memory fills, ThunderAgent evicts the program with the smallest context. Recompute cost scales as O(c²), so small is cheapest. Lemma 4.1 proves shortest-first minimizes total recompute. That is correct, and not in dispute here.
  • The mismatch. In GRPO, a group of rollouts shares one prompt, and advantages wait for all of them. The binding metric is makespan, the finish time of the last member. ThunderAgent optimizes mean latency.
  • The testbed. 1× L4, one vLLM backend, Qwen3-0.6B, synthetic programs whose tool calls are sleep calls, 43,216-token KV capacity, three seeds.
Key ideaShortest-processing-time first minimizes mean flow time. Longest-processing-time first minimizes makespan. Both halves show up below. The policy is not wrong; it is aimed at a different objective.

3. Eviction is smallest-first

  • The patched router logs the full candidate list at each decision. So this reads which program was chosen from a known pool; nothing is estimated.
  • 40 of 40 decisions across three seeds picked the smallest eligible candidate, from pools of 7 to 16.[3]exact_decisions.py lines 99 to 108, policy verification
  • Conditional on eligibility, corr(size, evicted | eligible) = −0.53 / −0.33 / −0.33.
Note, a near-missAn earlier configuration averaged 1.2 candidates per decision. The scheduler was taking the only option, not choosing one, and it looked exactly like a confirmed policy. Longer tool calls raised the pool to about 11.

4. The confound, controlled

The objection: short programs cycle faster, so they are simply eligible more often. Four controls say no.

  • Equal opportunity. Every program ran exactly 10 steps.
  • Conditioned on eligibility. The 40 of 40 result already holds the pool fixed.
  • Spearman plus permutation. ρ = −0.668 and −0.626; chance that all long programs escape: 1.4e-7 and 3.9e-7.[4]
  • The never-evicted set. Size-blind eviction puts them at mean rank 19.5 of 40. They sit at 32.4 and 33.1.

Clearest pair: prog-038 (1,833 tok) was eligible 4 times and evicted 4 times. prog-000 (7,333 tok) was eligible 5 times and evicted zero times.

start tokens size (0 to 8,000) each eligible turn evicted 1,500 2 of 7 1,667 1 of 6 prog-038 1,833 4 of 4 2,000 1 of 8 2,167 2 of 5 2,333 1 of 7 2,500 1 of 6 2,667 1 of 5 2,833 1 of 9 3,000 0 of 4 5,833 0 of 4 prog-000 7,333 0 of 5 3,000 tokens and up: never evicted evicted on that turn eligible, not evicted
Figure 2: Eviction given eligibility, 12 most-evicted programs in run10, sorted by start tokens. Each square is one eligible turn; filled squares are evictions. Exposure is shown directly. No program above 3,000 tokens was evicted.

What the churn costs: about 24 s per affected program, measured within size bands (+24.5 s at 40 programs, +23.8 s at 60).[5]

5. Admission is smallest-first too

  • In _resume_paused_programs, waiting programs are sorted ascending before the split into priority groups (router.py#L846).[1] new_program_group inherits that order.router.py lines 843 to 850, ascending sort at line 846
  • NVIDIA's Dynamo docs describe the same thing: "it resumes the smallest-token programs first."[2] Two implementations, one ordering. Read it as deliberate.
  • Result (report, page 1): corr(size, TTFT) = +0.855 / +0.745 / +0.870, and first response ranges from 0.5 s to 404.4 s in one run.
  • Admission wait is 59 to 71% of total program time. corr(group size, admission span) = +0.907, the strongest in the study.[6]
admission wait execution group size 1,504 104.6 s 2,442 165.1 s 3,390 199.6 s 4,341 259.9 s 5,145 75.3 s launched early, slipped in before the backlog formed 6,127 333.7 s 7,124 413.1 s 8,120 518.5 s 447.2 s waiting to be admitted 0 100 200 300 400 500 seconds
Figure 3: Phase composition across all eight groups, seed 100. Small groups are almost all execution; large groups are almost all queue wait. The 5,145-token group launched early enough to slip in before the backlog formed.
  • Eviction mirrors it at group level: corr(group size, evictions) = −0.840 / −0.841 / −0.900.[7]
  • The scheduler has no RL-group concept. Group members share a prompt, so they have similar token counts. The sort hits whole groups, which is exactly the level makespan is computed at.

6. The trap

After admission, corr(size, execution) is −0.43. Read literally, bigger contexts run faster. Two explanations tested:

  • Refuted: contention. corr(concurrency at admit, execution) = −0.017 / +0.010. Controlling for it slightly strengthens the size effect.
  • Confirmed: eviction mediation. corr(evictions, execution) = +0.69. With eviction count held fixed, the size effect collapses from −0.43 to −0.13.[8]
GRPO runs 60-program runs 0 no effect −0.50 −0.25 −0.430 −0.424 raw corr(size, execution) −0.466 −0.501 control: concurrency refuted, effect unchanged −0.125 −0.089 control: eviction count confirmed, 71% and 79% gone
Figure 4: The size–execution correlation, raw and under two controls. Controlling for concurrency leaves it unchanged; controlling for eviction count collapses it toward zero.
  • Takeaway: large programs run faster because they are never evicted. It is the eviction finding in disguise.
  • Method check: the partial correlation was validated on synthetic data first (+0.056 on a null, +0.572 on a real effect).

7. Intervention A, admission order

  • Design. Only new_program_group's sort changes; resume and eviction are untouched. Three arms, three seeds.
  • Control. Smallest-first reproduces the baseline (+0.855 on seed 100), which is what makes the other arms readable.

Results (full table on report page 4):[9]

  • FIFO wins makespan and worst-group completion in all three seeds.
  • Size-fairness ratio drops from about 9.3× to 3.8×.
  • Cost: 20 to 30 s of mean group completion.
  • Largest-first's −7.1% on seed 100 did not replicate (+0.6%, −1.6%). Noise.
520 510 500 490 480 makespan (s) 2x 4x 6x 8x 10x TTFT disparity, large ÷ small (lower is fairer) smallest-first upstream mean group 272 s FIFO mean group 292 s largest-first mean group 347 s lower-left is better bubble area ∝ mean group completion
Figure 5: The tradeoff plane, means of three seeds. FIFO sits lowest-left. Bubble area encodes mean group completion, so the cost of leaving upstream stays visible.

Why FIFO evicts more (22.3 vs 17.7 per run):

  • Refuted: KV pressure. Resident tokens at eviction were 2% lower under FIFO (62,035 vs 63,219).
  • Confirmed: oscillation. FIFO breaches capacity more often (21.0 vs 15.3 per run), but each breach is smaller (1.06 vs 1.15 evictions).[10]
  • No concentration. Max per program is 2.7 vs 3.3; Gini is 0.770 vs 0.847.[11]

8. Intervention B, fatigue-aware eviction

Penalize a program in the eviction ranking by how often it has already been evicted. beta=0 is exact upstream; beta=1 applies the penalty.

  • Max evictions on one program: 3.0 → 1.0
  • Gini: 0.84 → 0.75
  • Throughput: +0.2% ± 1.1%, consistent with zero
  • Control diverged from upstream zero times across three seeds
Note, the limitThis redistributes evictions; it does not reduce them. At 60 programs, p95 moved the wrong way by 3.8%. Worst single-step latency improved by 1.9% and 3.2%. Read it as worst-case protection, not a speedup.[12]

9. Limits

  • Source facts, true at any scale: eviction is smallest-first, admission is smallest-first, and there is no RL-group concept.
  • Theory-backed: the direction of the FIFO result.
  • Scale-dependent: every number in seconds. One L4, a 0.6B model, a synthetic workload, three seeds.
  • Not yet public: the router patches (churn instrumentation and the ADMIT_ORDER switch).
  • Full caveats are in the README.[13]

Next I want a multi-backend replication, since oscillation near a capacity limit changes character when the limit is per-backend. The arm comparison is the part to rerun first.

Get in touch - saranshappy@gmail.comEvery number links to the script that produced it, and raw logs are in the study repo. Corrections and replications welcome, especially on multi-backend hardware. Open an issue on the repo.

References

  1. ThunderAgent, _resume_paused_programs ascending sort. github.com/ThunderAgent-org/ThunderAgent/blob/7ddc861/ThunderAgent/scheduler/router.py#L846
  2. NVIDIA Dynamo, ThunderAgent program scheduler user guide. docs.nvidia.com/dynamo/dev/user-guides/agents/thunder-agent-program-scheduler
  3. Exact eviction decisions, 40 of 40. analysis/exact_decisions.py#L99-L108
  4. Exposure control, Spearman and permutation tests. analysis/exposure_control.py
  5. Within-band harm estimate. analysis/harm_analysis.py
  6. Admission wait vs execution time. analysis/separate_effects.py#L76-L85
  7. Group-level eviction correlations. analysis/grpo_analysis.py
  8. Partial correlation and mediation. analysis/why_faster.py#L96-L103
  9. Admission-order arm comparison. analysis/compare_admission.py
  10. Capacity breaches and evictions per breach. analysis/burst_check.py#L37-L46
  11. Concentration checks, max per program and Gini. analysis/why_more_evictions.py
  12. Fatigue-aware eviction sweep. analysis/sweep_compare.py
  13. Study README, full caveat list. README caveats