Deployment
Install SGLang
Install SGLang
Use the Ling-3.1-flash image, which includes model support and the decode optimizations used by these recipes. The image supports multiple CPU architectures:Select Docker in the command panel to launch the matching image. The Python command requires an environment with the same Ling-3.1-flash build. See the installation guide for Docker setup.
Command
The first launch in a fresh container spends about five extra minutes compiling JIT kernels for the speculative-decoding graphs (about 4–5 minutes once, then about 30 seconds). Mount a persistent cache volume, for example
-v ~/.cache:/root/.cache, to skip it on later starts.AMD MI325X / MI350X: the published ROCm images predate the ROCm gated-MLA fix that Ling-3.1-flash needs; without it the server fails while capturing decode CUDA graphs. Until a ROCm image includes the fix, build a thin image that switches the nightly’s editable SGLang source to the Ling-3.1-flash branch (use the
mi35x base for MI350X), then substitute it for the image in the generated Docker command:Dockerfile
- Low-Latency — TP-only (EP=1) with NEXTN speculative decoding for single-user chat and interactive requests. Verified on H200.
- High-Throughput — expert-parallel (EP) serving for batch and multi-user traffic: TP8 + EP8 on H200/H800/H100/B200-class nodes, TP4 + EP4 on GB300, TP8 + EP8 with AITER on AMD MI300X/MI325X/MI350X/MI355X (without speculative decoding). Verified on H200 and GB300; other platforms are unverified. AMD MI325X and MI350X recipes (TP8 + EP8 with AITER, without speculative decoding) are provided unverified; the MI325X accuracy in the benchmark card was measured by AMD.
Playground
Experiment with SGLang features on top of the selected deployment. The speculative-decoding options show the checkpoint requirements; the multi-turn prefix-cache preset adds the paired scheduler flags and environment setting.1. Model introduction
Ling-3.1-flash is a hybrid-attention Mixture-of-Experts language model using theBailingMoeV3ForCausalLM architecture. Its 72 layers combine Kimi Delta Attention (KDA) with Multi-head Latent Attention (MLA), with 512 routed experts. The checkpoint uses FP8 E4M3 weights in 128×128 blocks with dynamic activation quantization.
The model supports reasoning and structured tool calling, with a context limit of 262,144 tokens.
Checkpoint: inclusionAI/Ling-3.1-flash. License: MIT.
The model has about 560B total parameters (512 routed experts with 8 active plus one shared expert per token, about 17B active), 72 layers, and FP8 block-quantized weights.
2. Configuration tips
- Use eight H200 GPUs with
--tp 8 --ep 8, or four GB300 GPUs with--tp 4 --ep 4. SGLang detects FP8 from the checkpoint. - Leave
--mem-fraction-staticat its default. SGLang auto-selects theling3reasoning and tool-call parsers for this architecture; you can change the parser settings in the Playground. - NEXTN: add
--speculative-algorithm NEXTNfor built-in MTP speculative decoding. Measured acceptance length is 2.61 on random tokens and 2.13 on real-text probes. - Long context: the checkpoint supports 262,144 tokens natively. For up to 1,048,576 tokens, add the YaRN override from §3.4.
- Topology: the Low-Latency recipe runs TP-only (no
--ep-size) and is clearly faster at batch size 1 (about 9-13% lower TPOT on H200, verified on both 2048/512 and 8192/1024 workloads). At concurrency 16-32 the two recipes deliver the same throughput within ~2%. TP-only relies on the loader’s TP-requant support; it fails loudly at startup on builds without it. - For prefix-heavy, multi-turn workloads, select Cache fork and tail in the Playground. It combines
--mamba-radix-cache-strategy extra_buffer,--chunked-prefill-size 4096, andSGLANG_SPLIT_PREFILL_AT_MAMBA_FORK=1. GPU checks confirmed both fork and tail states are cached, saving about 576 tokens per subsequent turn in the measured workload.
Playground support
- Attention: BailingKDA shards its projections on attention TP; DP-attention size must divide TP. Prefill CP is disabled because BailingKDA does not implement the required sequence gather and recurrent-state handling.
- MoE: Auto, DeepGEMM, and Triton use the FP8 MoE runner paths. EP must divide TP.
- PD disaggregation: the Playground exposes separate prefill and decode roles with Mooncake transfer. The runtime has hybrid recurrent-state transfer support, but this model’s PD deployment has not been verified. Provision separate workers and route requests through a PD-aware gateway; select the role-specific command for each worker.
- HiCache: enabling Mooncake on the H200 base preserves NEXTN and adds direct page-first I/O, hybrid-KDA prefix settings, and TCP storage endpoints.
Performance
On H200 TP8 with NEXTN and the decode gates enabled, batch-size-1 output throughput measures 269.2 tokens/s (TP8 + EP8: 239.5 tokens/s). GB300 TP4 with NEXTN measures 175.3 tokens/s (TPOT 5.22 ms, accept 2.60; TP4 + EP4: 160.0 tokens/s).
Acceptance length is the mean number of tokens accepted per speculative verification step, including the target bonus token:
| Workload | Acceptance length |
|---|---|
| Random-token benchmark (bs=1) | 2.61 |
| GSM8K smoke (HiCache serve) | 2.29 |
| Full GSM8K (cumulative) | 2.43 |
| Real-text probes (30 prompts) | 2.13 |
Reproduce the H200 speed workload
Reproduce the H200 speed workload
Launch the H200 Low-Latency recipe, then run:For the saturation row in the benchmark widget, launch the H200 High-Throughput recipe instead and run:
Command
Command
Reproduce GSM8K accuracy
Reproduce GSM8K accuracy
Command
3. Advanced usage
3.1 Reasoning
Theling3 parser returns reasoning in message.reasoning_content and the final answer in message.content. Thinking is enabled by default. To request a direct answer, pass "chat_template_kwargs": {"enable_thinking": false} in the request body, or extra_body={"chat_template_kwargs": {"enable_thinking": False}} with the OpenAI Python client.
Thinking-on request (Python)
Thinking-on request (Python)
Python
Example Output
Example Output
Output
reasoning_content (59 tokens); the second is content. finish_reason is stop.Thinking-off request (Python)
Thinking-off request (Python)
Python
Example Output
Example Output
Output
reasoning_content is None and reasoning_tokens is 0.3.2 Tool calling
Theling3 tool-call parser returns structured calls in message.tool_calls, with finish_reason set to tool_calls. Send tools through the OpenAI-compatible tools field and return each tool result with its matching tool_call_id. Read both reasoning_content and content on the follow-up assistant turn.
Tool-calling request and follow-up (Python)
Tool-calling request and follow-up (Python)
Python
Example Output (first turn)
Example Output (first turn)
Output
Example Output (follow-up)
Example Output (follow-up)
Output
reasoning_content; the second is content. finish_reason is stop.3.4 Long context with YaRN (up to 1M tokens)
The model’s native context is 262,144 tokens. Verified on H200 and GB300, YaRN extrapolation serves up to 1,048,576 tokens:Command
rope_theta or partial_rotary_factor silently changes the RoPE base, and omitting max_position_embeddings keeps the 262,144 limit. Only enable it for prompts beyond 256K.
Verification on the current checkpoint: a fact planted at token 700,023 of a 900,022-token prompt is retrieved exactly, NEXTN acceptance stays about 2.1 at 900K, and a 300,101-token prompt is answered correctly (H200 TTFT 15.4 s, GB300 12.6 s). One 1M-token request fits alongside normal serving traffic on both platforms.
3.3 HiCache with Mooncake
With HiCache enabled, prefix state is written through to Mooncake L3 and later requests prefetch it back: measured 5952 of 6000 tokens restored from storage on every TP rank. Mooncake runs as L3 prefix storage over TCP; start the metadata server, master, and storage client before launching SGLang. Run these services on the same host as the SGLang container:Start Mooncake services
Start Mooncake services
Command
Example Output
Example Output
Output
MOONCAKE_DEVICE and --device_names empty. The generated command includes extra_buffer, direct page-first I/O, and hicache_storage_pass_prefix_keys=true for hybrid KDA prefix reuse. To verify L3 round-trip: send a long prompt (thousands of tokens), wait for the server to go idle, flush with curl -X POST http://localhost:30000/flush_cache -H 'Content-Type: application/json' -d '{}', then repeat the same prompt.
Verify L3 prefetch (serve log)
Verify L3 prefetch (serve log)
Output
POST /flush_cache is refused with 400 while any request is still in flight — the L3 write-through finishes after the response returns. Wait a few seconds of idle before flushing.