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.- Low-Latency — single-user chat and interactive requests, with NEXTN speculative decoding. Verified on H200 and GB300; H20-3e, H800, H100, and B200 recipes are provided unverified.
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. - On H200, enable
SGLANG_ENABLE_FP8_BLOCK_GEMV=1andSGLANG_ENABLE_FUSED_KDA_OUTPUT_QUANT=1. Both are included in the generated commands; they are no-ops on GB300 (SM10x). - 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. - 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 + EP8 with NEXTN and the decode gates enabled, batch-size-1 output throughput measures 251.2 tokens/s. GB300 NEXTN batch-size-1 result:180.0 tok/s (TPOT 5.14 ms, accept 2.59).
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 concurrency-32 row in the benchmark widget:
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
reasoning_content and content populated.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.