Multi-agent serving faces a hard tradeoff: keeping an agent's long system-prompt KV resident speeds future calls but shrinks the batch. TOPAS scores post-decision GPU states $(R',Q')$ — jointly picking resident prefixes and admitted requests — by expected longest-remaining-path reduction plus one-hop reuse minus move/redo/revoke costs, cutting task JCT up to 39.8%/49.4%.
Under a shared KV budget, prefix residency and request admission are coupled but existing schedulers decide them separately. Two diagnostics isolate the failure. First, heterogeneous prefix co-residency shrinks the running batch: alternating between two agents' long prefixes divides KV capacity across both, halving mean batch size and inflating makespan 1.8–1.9× versus grouping (Table I). Second, the two natural fixes fail in complementary ways: locality-first (LPM) reactively keeps service pinned near the workflow entrance and starves downstream stages, while progress-first (SRPT) chases the shortest remaining work and thrashes prefixes with repeated setup costs. Formally, the objective is to minimize average task-level JCT:
$$C(J_i) = \max_{v \in V} C_{i,v}, \qquad \mathrm{JCT}(J_i) = C(J_i) - \tau_i,$$
subject to the joint prefix–request KV constraint $\sum_{a \in R'} \ell_a + \sum_{r \in Q'} d_r(t) \leq B_t$, where static prefix cost $\ell_a$ is paid once per agent (the reuse benefit) and $d_r(t)$ is each request's dynamic footprint.
TOPAS treats prefix residency as an explicit workflow-level decision, jointly optimized with admission rather than left as a byproduct of request ordering and cache eviction. At each scheduling event it constructs candidate post-decision states $S'=(R',Q')$ and commits the arg-max of a transition Score (Eq. 13) combining: (i) age-weighted expected reduction in each task's longest remaining LLM-service path, (ii) a one-hop reuse bonus for prefixes about to serve soon-ready downstream stages, minus (iii) prefix-movement, redo (re-decode), and revoke (credit-clawback) costs. A hierarchical search (GREEDYPACK for request allocation + prefix-set enumeration/bounded greedy) makes the combinatorial joint decision tractable.
核心技术壁垒: the load-bearing insight is valuing an admitted request not by its own service time but by the expected reduction of its task's longest remaining service path, with the expectation placed outside the longest-path operator $\mathbb{E}_{Z_i(H,t)}[\mathrm{LP}(G, Z_i(H,t))]$ (Eq. 5). This lets the DAG critical path change across residual realizations rather than being fixed by mean stage durations, so non-bottleneck-branch work correctly scores zero progress. Reproducing TOPAS's numbers hinges on computing this path-marginal — not the modular scoring skeleton — correctly under empirical ReAct residual distributions.
Implemented in SGLang v0.5.3 on one A100-80GB with Qwen2.5-32B-Instruct. Against the best baseline per workload and metric: synthetic DAGs cut mean/p99 JCT by 27.5%/31.7% (Chain-3), 39.8%/49.4% (DAG-4), 27.7%/30.8% (DAG-10-Wide); MetaGPT-SOP mean −9.8% (p99 −4.5%); MetaGPT-TL mean/p99 −22.0%/−26.6%. Scheduling overhead is 1.9 ms/decision, 0.31% of wall time. Ablation: the full policy beats TOPAS-base by 60.5%/53.6% mean/p99 on MetaGPT-TL.
TOPAS's mechanism is best seen in the motivating Gantt chart, which shows why neither pure policy is sufficient on an A→B→C chain when GPU memory holds only one prefix at a time.

Paper's Figure 2 (caption: "A Gantt chart comparing LPM and SRPT on an A →B →C workflow. GPU memory can hold the KV cache for only one Agent prefix at a time; each request takes four time units, and each prefix setup takes one time unit.").
Each request is 4 time units and each prefix setup is 1. SRPT pushes one task to the exit but pays a setup on every stage transition (mean JCT 21.5); LPM batches same-prefix requests to amortize setup but holds service upstream and delays completion (mean JCT 24). Notably the toy favors SRPT on mean JCT — the paper's point is not that SRPT is uniformly worse but that both extremes leave value on the table, which motivates scoring both progress and reuse in one decision.
The mechanism generalizes into a per-event pipeline: enumerate/greedily grow a resident-prefix set $R'$, pack compatible requests $Q'$ under the KV budget, score the transition, and commit the best feasible state.
TOPAS has no formal convergence/optimality theorem — it is a heuristic online policy. Its rigor lives in the utility construction, which I verify against the 6 minimum checks plus the algorithm-specific asks below.
Notation table
| Symbol | Meaning |
|---|---|
| $S_t=(R_t,Q_t)$ | GPU state: resident prefixes $R_t$, running requests $Q_t$ |
| $S'=(R',Q')$ | candidate post-decision state; $A=Q'\setminus Q_t$ admitted, $P=Q_t\setminus Q'$ preempted |
| $\ell_a,\ d_r(t),\ B_t$ | prefix length of agent $a$; request $r$ dynamic footprint; KV budget |
| $X_{i,v}\!\sim\!F_{a(v),v}$ | total LLM service of stage $v$ in task $J_i$ (empirical dist.) |
| $Z_{i,v}(t)$ | residual service of a started-but-unfinished stage |
| $\hat{L}_i(H,t)$ | expected longest remaining service path after hypothetical completions $H$ |
| $\Delta_{\text{task}}(r\mid H,t)$ | marginal progress from completing $r$ |
| $g_i(t),\ V_{\text{reuse}}$ | age multiplier; one-hop reuse value |
方程物理意义 (loss/utility decomposition) — the maximized Score is a sum of four physically distinct terms, all in seconds:
$$\mathrm{Score}(S' \mid S_t) = J^{\text{age}}_{\text{admit}} - J_{\text{move}} - J_{\text{redo}} - J_{\text{revoke}} + V_{\text{reuse}}.$$
6 minimum checks
Algorithm-specific structure (objective, residual model, complexity, proof sketch)
Diagnostic 1 (Table I) — the empirical anchor for the whole motivation. GROUPED (serve one agent's requests together) vs ALTERNATING (A,B,A,B…) under FCFS, same requests and KV budget:
| Load | Makespan (s) G/A | Mean batch G/A | Peak batch G/A |
|---|---|---|---|
| $n=100$ | 1145.5 / 2086.0 | 9.3 / 4.7 | 15 / 8 |
| $n=150$ | 1639.3 / 3104.4 | 10.0 / 4.8 | 16 / 8 |
| $n=200$ | 2143.5 / 4079.1 | 11.5 / 5.0 | 16 / 7 |
Grouping roughly doubles mean batch size and nearly halves makespan — a resident prefix supports a bigger batch, whereas two co-resident long prefixes starve dynamic/decode KV.

Paper's Figure 1 (caption: "Chain-3 at 0.15 task/s under locality-first LPM, progress-first SRPT, and downstream gating.").
Across the four panels (mean JCT, p99 JCT, first-task completion, throughput), the coarse downstream-gated "Strawman" beats both pure LPM and pure SRPT on mean JCT — direct evidence that active residency control, not either extreme, is what pays off.

Paper's Figure 3 (caption: "End-to-end task completion on the synthetic DAG workloads.").
Six panels sweep arrival rate for Chain-3 / DAG-4 / DAG-10-Wide (mean and p99). TOPAS (the load-bearing result) sits below all six baselines — FCFS, Autellix-LAS, LPM, SPF/SRPT, Parrot-FCFS — with the largest margin on DAG-4 (fork/join), where prefix-state pressure is highest and explicit residency control has the most room.

Paper's Figure 4 (caption: "Task completion on the MetaGPT workloads; high-load Autellix-LAS values exceed the displayed MetaGPT-TL range.").
On real MetaGPT prompts, gains are workload-topology dependent: SOP (one-pass five-role pipeline) yields only −9.8% mean, and TOPAS is not best on SOP p99 (LPM wins) or throughput (Autellix-LAS wins) — an honestly reported loss. TL (recurrent TeamLeader central prefix) yields −22.0%/−26.6%, because repeatedly returning to a central agent creates more residency-control opportunities.

Paper's Figure 5 (caption: "MetaGPT-TL component ablation at 0.0175 task/s.").
Four bars (TOPAS-base, w/o reuse, w/o aging, full) show the full policy beats base by 60.5%/53.6% mean/p99, and each single-component variant still trails the full policy by 44.2–51.0%. Both the reuse lookahead (IV-C) and aging (IV-D) carry weight — surprisingly large for components described as add-ons.
| Step | Claim | Paper-internal support | ||
|---|---|---|---|---|
| 1 | Under a shared KV budget, heterogeneous prefix co-residency shrinks the running batch and inflates makespan 1.8–1.9×. | Table I (Diagnostic 1): GROUPED mean batch ≈2× ALTERNATING. | ||
| 2 | Therefore a reactive locality-first policy (LPM) that just chases resident prefixes stalls downstream stages; a progress-first policy (SRPT) that chases shortest remaining work thrashes prefixes. | Fig. 1 (Strawman beats both on mean JCT); Fig. 2 Gantt (setup cost per SRPT transition; LPM holds upstream). | ||
| 3 | Hence prefix residency must be an explicit, jointly-scheduled decision; formalize state $S'=(R',Q')$ and score it by expected longest-remaining-path reduction (Eq. 5–6) plus reuse (Eq. 11) minus transition costs (Eq. 8–10). | §III constraint (Eq. 2) + §IV Score (Eq. 13); GREEDYPACK + $O( | A_t | ^2)$ search keep it feasible and cheap. |
| 4 | The resulting event-level arg-max policy (Eq. 14) reduces task-level JCT over the best per-metric baseline, most on high-residency-pressure topologies. | Fig. 3 (−39.8%/−49.4% on DAG-4), Fig. 4 (−22.0%/−26.6% on MetaGPT-TL). | ||
| 5 | Both non-base components are necessary, not decorative. | Fig. 5 ablation: full vs base −60.5%/−53.6%; each single-component variant trails by 44.2–51.0%. |
Implemented as a scheduling module in SGLang v0.5.3 (§V-A); the paper does not release a public repository, so exact source lines are [实现未公开]. The design binds tightly to SGLang mechanisms that a re-implementer must respect:
关键实现细节 (easy-to-miss tricks):