Deployment
Install SGLang
Install SGLang
For all methods and hardware platforms, see the official SGLang installation guide. The Python and Docker tabs match the toggle in the command panel; Zhenwu PPU runs the Python command inside the SAIL container.
- Python (source)
- Docker
- PPU (M890 / 810E)
Qwen4 support is not in an SGLang release yet. Install from the pull-request branch:Then run the Python output of the command panel below in that environment.
Command
RadixArk/Qwen4-35B-A3B-Dflash2). With NVFP4, the RTX PRO 6000 recipes keep all weights on the GPU, and the desktop RTX 5090 recipes keep all experts on the GPU while offloading only the PLE table to host RAM.
For a system with 16 GB of VRAM and 64 GB of host RAM, see the experimental paged experts recipe.
Playground
The Deploy panel shows the verification status of the selected recipe. Use the Playground to try additional SGLang features with that configuration.1. Model Introduction
Qwen4-35B-A3B is a model from Qwen4, the next generation of the Qwen model family. It continues the hybrid architecture line previewed by Qwen3.8-Flash-Next: Gated DeltaNet (GDN) linear attention interleaved with full attention using Qwen Sparse Attention (QSA), hyper-connections, n-gram embeddings, and in-checkpoint multi-token prediction (MTP) layers.| Variant | Total / active params | Architecture |
|---|---|---|
| Qwen4-35B-A3B | 35B / ~3B | MoE, 256 routed experts (top-8) plus a shared expert |
| Qwen4-35B-A3B-FP8 | 35B / ~3B | FP8 checkpoint of Qwen4-35B-A3B |
| RadixArk/Qwen4-35B-A3B-NVFP4 | 35B / ~3B | NVFP4 checkpoint of Qwen4-35B-A3B (NVFP4 routed experts + FP8 PLE) |
--context-length lower to cap it when your workload does not need the full window.
License: Apache 2.0.
Supported platforms: NVIDIA H200, B200, B300, and GB300; AMD MI350X and MI355X; Zhenwu PPU M890 and 810E; and the local devices DGX Spark, RTX PRO 6000, and RTX 5090.
Recommended generation: follow the sampling defaults in the checkpoint’s generation_config.json; leave sampling unset in requests to inherit them.
Resources: HuggingFace — BF16, FP8, NVFP4, DFlash2 draft.
2. Configuration Tips
2.1 BF16 and FP8 on NVIDIA H200 / B200 / B300 / GB300 / RTX PRO 6000
- QSA indexer.
--qsa-indexer-dtype fp8_e4m3stores the compressed QSA indexer cache in FP8 and scores blocks with FP8 GEMMs. It requires CUDA SM90, SM100, or SM12x; the main KV cache is unaffected. - GDN backends.
--linear-attn-prefill-backend flashinferand--linear-attn-decode-backend flashinferrun the Gated DeltaNet layers on FlashInfer;--mamba-ssm-dtype bfloat16keeps the recurrent state in BF16. - Speculative decoding. MTP uses the in-checkpoint MTP head through
--speculative-algorithm NEXTN(3 steps / top-k 1 / 4 draft tokens); DFlash2 usesRadixArk/Qwen4-35B-A3B-Dflash2(block_size=8,--speculative-draft-kv-cache-dtype bf16,--speculative-use-block-verification); None runs without speculative decoding.
2.2 NVIDIA DGX Spark (GB10)
- Unified memory sizing. DGX Spark shares a single 128 GB unified memory pool between GPU allocations and the offloaded n-gram PLE table.
- BF16 (~106 GiB total weights including the ~38 GiB PLE table) adds
--ple-offload-backend fileto map the sparse PLE table from local NVMe (with an 8 GiB resident-set cap) alongside--mem-fraction-static 0.70. - FP8 (~56 GiB total weights including the ~19 GiB PLE table) keeps PLE in unified memory with
--mem-fraction-static 0.60for None / MTP and--mem-fraction-static 0.65for DFlash2 (leaving ~29 GiB free RAM headroom). - NVFP4 (~44 GiB total weights including the ~19 GiB PLE table) passes
--no-ple-offload-embeddingto keep PLE directly in GPU memory alongside--mem-fraction-static 0.65across None, MTP, and DFlash2 (~27–31 GiB free RAM headroom).
- BF16 (~106 GiB total weights including the ~38 GiB PLE table) adds
- Same QSA / GDN / speculative stack. All quantizations use
--qsa-indexer-dtype fp8_e4m3, FlashInfer GDN prefill/decode with--mamba-ssm-dtype bfloat16, optional NEXTN3/1/4MTP, and (for FP8 and NVFP4) optional DFlash2 (block_size=8,--speculative-draft-kv-cache-dtype bf16,--speculative-use-block-verification).
2.3 AMD MI350X / MI355X
- AITER stack. The recipe sets
SGLANG_USE_AITER=1,SGLANG_USE_AITER_UNIFIED_ATTN=1,AITER_FLYDSL_FORCE=1, andAITER_ONLINE_TUNE=0, plus--attention-backend aiterand--linear-attn-verify-backend aiter, so both the full-attention and GDN verify paths run on AITER.SGLANG_MAMBA_SSM_DTYPE=bfloat16keeps the GDN recurrent state in BF16. - Tuned MoE / FlyDSL tables. If you have a tuned AITER fused-MoE table and a precompiled FlyDSL cache for this checkpoint’s BF16 MoE shape, point
AITER_CONFIG_FMOEandFLYDSL_RUNTIME_CACHE_DIRat them. Without them, AITER falls back to its online defaults, which can pick slightly different MoE GEMM kernels. - Serving limits. The recipe sets
--max-running-requests 32with a matching CUDA-graph decode batch of 32, disables the radix cache, and caps the context at 262,144 tokens. Drop--disable-radix-cacheif your workload reuses prefixes. - Working directory. A working directory that contains an
aiter/orsglang/checkout shadows the installed packages. Start the server from an empty directory such as/tmp. - Speculative decoding. The recipe ships with the MTP strategy only, using the in-checkpoint MTP head through
--speculative-algorithm EAGLE(3 steps / top-k 1 / 4 draft tokens).
2.4 Zhenwu PPU (M890 / 810E)
- Container & SAIL environment. Run inside
egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun-tmp/sglang:sail-qwen4-35b-a3b-ppu2.2.1on a host with a prepared SAIL environment. Both M890 and 810E share the same single-device (--tp-size 1) launch command forQwen/Qwen4-35B-A3B(BF16) andQwen/Qwen4-35B-A3B-FP8(FP8, currently unverified). - Runtime environment & backends.
SGLANG_JIT_DEEPGEMM_PRECOMPILE=0andSGLANG_SAIL_PLA_CUDA=1configure the SAIL runtime;--attention-backend fa3selects the attention backend and--reasoning-parser autoenables reasoning parsing. - Speculative decoding. The recipe ships with the MTP strategy only, using the in-checkpoint MTP head through
--speculative-algorithm NEXTN(3 steps / top-k 1 / 4 draft tokens). - Accuracy. Verified on
Qwen/Qwen4-35B-A3B(BF16) with GSM8K 5-shot at temperature 0: 96.51% on both M890 and 810E.
2.5 NVFP4 and DFlash2 on RTX PRO 6000
On a 96 GB RTX PRO 6000 Blackwell, keep all NVFP4 experts and the FP8 PLE embedding table on the GPU (--no-ple-offload-embedding, --mem-fraction-static 0.85, --chunked-prefill-size 8192). All three NVFP4 strategies (None, MTP, and DFlash2) and FP8 + DFlash2 use FlashInfer GDN (--linear-attn-prefill-backend flashinfer, --linear-attn-decode-backend flashinfer), --qsa-indexer-dtype fp8_e4m3, radix cache enabled, and full decode CUDA graphs; both DFlash2 cells enable --speculative-use-block-verification.
On SM12x, SGLang auto-selects Marlin for ModelOpt NVFP4 routed experts (NVFP4 weights, BF16 activations), which delivers the highest single-request and DFlash2 decode throughput (320.3 tok/s at temp=0.6 c=1, 1,167.8 tok/s at c=8, and 1,757.2 tok/s at c=32 on ShareGPT with NVFP4 + DFlash2). For long-prompt TTFT (-9 to 10% at 8K input) or high-concurrency NEXTN (c=32), you can pass --moe-runner-backend flashinfer_cutlass to run W4A4 NVFP4 activations as well as weights.
2.6 NVFP4 on RTX 5090 (32 GB)
RTX 5090 (32 GB) serves the NVFP4 checkpoint (RadixArk/Qwen4-35B-A3B-NVFP4) across None, MTP, and DFlash2 (BF16 and FP8 weights do not fit in 32 GB VRAM and are disabled). All routed experts stay on the GPU while only the FP8 PLE embedding table is offloaded to host RAM (--ple-offload-embedding, ~25 GiB host RAM required; allow extra host RAM for startup and the OS).
- None and DFlash2 (with
--speculative-use-block-verification) run with--mem-fraction-static 0.90,--max-total-tokens 32768, and radix cache enabled (~27.9–29.6 GiBVRAM). - MTP with FlashInfer GDN + NEXTN
3/1/4peaks at~28.8 GiBVRAM and sets--mem-fraction-static 0.93 --disable-radix-cache --max-total-tokens 16384 --max-running-requests 4 --cuda-graph-max-bs-decode 4.
2.7 NVFP4 throughput with 8K input and 1K output
Each row below uses the NVFP4 checkpoint on one GPU with Triton attention/GDN backends (c=1, NEXTN 3/1/4). After one full-length warmup, each configuration served the same ten synthetic prompts one at a time. The SGLang benchmark used --dataset-name random-ids --tokenize-prompt --random-input-len 8192 --random-output-len 1024 --random-range-ratio 1 --num-prompts 10 --max-concurrency 1 --seed 42. Each timed request used 8,192 input tokens and generated 1,024 output tokens. On the PRO 6000, the measured command also ran its default 32-output-token warmup before timing.
| GPU | PLE placement | End-to-end output (tok/s) | Accept length (tokens/step) | Median decode (tok/s) | Median TTFT (s) | Peak VRAM (GiB) |
|---|---|---|---|---|---|---|
| RTX PRO 6000 (96 GB) | GPU | 204.17 | 3.49 | 400.91 | 2.096 | 46.89 |
| RTX PRO 6000 (96 GB) | Host RAM | 199.75 | 3.37 | 381.53 | 2.094 | 27.86 |
| Desktop RTX 5090 (32 GB) | Host RAM | 248.74 | 3.30 | — | 1.381 | 27.72 |
Accept length field, the average number of output tokens advanced per speculative verification step, including the target token. It uses the server’s cumulative reported counters, which can include warmup. The RTX 5090 benchmark also reported a median time per output token of 2.25 ms. The synthetic prompts often produced repetitive output, which can affect speculative decoding speed.
2.8 Paged experts on a 16 GB GPU (Experimental)
In the Local Devices row, select 16 GB GPU (Experimental) to get the NVFP4 MTP command. The target is one NVIDIA GPU with 16 GB of VRAM and a system with 64 GB of host RAM. The FP8 QSA indexer in this command requires CUDA SM90, SM100, or SM120. The installation also needs Marlin for NVFP4 experts and FlashInfer for GDN prefill and decode. Validation on a physical 16 GB GPU is pending. The command keeps 30 of 256 routed experts per layer on the GPU. The backing store for the experts has a 24 GiB host RAM budget. The PLE embedding, the rest of the server, and the OS also use host RAM. One request can use up to 16,384 tokens of KV cache. NEXTN3/1/4 can route four verification positions to as many as 32 distinct experts per layer. Disabling the decode CUDA graph lets SGLang load them in multiple passes through the 30 GPU slots.
Preliminary performance. On one 96 GB RTX PRO 6000, an earlier NVFP4 checkpoint with the same 30 resident experts reached 101.62 tok/s median decode after the first output chunk. Three warmed requests each used 17–18 input tokens and generated 160 tokens. GPU memory peaked at 11.86 GiB during those requests, and the server process tree used 43.53 GiB of host RAM after warmup (proportional set size). This run used one NEXTN step (1/1/2), a BF16 QSA indexer, and Triton GDN.
3. Advanced Usage
The
model argument in the examples below is the BF16 repo id. Each precision is a separate repo, so model has to be the checkpoint the server was actually launched with (for example Qwen/Qwen4-35B-A3B-FP8). The Deploy panel’s cURL snippet always shows the right id for the cell you have selected.3.1 Reasoning
Qwen4-35B-A3B thinks by default (reasoning_effort=high, preserve_thinking on). Launch with --trust-remote-code and --reasoning-parser qwen4 (toggle Reasoning Parser in the Parsers card of the Playground above) to separate thinking into reasoning_content; --reasoning-parser auto resolves to the same parser for Qwen4 checkpoints.
Why qwen4 and not qwen3 / qwen3-thinking. Qwen4-35B-A3B needs its own parser:
</think>is a special token in Qwen4’s tokenizer. Theqwen4parser keeps special tokens in the decoded output (skip_special_tokens=Falseis applied for you), so the end of the thinking block is never stripped before parsing.- The generation prompt already opens the thinking block, so the output never opens one itself. The model may also judge a task simple enough to skip thinking and emit
</think>right away; the answer then lands incontentandreasoning_contentis empty. - Only
</think>ends the thinking. A literal<tool_call>or<think>written inside the reasoning stays reasoning text instead of closing it early.
reasoning_effort field, or with "chat_template_kwargs": {"reasoning_effort": ...}. Qwen4-35B-A3B defines four levels, and the OpenAI-compatible tiers are mapped onto them:
| Qwen4 level | Meaning | Also accepted as |
|---|---|---|
xhigh | Complex tasks where quality matters most | max, ultra |
high | Common tasks (default) | medium |
low | Fast responses with minimal thinking | minimal |
off | Thinking disabled | none |
reasoning_effort="off", "chat_template_kwargs": {"enable_thinking": false}, or "thinking": {"type": "disabled"}. Use one of them per request. If a request does combine them, the inputs are resolved rather than ranked: a top-level thinking only fills chat_template_kwargs.enable_thinking when the request did not set it there (so "thinking": {"type": "disabled"} does not override an explicit enable_thinking: true), and server defaults from --default-chat-template-kwargs only fill what the request leaves unset. The resolved enable_thinking is then checked against a reasoning_effort given in chat_template_kwargs, and a contradictory pair — one that resolves to enable_thinking: false with reasoning_effort: "high", for example — is rejected with an error, whether both were written there or the toggle was filled from a top-level field. With no effort in chat_template_kwargs, a resolved enable_thinking: false turns thinking off even if a top-level reasoning_effort tier is also sent.
Preserving thinking across turns. preserve_thinking defaults to true, so the thinking of earlier assistant turns is carried forward in the prompt, which is what multi-turn agentic workloads want. Send the previous assistant turn back with its reasoning — reasoning_content on Chat Completions, thinking blocks on the Anthropic-compatible /v1/messages — and it is rendered as that turn’s thinking block. Set "chat_template_kwargs": {"preserve_thinking": false} to opt out of carrying historical thinking forward; SGLang passes the flag to the tokenizer unchanged.
Reasoning Example (Python)
Reasoning Example (Python)
Example
Example Output
Example Output
Output
Tokenizer. The checkpoint ships a native
Qwen4Tokenizer, loaded with --trust-remote-code, and it is the recommended path: prompts are built directly in token space, so control-token text typed inside a message (for example a literal <think>) stays ordinary text and can never become a control token. A conventional Jinja chat template is also provided under tokenizer-compat/ for backward compatibility only; it is intended to render the same text apart from a few documented exceptions (tool results are only reordered to match the call order when every result in a run is text-only and carries a matching tool_call_id; runs with media or missing/unknown ids keep their input order, and there is no fallback to a legacy id field), and even where the text matches, the resulting token ids can differ. See the tokenizer README in the model repository for details. When serving with that template, --reasoning-parser auto / qwen4 and --tool-call-parser auto / qwen4 still resolve to the Qwen4 parsers and keep </think> intact.3.2 Tool Calling
Launch with--tool-call-parser qwen4 alongside --reasoning-parser qwen4 and --trust-remote-code (toggle Tool Call Parser in the Parsers card of the Playground above) to surface structured tool calls via message.tool_calls; --tool-call-parser auto resolves to the same parser for Qwen4 checkpoints.
The dedicated qwen4 tool-call parser reads Qwen4’s native XML call format:
Format
- Streaming and non-streaming parity. One scanner serves both paths. Markers only count on their own line, so
<function=...>,<parameter=...>, or</tool_call>appearing in prose or inside a parameter value (for example an XML snippet in a code string) stay text. A call is emitted whole once its closing lines arrive. - Schema-aware arguments. Each parameter value is decoded with its JSON Schema in view, including type unions,
enum/const,anyOf/oneOf/allOf, and local$ref. A puretype: "string"parameter keeps its wire text verbatim, so the literal string"null"or"123"is not turned intonullor a number. For a function that is not strict, a value that does not parse to its declared type is returned as the raw string rather than rejected; validation against the schema is only guaranteed for strict tools (below). tool_choiceand parallel calls."auto","none","required", and a named function are supported, along with multiple calls in one turn (parallel_tool_calls)."required"and named choices are enforced with an XGrammar structural tag written for Qwen4’s own format, so constrained calls look exactly like unconstrained ones: zero-argument calls have no blank line, and parameters need not follow the schema’s order.- Strict tools. With
"strict": trueon a function, the same grammar also applies undertool_choice="auto": each required parameter is written exactly once, values follow the schema, and a call is only returned when its decoded arguments validate against that schema. Parameters may come in any order while the grammar stays within its size budget; for larger schemas (many required parameters) the grammar falls back to the schema’s declaration order. - Fail-closed on broken calls. A closing-tag slip that can be recovered without losing anything — a missing
</parameter>line, or a misspelled one such as</parameter1>— is repaired and the call is returned. An unclosed or otherwise unrecoverable<tool_call>block is never returned as a tool call and never leaks as raw markup intocontent. If the output was cut bymax_tokens, the response keepsfinish_reason="length"and the content before the call. If the model ended the turn itself, the request fails with a typed error —incomplete_tool_callormalformed_tool_call(HTTP 500, or an error event when streaming) — instead of silently returning a turn with no call, so clients can retry.
max_tokens cap — leaves content empty and puts the partial reasoning in reasoning_content. Print both so a bare None doesn’t mislead you.
Tool Calling Example (Python)
Tool Calling Example (Python)
Example
Example Output
Example Output
Output
3.3 Recommended Sampling Parameters
The Qwen team recommends different sampling settings for the two modes:| Parameter | Thinking (default) | Non-thinkingreasoning_effort=“off” |
|---|---|---|
temperature | 1.0 | 0.7 |
top_p | 0.95 | 0.80 |
top_k | 20 | 20 |
min_p | 0.0 | 0.0 |
presence_penalty | 0.0 | 1.5 |
repetition_penalty | 1.0 | 1.0 |
temperature,top_p, andpresence_penaltyare standard Chat Completions fields.top_k,min_p, andrepetition_penaltyare SGLang extensions; with the OpenAI Python SDK, pass them throughextra_body, for exampleextra_body={"top_k": 20}.presence_penaltycan be adjusted between 0 and 2 to reduce endless repetition; higher values may occasionally cause language mixing and a slight drop in quality.- Leave enough output budget for agentic tasks: thinking tokens and the final answer both count toward
max_tokens. - In multi-turn agentic tasks, a lower
reasoning_effortdoes not always reduce total completion time: faster turns can come with more failures and retries.
Sampling Example (Python)
Sampling Example (Python)
Example
Example Output
Example Output
Output
