Deployment
Install SGLang
Install SGLang
For all methods and hardware platforms, see the official SGLang installation guide. The two paths below match the Python / Docker toggle in the command panel.Then run the Python output of the command panel below in that environment.
- Python (pip / uv)
- Docker
Command
nvidia/Kimi-K3-NVFP4, the Quantization row in the panel below), use the lmsysorg/sglang:dev-dev-kimi-k3-nvfp4 image.
PD Mode — Unified serves prefill and decode together. Prefill / Decode split them into dedicated pools (see PD disaggregation); Prefill ships two strategies, both chunked at 16k. On the 8-GPU platforms (B300 1×8, GB300 2×4), Default is TP8 and Long-Context is --pp-size 8 --tp-size 1. On the 16-GPU platforms (B200 2×8, GB200 4×4), both are --pp-size 16 --tp-size 1 and differ only in --mem-fraction-static (0.85 vs 0.90) — deep PP is the throughput shape there, not just the long-context one (see Deep PP).
Strategy — the operating point within that shape:
- Low-Latency — no DCP, so the MLA KV stays TP-replicated. For chat. B200 splits its two nodes into PP2 × TP8; every other platform is flat TP.
- Balanced — the accuracy-preserving default: PP2 × DCPEP8 on B200 (the two pipeline stages and DCP8 split KV and KDA state), TP16/DCP16 on GB200, TP8/DCP8 on B300/GB300, TP8 ROCm/AITER on MI35x.
- High-Throughput — the large-scale lane: pick a Cluster Size and Large-Scale Preset in the Playground (details). The cell itself is Balanced, except on H100 (plus
extra_buffer_lazy) and H200 (widens to 4×8 TP32/EP32 at--mem-fraction-static 0.90).
Long-Context appears only under the Prefill PD mode; for long-context unified serving on B200, start from High-Throughput and raise --context-length.
Spec Decode — layers onto the strategy without changing it, on every platform except B200. DSPARK proposes 7 draft tokens per step (tune in the Playground) and requires pp_size == 1, so on B200 it also drops the pipeline and re-lays the same 16 GPUs flat: PP2 × TP8 → TP16, PP2 × DCPEP8 → DCPEP16. DFLASH has no published draft checkpoint. The win is largest on short interactive traffic and fades as the prompt grows.
--mamba-full-memory-ratio is the one sizing flag, computed live: set your average request length in the Mamba ratio calculator; everything else follows the panels, and the result is pinned into the command.Mamba ratio calculator
How --mamba-full-memory-ratio is calculated
How --mamba-full-memory-ratio is calculated
--mamba-full-memory-ratio is the ratio between the KDA state pool and the MLA KV pool. Every parameter below except L is read live from the Deploy panel and Playground selection; the balanced value is the per-request cost ratio:S— KDA state slots per request:extra_buffer=5,extra_buffer_lazy=4,no_buffer=3, disabled radix cache=1.SGLANG_OPT_MAMBA_SKIP_DECODE_LOCKfrees one slot on the extra-buffer strategies; with the overlap scheduler off (orpp > 1, which disables it) the track buffer costs one slot instead of two.D— verify intermediate states under speculative decoding:0when disabled, otherwise DSPARK block size + 1 (8at the default 7). ReplaySSM (--enable-linear-replayssm-spec) folds them into a per-slot ring, returningDto0.state_bytes— one state slot’s bytes, from K3’s fixed geometry, the attention-TP width, and the SSM dtype.mla_kv_bytes— one token’s MLA latent KV bytes (KV-dtype dependent); DCP shards it across its ranks. The DSPARK draft model’s KV (~1.4 KB per token) is replicated on every rank, so it enters flat — negligible without DCP, the same order as the sharded MLA share under DCP8.L— average total request length in tokens: input + output.
Advanced Features Playground
The Playground is where you experiment with SGLang features beyond the deployment matrix. The Deploy panel above emits the recipes the SGLang team is converging on; the Playground lets you turn on additional knobs on top of whichever cell the Deploy panel is currently showing.1. Model Introduction
Kimi-K3 is Moonshot AI’s flagship hybrid MoE vision-language model: 2.8 trillion parameters, 16 of 896 experts active per token, roughly 2.5× the scaling efficiency of Kimi-K2. The backbone interleaves Kimi Delta Attention (KDA) with MLA across 93 layers (plus Attention Residuals and Stable LatentMoE); serving supports image input and a 1M-token window with prefix caching. Weights ship in MXFP4: the FlashInfer MXFP4 (trtllm-gen SiTU) runner serves them on Blackwell, Marlin (W4A16) elsewhere, MegaMoE for short-context batch throughput. K3 always runs with thinking enabled, with reasoning depth controlled byreasoning_effort (low / high / max; default max).
Kimi-K3 is Moonshot AI’s first open-source model in the trillion-plus class; full model weights
are scheduled to release by July 27, 2026. The recipes on this page were validated on the public
sgl-project/sglang kimi-k3 branch — the HuggingFace
repository (moonshotai/Kimi-K3) and a public lmsysorg/sglang image with K3 support will be
available at launch.Every cell in the Deploy panel above is currently marked Final Verification In Progress: the
recipe runs, but its serving round on the final weights and current code is still open. Re-measure
throughput and accuracy before you rely on any of them.temperature=1.0, top_p=0.95, presence_penalty=0, frequency_penalty=0 (fixed by the model; informational — do not hardcode in sample code).
Resources: HuggingFace · Kimi-K3 Quickstart.
2. Configuration Tips
Memory: two pools, one flag. K3 splits static memory into a worst-case-reserved KDA state pool (it sets the concurrency ceiling) and a paged MLA KV pool, divided by--mamba-full-memory-ratio. The command panel pins that flag to the calculator’s output — set your average request length there; every other calculator input follows the panels. After boot, read back max_total_num_tokens (the KV side) and the admitted-request cap (the state side).
Capacity levers, all in the Playground. Each trades precision or cache behavior for capacity — re-verify accuracy on your workload:
Speculation: DSPARK holds block size + 1 (= 8) intermediate states per request — the calculator folds this in — and an unset
--max-running-requests resets to 48 under spec (the command panel reminds you; set it explicitly to raise).
MoE runner. Leave --moe-runner-backend unset on Blackwell: FlashInfer MXFP4 (W4A8, official trtllm-gen SiTU kernels) is selected with the pinned FlashInfer 0.6.17 dependency; H100/H200 pin Marlin. The B200 Balanced and High-Throughput cells pin flashinfer_mxfp4 explicitly because that is the shape they were brought up on. The published Docker images install the matching official flashinfer-python, flashinfer-cubin, and flashinfer-jit-cache packages.
Attention backend. Leave all three attention knobs unset on Blackwell: K3 resolves prefill, decode, and — under DSPARK — verification as a set (trtllm_mla across the board; cutedsl_mla takes decode and verification under DCP). On the non-DCP recipes, setting any one of the three cancels the auto-resolution for the others. The B200 Balanced and High-Throughput cells pin --decode-attention-backend cutedsl_mla, which is what auto-resolution picks for those DCP recipes anyway — it is written out because it is the shape they were brought up on, not because it changes the resolution. H100/H200 pin flashmla for decode.
Context length. --context-length bounds the longest accepted request plus some context-scaled buffers; it does not size the KV pool. For long context the lever that adds capacity is fp8_e4m3 KV.
DSPARK. Adds --speculative-algorithm DSPARK plus the draft checkpoint on top of the showing strategy. Leave --speculative-draft-attention-backend unset. No serving round on the final draft checkpoint has landed — measure against the same recipe running NOSPEC before adopting.
Per-platform notes:
DCP notes — the DCP cells are Balanced and High-Throughput on every Blackwell platform, in both the
Unified and Decode roles:
- DCP is the only axis that shards the TP-replicated MLA KV; Low-Latency skips it.
- Leave
--dcp-comm-backendunset (fabric-resolved:fi_a2aon GB200/GB300,a2aon B200/B300). - No
--enable-symm-memunder DCP (force-disabled for decode-graph correctness). - Explicit
tokenspeed_mlaforce-rewrites--kv-cache-dtypeto fp8; the defaultcutedsl_mlaserves either dtype. - Calculator ratios run well above 1 here (
r > 1is legal):bfloat16state buys admission,fp8KV buys context. - Don’t use EP with an a2a backend: a2a buffers reclaim the KV that DCP buys. Compose only to measure. a2a backend is set when
--moe-a2a-backendis set.
3. Advanced Usage
3.1 Reasoning
K3 always thinks; thekimi_k3 reasoning parser (toggle Reasoning Parser in the Parsers card of the Playground above) separates that thinking from the final answer — thinking lands in message.reasoning_content, the answer in message.content. Control the reasoning depth with reasoning_effort (low / high / max; default max).
Reasoning Example (Python)
Reasoning Example (Python)
Example
Example Output
Example Output
Output
3.2 Tool Calling
Enable thekimi_k3 tool-call parser (toggle Tool Call Parser in the Parsers card of the Playground above) to surface structured tool calls via message.tool_calls. Because K3 is a thinking model, the follow-up turn may put text in reasoning_content as well as content — print both.
Tool Calling Example (Python)
Tool Calling Example (Python)
Example
Example Output
Example Output
Output
3.3 HiCache (Hierarchical KV Caching)
K3’s hybrid HiCache tiers the paged MLA KV and the KDA/mamba state across L1 (GPU) / L2 (host) / L3 (Mooncake) — enable it from the HiCache card in the Playground above for long multi-turn workloads.- On the DCP recipes (Blackwell Balanced / High-Throughput, in both the
UnifiedandDecoderoles), the host tiers are not fully DCP-aware yet: L3 always, and L1+L2 with Spec Decode on, drop the DCP flags (the command hints call it out — per-request KV capacity shrinks accordingly). L1+L2 with Spec Decode off keeps DCP. Only DCP goes: the MLA KV reverts to TP-replicated, but the cell’s other parallelism stays, so B300/GB300/GB200 land on plain TP while B200 Unified keeps its--pp-size 2/--ep-size. - Low-Latency and the Hopper recipes take all tiers unchanged.
3.4 PD Disaggregation
PD splits prefill and decode into separate server groups; because K3 is hybrid, the transfer moves both the paged MLA KV and the KDA recurrent state.- Transfer: the cells emit NiXL (RDMA); Mooncake stays selectable in the Playground.
- Ports: prefill
30000, decode30100(derived ZMQ/dist ranges must not collide on a shared host). The positional8998after--prefillmust match--disaggregation-bootstrap-port, or only the decode worker registers. - Decode state pool: chunk cache — one slot per request;
--mamba-radix-cache-strategyis inert. Keep--disaggregation-decode-extra-slotspinned: unpinned it defaults to twice the batch below 32 requests and zero above.
Deep PP for prefill
Deep PP is--tp-size 1 with one pipeline stage per GPU — --pp-size 8 on B300/GB300, --pp-size 16 on B200/GB200. Pipeline P2P overlaps the next microbatch’s compute, unlike TP/EP collectives, and each stage owns whole layers (a clean slice of KV and state). --tp-size 1 is also what buys context: above TP1 the MLA KV is replicated across the TP ranks, so TP2 × PP8 holds roughly half the tokens of TP1 × PP16 for the same memory.
- Use one stage per GPU; a shallow split still pays the in-stage all-reduce and can lose to flat TP.
- Pays only with several requests in flight. On the 8-GPU platforms that is why
Defaultstays TP8; on the 16-GPU platforms deep PP wins at the Default operating point too, so both strategies use it — measured on GB200 at ISL 8192 / concurrency 32, PP16 × TP1 reached 4550 prefill tok/s/GPU vs 3596 (PP8 × TP2), 2407 (TEP16), and 1652 (TP16). Below concurrency ~8 the pipeline cannot fill and TEP16 leads instead (1947 vs 1227) — use--tp-size 16 --ep-size 16there. - DSPARK off (
pp_size == 1required) — on B200/GB200 that applies toDefaultas well. - Fan one prefill role out to several decode roles; budget for in-transfer KV on the decode side.
Router
Router
Command
:8000) instead of an individual role server.
3.5 VLM Serving Profiles
The open-source K3 serving contract currently supports image input only — its processor rejects video and audio input.VLM feature transport
Use VLM Transport in the command picker.Auto is a topology-aware starting
point, not a claim that one configuration is fastest for every workload.
CUDA IPC and CUDA VMM reserve up to
SGLANG_MM_FEATURE_CACHE_MB (1 GiB by
default) on the base GPU and fall back to CPU per tensor when full. This setting
does not control EPD encoder output or PD KV/KDA transfer. K3 already defaults to
2 processor workers and 16 I/O workers; leave those flags unset unless tuning.
VLM compatibility
Should ViT BCG be enabled?
Keep ViT BCG off for general serving; enableSGLANG_VIT_ENABLE_CUDA_GRAPH=1 only for ViT-only / EPD encoder workloads with recurring image shapes and spare HBM.
- The win is confined to the encoder — no reliable end-to-end TTFT/TPOT gain in full-model serving.
- Each captured graph retains HBM (graph + per-entry metadata); measure on your own shapes.
- The default cache captures after two hits and falls back to eager above 6,144 tokens; do not enlarge it without measuring.
Low-HBM VLM
Use this profile when keeping HBM headroom matters more than peak concurrency. It removes the GPU feature pool, keeps ViT BCG disabled, halves the context window, caps concurrency, and lowers the static-memory target:Command
--mem-fraction-static 0.82 is a conservative B300 starting point, not a portable minimum: raise it toward 0.85 if startup reports insufficient memory; if HBM must go back to other workloads, reduce context/concurrency first. The precision levers (fp8_e4m3 KV, bfloat16 SSM state) save far more but stay accuracy-gated.
3.6 Large-Scale Serving Presets (16–64 GPUs, Blackwell)
The KDA state pool is the concurrency ceiling — DP, EP, and DCP do not shard it; only attention-TP width, SSM dtype, and cache strategy change the per-GPU bill. The MLA KV is cheap to shrink (fp8) or deduplicate (DCP). Two presets come out of this, atN = 8k GPUs:
- Radix cache is independent of the preset: for prefix-free traffic (offline batch, evals) switch it off (Playground’s Prefix Cache card) — one state slot per request instead of 4–5.
- The fully data-parallel extreme (
--dp-size= GPU count, attention-TP 1) — the shape behind the 64-GPU sweep’s ~3K tok/s per GPU — is not a preset: 288 GB GPUs only, radix forced off, no head-to-head against the preset shape.
--node-rank). On GB200/GB300 the same 32-GPU shape uses 8 nodes × 4, and the Playground emits --nnodes 8:
Command
--mamba-full-memory-ratio, which folds in DP, DCP, precision, and speculation:
For Peak Capacity, add
--dcp-size 8 and re-derive the pool split with the Mamba ratio calculator.
Both presets are one click away in the Playground above: pick a Cluster Size and a Large-Scale Preset and the full command composes onto whichever cell is showing.
Decisions the preset already makes:
- MegaMoE +
deep_gemm— the fused DeepGEMM all-to-all/MoE path used by these large-scale DP/EP throughput presets, with K3’s SiTU activation. - SP-MoE and shared-expert overlap engage automatically under EP a2a; the K3 all-reduce fusion does not.
- Spec Decode follows the Deploy knob. Acceptance thins at large batch; spec × EP × DP-attention is validated only at 8-GPU EP8 × DP2 (full GSM8K) — experimental at these scales.
No preset has a full serving round on final weights; the constants derive from measured single- and dual-node rounds plus a 64-GPU sweep. Validate throughput and accuracy on your workload before committing a fleet.
