← All AgentX optimizations

AgentX industry impact · Inference engine

SGLang

Working alongside SGLang maintainers from RadixArk, Meta, NVIDIA, and AMD, the AgentX initiative drove optimizations for agentic workloads that also improve production serving substantially.

output throughput at concurrency 384
+26.75%
mean TTFT from the same change
−36.25%
needles correct after the staging fix, from 2/128
128/128

Sliding-window allocation

SGLang’s sliding-window work addresses the same conflict as vLLM’s retention policy, but from the allocator side. Window pages and prefix pages are drawn from one pool, and the window is the greedier consumer: it turns over constantly while the prefix sits still, so under pressure the transient allocation displaces the durable one.

Three designs attack that from different angles. One proactively frees pages as they leave the window rather than waiting for eviction pressure to find them, so dead window state stops competing for pages it can no longer use. Another caps compute locks to a single window, bounding how much of the pool an in-flight request can hold pinned at once. A third removes stale full-KV entries that outlive their usefulness.

Alongside those, the ROCm ring-cache fix is a correctness change rather than a capacity change: a ring buffer reuses slots by construction, and reusing one whose old contents are still referenced yields wrong output rather than slow output. None of this is visible on a single 8k prompt, where the window never laps the prefix and the pool is never contended. On a multi-turn hybrid session, these changes decide whether the expensive full-attention history is still there on the next turn.

HiCache offload

HiCache is SGLang’s first-class in-tree offloading mechanism. It faced the same hybrid problem vLLM’s connectors did, and solved it with an asymmetry: offload the full-attention cache and reconstruct the short sliding-window tail on the way back. Only the expensive half is worth moving across the bus, and the cheap half can be rebuilt faster than it can be fetched. On AMD, staged write-back keeps that movement from blocking the engine while it happens.

Recurrent state was the remaining gap, because it cannot be rebuilt from neighbouring tokens the way a window tail can. FlashInfer GDN checkpoints let it participate in prefix reuse at all, and raised throughput from 47,771 to 53,004 tok/s/GPU at a 92.4% cache-hit rate.

Diagram showing three kinds of state crossing from GPU HBM to CPU DRAM: full-attention KV is offloaded byte for byte, the sliding-window tail is not moved and is rebuilt on load, and recurrent state is checkpointed.
HiCache’s asymmetry. Full-attention KV is large and not reconstructible, so it crosses the bus; the window tail is cheap to rebuild and stays behind; recurrent state is small but cannot be reconstructed, so it is checkpointed.View full-resolution image

What variable-length traffic does to a kernel pipeline

Like production traffic, AgentX sessions arrive at continuously varying context lengths. A naive runtime that specializes on length will compile a fresh kernel for nearly every request it sees. SGLang maintainers solved this by passing context length as a runtime scalar, collapsing that into one compilation, and improved AgentX output throughput at concurrency 384 by 26.75% and mean TTFT by 36.25% — by removing compilation, not by computing anything faster.

In the same spirit, removing a per-step device-to-host sequence-length synchronization eliminates a decode bubble that exists only because the host wanted to know a length the device already had.

Cache-aware data-parallel routing

When a request carries no reusable history, such as the start of a subagent, any worker will do and load balancing is the only question worth asking. When it carries a megabyte of cached prefix, sending it to an idle worker that does not hold that prefix is the expensive choice, and the router needs to know where the state already lives.

SGLang added DP cache affinity so a session is sticky to the rank holding its cache. The same work implements DP-aware prefill and decode routing so both halves of a disaggregated deployment make that decision consistently, and adds cache balance as a routing signal so affinity does not degenerate into one hot worker. A router can only act on what it is told, so hybrid cache events also became radix-cache aware and sliding-window aware.

Speculative decoding

Speculative decoding receives special attention, because MTP adds a second, smaller piece of per-request state that has to survive everything the main cache survives. SGLang fixed draft-window transfer in disaggregated serving so that state crosses the prefill-to-decode boundary intact, added overlap scheduling for high-concurrency online decoding, removed a no-op EAGLE renormalization, and avoided host synchronizations during EAGLE prefill.

The open resource-lease scheduling work and the data-parallel graph-metadata fix continue the same effort: making overlap safe when requests can be retracted and resumed rather than simply run to completion.

Prefix-aware staging in heterogeneous disaggregation

Heterogeneous prefill and decode topologies need prefix-aware staging, and this is where prefix caching and disaggregation interact badly. When the two sides are not sharded identically, KV cannot be copied across as one contiguous stream; it has to be split on a transfer grid and reassembled at the offsets the decode side expects. A prefix hit makes that harder, not easier, because the prefill worker now sends only the uncached remainder while the decode side still expects a complete, correctly positioned cache. Radix-cache support in the staging buffer splits cached sends on that grid and scatters them at the correct decode offsets.

The failure this fixes is a correctness failure. A 127,500-token shared-prefix test went from 2 correct needles out of 128 to 128 out of 128, meaning the cache had been silently landing in the wrong places — which a throughput benchmark would have scored as a fast, confident, wrong answer. The AgentX comparison additionally raised median per-user output throughput by 9.61% at nearly unchanged total throughput per GPU.

Open work continues along the same seam: multi-pool DeepSeek-V4 support in UMBP, unified-KV HiSparse state carried over MoRI, and preserving the prefill-owned token when decode terminates without visible content. The HiSparse work should be read as a capacity and correctness enabler for long contexts rather than as a throughput win at high concurrency, which it is not yet.

Before and after diagram of staging-buffer indexing: before, the uncached remainder lands on top of the prefix at the wrong rows; after, it is placed at the offsets after the prefix the decode side already holds.
Before, the staging index counts from zero and ignores what the decode side already holds, so the remainder overwrites the prefix. After radix-aware staging, cached sends are split on the transfer grid and scattered at the correct decode offsets.View full-resolution image

Other projects