TECHNOLOGY

SGLang Unified Memory: retaining prefixes with allocation-aware eviction

In this article
THE QUICK TAKE

Counting shared reclaimable capacity can preserve prefixes under large allocations, but the experiment does not establish a general throughput improvement.

In an SGLang team experiment, changing the memory-reclamation stopping rule retained almost twice as many cached prefixes after a large request. On an RTX 5090, retained prefixes increased from 10 to 19 out of 28, while total time for returning requests fell from 4.105 to 2.548 seconds. This is a developer result on a deliberately constructed workload, rather than universal model acceleration. Source: SGLang.

Both experimental variants already enabled Unified Memory. The change concerned the rule determining when to stop cache eviction. The official SGLang blog index dates the article to October 22, 2026. No independent reproduction or original test logs were identified among the reviewed materials. Source: SGLang.

Why share memory

During request serving, a language model retains intermediate data to avoid recomputing shared prefixes. Attention layers use keys and values, the KV cache. Hybrid models may also need recurrent states, compact representations of the sequence processed by other layers. When requests repeat a system instruction or conversation opening, the saved prefix permits reuse of earlier computation.

Both types compete for limited GPU memory alongside model weights and other working buffers. NVIDIA specifies 32 GB GDDR7 for the GeForce RTX 5090, for example. That is the card’s total memory capacity, rather than an amount guaranteed to be available for cache. See the NVIDIA specification.

SGLang Unified Memory places cache types in a shared GPU buffer so they can occupy space as needed. In this context, the name does not mean offloading cache to CPU memory. The project describes regions growing towards each other; blocks can move to compact data, while virtual identifiers map to physical positions and preserve references. Movement must respect outstanding GPU or network operations still using the data. Flexibility comes with address-translation and copying costs; the authors also describe backend compatibility and K/V head-size restrictions. Source: SGLang.

When eviction should stop

When space runs short, the server removes evictable entries to satisfy a new allocation. Counting reclaimed capacity only in one pool’s units can be misleading: removing a prefix can also free another kind of state, returning additional space to the shared allocator. Counting only the original data type can therefore delete more prefixes than necessary.

Allocation-aware eviction checks after each step whether the shared allocator can satisfy the pending allocation, including capacity it can recover. Once it can, eviction stops. Retained entries may then benefit returning requests. This changes memory-management policy; it does not itself make a generation kernel faster. Source: SGLang.

What the RTX 5090 experiment measured

The developers used Qwen3.5-4B and Triton. They first cached 28 distinct prefixes of approximately 390 tokens each, then sent an unrelated 7 000-token request to create memory pressure, and finally replayed all 28 prefixes. The earlier rule retained 10 prefixes, and the new rule retained 19. Across six runs, median total time for returning requests fell by 37.9%, from 4.105 to 2.548 seconds. This measures completion of the returning-request set, rather than time to first token, token interval or p99. See the SGLang method and results.

Workload shape matters. Splitting the pressure request into four 2 048-token chunks caused both policies to retain 17 prefixes, eliminating that advantage. The authors found no stable overall throughput improvement: across five models, median time between output tokens ranged from 0.81% faster to 1.32% slower. The result is best understood as retaining useful cache under a large allocation, rather than a promise of the same speedup on every server. Source: SGLang.

Practical relevance and a stability caveat

The idea is particularly relevant when serving hybrid models in constrained GPU memory with recurring prefixes interspersed among large requests. A local comparison needs the same model, server version and request stream, alongside cache hits, latency and errors. Prefill chunk sizes matter: changing them removed the prefix-retention difference in the published experiment.

A separate bug report demonstrates why stability also needs testing. In issue #42653, opened October 5, 2026, a user describes another configuration: SGLang v0.5.21, openai/gpt-oss-20b with hybrid sliding-window attention, and an RTX 4090 with 24 GB. According to that report, replaying 1 437 mixed requests with --enable-unified-memory killed the scheduler and caused 212 requests to fail. Without the flag, the same stream finished without errors. The stream included cancellations, streaming generation and cache-reset operations. The reporter also reproduced the failure on an A100.

Discussion proposed that deferred compaction might count physical holes as available when pending movement prevents allocation. This is a participant’s hypothesis, rather than a confirmed root cause. The issue concerns another model, GPU and workload, so it does not invalidate the RTX 5090 experiment. It demonstrates why that experiment cannot be generalized to arbitrary deployments. These sources do not establish widespread adoption. See the issue discussion.

Sources

Further reading: choosing LRU, LFU and SLRU and SGLang’s static memory budget.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles