SGLang v0.5.21 Lets Prefill-Decode Instances Switch Roles Without Restart, Moves Its Prefix Cache to a Rust Core and Lists Ten Upgrade Notes
SGLang v0.5.21 lets PD instances switch between prefill and decode without a restart, makes a Rust prefix-cache core the default, and removes deprecated endpoints.
Editor's Note ·
- Clarification:
- The article describes runtime prefill-decode role switching without qualification. The description of pull request #28403 says the feature is gated behind the --enable-pd-role-switch flag (default off), "lands as a first PoC on the mori transfer backend", and was validated with pure-TP MoE configurations; only the mori backend's teardown and rebuild hooks are noted as implemented there. Support in other configurations should not be assumed.
Overview
The SGLang project has published v0.5.21 of its LLM and diffusion-model serving framework. According to the v0.5.21 release notes, the release contains 779 PRs from 227 contributors. Its headline items are that prefill-decode (PD) instances “can switch between prefill and decode on the fly, no restart needed” and that the prefix cache now runs on a Rust core by default.
What Changed
The release notes list the following key features:
- Runtime PD role switching. The notes credit the change to pull request #28403 and describe it under Parallelism & Disaggregation as “Introduce runtime role switching between prefill and decode.” According to the pull request description, SGLang’s PD disaggregation previously “pins each instance’s role (
prefill/decode) at startup”, and the change lets an operator or router convert an instance live “without restarting the server or reloading weights.” - Rust prefix cache. The prefix cache now runs on a Rust core by default (#39627); that pull request describes its aim as to “Use Rust as the default unified tree core and resolve unsupported configurations to Python in one central place.” The notes say configurations the Rust core does not support fall back to Python automatically, and that setting
SGLANG_UNIFIED_RADIX_TREE_CORE_BACKEND=pythonforces the Python core everywhere. - Decisions API. A new
/v1/decisionsendpoint “turns an LLM / VLM into a low-latency classifier and scorer.” - Score API. A
/v1/scoreendpoint scores all candidates in one request. - Model-specific gains. The notes report 22% faster first token on long prompts for DeepSeek-V4.1 (#40352) and 20.6% higher prefill throughput in PD serving for Kimi K3 (#40045). GLM-5.3-Flash now runs on AMD MI355X, with FP8 / MXFP4 MoE and MTP speculative decoding.
The release also adds support for new models. The notes name DeepSeek-V4.1 Flash, GigaChat 3.5, IQuest-Q1, MiMo-V2.6 / MiMo-V2.6-Pro and Ling-3.0-flash-VL among the language and vision-language models, and DiffusionGemma, Qwen-Image 2.1, Anima Base v1.0, Ming-Image 0.1 Design / Design-Layer and FLUX 3 Action among the diffusion models.
Breaking Changes and Upgrade Notes
The release notes include a “Breaking Changes & Upgrade Notes” section with ten entries. Several change default behavior:
- FlashInfer MoE fused finalize is off by default for numerical accuracy. The notes say this “costs some W4A4 MoE latency” and that
SGLANG_FLASHINFER_MOE_FUSED_FINALIZE=1restores it. - PD decode now defers KV release on abort by default on the Mooncake and NIXL backends, holding pages until every prefill rank acknowledges, with a 30 s timeout. Setting
SGLANG_DISAGGREGATION_DEFERRED_DECODE_KV_RELEASE=Falserestores immediate release. - Request-supplied chat templates are rejected. A
chat_templatekey insidechat_template_kwargson/v1/chat/completionsor/v1/tokenizenow returns an error unless the server starts with--trust-request-chat-template.
Other entries remove or deprecate interfaces:
- Deprecated endpoints, environment variables and aliases are removed. The notes direct users to
/model_infoinstead of/get_weight_versionand/weight_version, and to/v1/loadsinstead of/get_load. They also list renamed flags, including--elastic-ep-rejoinbecoming--elastic-ep-join-mode recover. - Legacy radix cache implementations are removed. The experimental C++ radix tree is gone, and code importing SWARadixCache, MambaRadixCache or HiRadixCache must move to UnifiedRadixCache.
- A CustomLogitProcessor that returned a reduced shape such as (1, vocab) and relied on broadcasting now raises at decode time. The built-in processors are unaffected.
- RL weight updates must run between
begin_weight_update()andend_weight_update(). - Parallel-state getters are deprecated and are no longer re-exported from
sglang.srt.distributed. - Ascend A2 (910b) images are no longer published; release and nightly images ship for A3 and 950 (A5) only.
Upgrading
Per the release notes, the upgrade command is uv pip install --prerelease=allow sglang==0.5.21. Docker images are listed for NVIDIA (CUDA 13), AMD MI35x and MI30x, Intel GPU and Intel CPU.
What We Don’t Know
The release notes are the only source cited here. Performance figures such as the 22% and 20.6% gains are attributed to specific models and hardware configurations and may not carry over to other workloads. The notes also describe the Rust router and frontend as experimental, so the Rust component that ships by default in this release is the prefix cache core.