> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sglang.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Muse Spark Open

> Deploy Muse Spark Open with SGLang — launch recipes, feature compatibility, and tuning notes for GB300, B300, B200, H200, MI355X, Intel Xeon

## Deployment

> [accordion] Install SGLang
>
> ```bash Command theme={null}
> docker pull lmsysorg/sglang:latest                # NVIDIA B300 / GB300 / B200 / H200
> docker pull lmsysorg/sglang-rocm:muse-spark-open    # AMD MI355X
> docker pull lmsysorg/sglang:dev-muse-spark-xeon     # Intel Xeon CPU
> ```
>
> The deployment panel can render a complete `docker run` command for the selected hardware and options. See [Install SGLang with Docker](https://docs.sglang.io/docs/get-started/install.md#method-3-using-docker) for host setup. The CUDA tag does not run on MI355X; use the ROCm image there; Use Xeon image for Xeon CPU and for more SGLang CPU installation approaches, see the [CPU version installation guide](https://docs.sglang.io/docs/hardware-platforms/cpu_server.md#installation).

Choose your **Hardware Platform**, **Strategy**, and **Quantization** below. The default is **B300 / Low Latency / NVFP4**. **Low Latency** keeps unified memory disabled; **High Throughput** removes all speculative decoding parameters and enables unified memory on NVIDIA GPUs (B300, GB300, B200, and H200). On **TPU v7** (one host, [SGLang-TorchTPU](https://github.com/sgl-project/sglang-torchtpu)), Low Latency keeps DFlash at 2 running requests and High Throughput runs 64 requests without speculative decoding. TPU v7 support is not merged yet: it runs from the SGLang-TorchTPU branch [`haolin/ms-v11`](https://github.com/sgl-project/sglang-torchtpu/tree/haolin/ms-v11), which we are actively upstreaming. Its commands still carry many TPU-specific settings; we will productionize TPU v7 support and remove most of them. Use the Playground to tune parallelism, caching, speculative decoding, multimodal transport, and prefill/decode disaggregation.

With a current SGLang build, the commands omit settings inferred from the checkpoint and GPU. Muse Spark NVFP4 selects `modelopt_fp4`, with `flashinfer_trtllm` MoE on B200/B300/GB300 or `marlin` on H200. The default static memory fraction is `0.8` on Blackwell and `0.85` on Hopper; recipes with a different budget keep an explicit override. LayerNorm-SP enables MegaMoE automatically for NVFP4 on data-center Blackwell when EP equals TP and is greater than 1, except on PD decode workers. Use `--no-enable-megamoe-for-layernorm-sp` to opt out. Muse Spark DFlash2 drafts default to FA4 on these NVIDIA platforms and eight draft tokens. Explicit settings take precedence.

## Playground

The Playground is where you experiment with **SGLang features beyond the verified matrix**. The Deploy panel above only emits combinations the SGLang team has signed off on; the Playground lets you turn on additional knobs on top of whichever cell the Deploy panel is currently showing.

The **Unified Memory** control has **Enable** and **Disable** options. It initially inherits the current Deployment command and resets to that command when you change the Deployment selection. **Enable** is unavailable on MI355X and Xeon because their `aiter` and `intel_amx` attention backends do not support the unified KV layout.

## Agentic Long-Context Deployment

Agentic workloads, such as coding agents and other multi-turn, tool-using assistants, send long prompts whose prefixes grow and repeat from turn to turn. Serving them well depends on reusing the KV cache across turns, offloading it beyond GPU memory, and keeping each session on the workers that already hold its prefix. This section gives complete launch commands for such deployments, each benchmarked in [SemiAnalysis InferenceX](https://inferencex.semianalysis.com/) and linked to the run that measured it. Pick a hardware platform, checkpoint, deployment shape, concurrency, KV cache offloading mechanism and router to get every process of the deployment as a raw command, one tab per process in launch order.

* **Router.** Each configuration was submitted behind one front door: Dynamo (`dynamo.frontend` with `dynamo.sglang` workers) or SGLang (`sglang.launch_server`, behind `sglang_router` when there are several workers or DP-attention ranks).
* **KV offload.** Choose among these KV cache offloading mechanisms: none (GPU KV only), HiCache (host DRAM), or a Mooncake store attached through the external linker. The Mooncake option needs an image whose SGLang build includes `--enable-unified-cache-external-linker`.
* **Container image.** Run the commands inside the image listed for each configuration; flag names follow that image.

### GB300 deployments measured with Artificial Analysis AgentPerf

Five aggregated Dynamo + SGLang deployments on GB300, measured with the [Artificial Analysis AgentPerf](https://github.com/ArtificialAnalysis/agentperf-client) coding-agent workload. Together they span the trade-off from the lowest per-user latency (concurrency 1) to the highest throughput per GPU (concurrency 160), ordered from low latency to high throughput. Each one starts from the Artificial Analysis SGLang submission for this model and changes only flags, environment variables and parallelism.

* **Container image.** `lmsysorg/sglang:dev-muse-spark-open@sha256:8cfc5a72cb296771f5f8a4a4688cb6d05685610a830cbb616fa4ab0eb7bb2b0a` with the Dynamo wheels added: `pip install --no-deps ai-dynamo==1.6.0.dev20261019 ai-dynamo-runtime==1.6.0.dev20261019`.
* **Router.** One Dynamo frontend with the KV-aware router. Session affinity keeps requests that carry the same `X-Dynamo-Session-ID` header on one worker; the AgentPerf client sends one ID per agent session.
* **Checkpoints.** `meta-models/Muse-Spark-Open-816B-A42B-NVFP4` with the DFlash2 draft `RadixArk/Muse-Spark-Open-DFlash2` (8 draft tokens, FP8 KV cache).
* **HiCache.** `--hicache-size` is the host tier in GB per rank; scale it to your host memory.
* **Two-node deployments.** The TP8·EP8 worker spans two GB300 trays (4 GPUs each) over multi-node NVLink: run the worker command on both nodes, with `NODE_RANK` 0 on the first.

> [accordion] Agg TP8·EP8 (2 nodes), lowest latency · 8 GPUs · concurrency 1
>
> > [tab] Env Vars
> >
> > ```bash theme={null}
> > export ETCD_IP=<node running etcd>
> > export AGG_HEAD_IP=<first node of the worker>
> > export NODE_RANK=<0 on the first node, 1 on the second>
> > ```
>
> > [tab] etcd
> >
> > ```bash theme={null}
> > etcd \
> >   --data-dir /tmp/etcd \
> >   --listen-client-urls http://0.0.0.0:2379 \
> >   --advertise-client-urls http://$ETCD_IP:2379
> > ```
>
> > [tab] Dynamo frontend
> >
> > ```bash theme={null}
> > export DYN_REQUEST_PLANE=tcp
> > export DYN_ROUTER_QUEUE_THRESHOLD=None
> > export DYN_ROUTER_TEMPERATURE=0
> > export DYN_TOKENIZER=fastokens
> > export DYN_TOKENIZER_CACHE=1
> > export DYN_TOKENIZER_CACHE_BYTES=8000000000
> > export ETCD_ENDPOINTS=http://$ETCD_IP:2379
> >
> > python3 -m dynamo.frontend \
> >   --http-port 8000 \
> >   --router-mode kv \
> >   --router-session-affinity-ttl-secs 14400 \
> >   --active-decode-blocks-threshold None \
> >   --active-prefill-tokens-threshold None \
> >   --active-prefill-tokens-threshold-frac None
> > ```
>
> > [tab] SGLang worker (run on each of the 2 nodes)
> >
> > ```bash theme={null}
> > export DYN_REQUEST_PLANE=tcp
> > export ETCD_ENDPOINTS=http://$ETCD_IP:2379
> > export NCCL_CUMEM_ENABLE=1
> > export NCCL_MNNVL_ENABLE=1
> > export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
> > export SGLANG_TIMEOUT_KEEP_ALIVE=900
> >
> > python3 -m dynamo.sglang \
> >   --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
> >   --served-model-name meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
> >   --host 0.0.0.0 \
> >   --port 30000 \
> >   --dist-init-addr $AGG_HEAD_IP:20000 \
> >   --nnodes 2 \
> >   --node-rank $NODE_RANK \
> >   --kv-events-config '{"publisher":"zmq","topic":"kv-events","endpoint":"tcp://*:5557"}' \
> >   --request-plane tcp \
> >   --dyn-reasoning-parser muse \
> >   --dyn-tool-call-parser muse \
> >   --expert-parallel-size 8 \
> >   --kv-cache-dtype fp8_e4m3 \
> >   --max-running-requests 32 \
> >   --mem-fraction-static 0.85 \
> >   --mm-feature-transport cpu \
> >   --moe-runner-backend flashinfer_trtllm \
> >   --quantization modelopt_fp4 \
> >   --reasoning-parser muse \
> >   --speculative-algorithm DFLASH \
> >   --speculative-draft-attention-backend fa4 \
> >   --speculative-draft-model-path RadixArk/Muse-Spark-Open-DFlash2 \
> >   --speculative-num-draft-tokens 8 \
> >   --swa-full-tokens-ratio 0.1 \
> >   --tensor-parallel-size 8 \
> >   --trust-remote-code \
> >   --watchdog-timeout 3600
> > ```

> [accordion] Agg TP8·EP8 (2 nodes), low latency · 8 GPUs · concurrency 4
>
> > [tab] Env Vars
> >
> > ```bash theme={null}
> > export ETCD_IP=<node running etcd>
> > export AGG_HEAD_IP=<first node of the worker>
> > export NODE_RANK=<0 on the first node, 1 on the second>
> > ```
>
> > [tab] etcd
> >
> > ```bash theme={null}
> > etcd \
> >   --data-dir /tmp/etcd \
> >   --listen-client-urls http://0.0.0.0:2379 \
> >   --advertise-client-urls http://$ETCD_IP:2379
> > ```
>
> > [tab] Dynamo frontend
> >
> > ```bash theme={null}
> > export DYN_REQUEST_PLANE=tcp
> > export DYN_ROUTER_QUEUE_THRESHOLD=None
> > export DYN_ROUTER_TEMPERATURE=0
> > export DYN_TOKENIZER=fastokens
> > export DYN_TOKENIZER_CACHE=1
> > export DYN_TOKENIZER_CACHE_BYTES=8000000000
> > export ETCD_ENDPOINTS=http://$ETCD_IP:2379
> >
> > python3 -m dynamo.frontend \
> >   --http-port 8000 \
> >   --router-mode kv \
> >   --router-session-affinity-ttl-secs 14400 \
> >   --active-decode-blocks-threshold None \
> >   --active-prefill-tokens-threshold None \
> >   --active-prefill-tokens-threshold-frac None
> > ```
>
> > [tab] SGLang worker (run on each of the 2 nodes)
> >
> > ```bash theme={null}
> > export DYN_REQUEST_PLANE=tcp
> > export ETCD_ENDPOINTS=http://$ETCD_IP:2379
> > export NCCL_CUMEM_ENABLE=1
> > export NCCL_MNNVL_ENABLE=1
> > export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
> > export SGLANG_TIMEOUT_KEEP_ALIVE=900
> >
> > python3 -m dynamo.sglang \
> >   --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
> >   --served-model-name meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
> >   --host 0.0.0.0 \
> >   --port 30000 \
> >   --dist-init-addr $AGG_HEAD_IP:20000 \
> >   --nnodes 2 \
> >   --node-rank $NODE_RANK \
> >   --kv-events-config '{"publisher":"zmq","topic":"kv-events","endpoint":"tcp://*:5557"}' \
> >   --request-plane tcp \
> >   --dyn-reasoning-parser muse \
> >   --dyn-tool-call-parser muse \
> >   --expert-parallel-size 8 \
> >   --kv-cache-dtype fp8_e4m3 \
> >   --max-running-requests 32 \
> >   --mem-fraction-static 0.85 \
> >   --mm-feature-transport cpu \
> >   --moe-runner-backend flashinfer_trtllm \
> >   --quantization modelopt_fp4 \
> >   --reasoning-parser muse \
> >   --speculative-algorithm DFLASH \
> >   --speculative-draft-attention-backend fa4 \
> >   --speculative-draft-model-path RadixArk/Muse-Spark-Open-DFlash2 \
> >   --speculative-num-draft-tokens 8 \
> >   --swa-full-tokens-ratio 0.1 \
> >   --tensor-parallel-size 8 \
> >   --trust-remote-code \
> >   --watchdog-timeout 3600
> > ```

> [accordion] Agg TP4·EP4, balanced · 4 GPUs · concurrency 16
>
> > [tab] Env Vars
> >
> > ```bash theme={null}
> > export ETCD_IP=<node running etcd>
> > export AGG_HEAD_IP=<first node of the worker>
> > ```
>
> > [tab] etcd
> >
> > ```bash theme={null}
> > etcd \
> >   --data-dir /tmp/etcd \
> >   --listen-client-urls http://0.0.0.0:2379 \
> >   --advertise-client-urls http://$ETCD_IP:2379
> > ```
>
> > [tab] Dynamo frontend
> >
> > ```bash theme={null}
> > export DYN_REQUEST_PLANE=tcp
> > export DYN_ROUTER_QUEUE_THRESHOLD=None
> > export DYN_ROUTER_TEMPERATURE=0
> > export DYN_TOKENIZER=fastokens
> > export DYN_TOKENIZER_CACHE=1
> > export DYN_TOKENIZER_CACHE_BYTES=8000000000
> > export ETCD_ENDPOINTS=http://$ETCD_IP:2379
> >
> > python3 -m dynamo.frontend \
> >   --http-port 8000 \
> >   --router-mode kv \
> >   --router-session-affinity-ttl-secs 14400 \
> >   --active-decode-blocks-threshold None \
> >   --active-prefill-tokens-threshold None \
> >   --active-prefill-tokens-threshold-frac None
> > ```
>
> > [tab] SGLang worker
> >
> > ```bash theme={null}
> > export DYN_REQUEST_PLANE=tcp
> > export ETCD_ENDPOINTS=http://$ETCD_IP:2379
> > export NCCL_CUMEM_ENABLE=1
> > export SGLANG_TIMEOUT_KEEP_ALIVE=900
> >
> > python3 -m dynamo.sglang \
> >   --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
> >   --served-model-name meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
> >   --host 0.0.0.0 \
> >   --port 30000 \
> >   --kv-events-config '{"publisher":"zmq","topic":"kv-events","endpoint":"tcp://*:5557"}' \
> >   --request-plane tcp \
> >   --dyn-reasoning-parser muse \
> >   --dyn-tool-call-parser muse \
> >   --enable-layernorm-sp \
> >   --enable-megamoe-for-layernorm-sp \
> >   --expert-parallel-size 4 \
> >   --kv-cache-dtype fp8_e4m3 \
> >   --max-running-requests 32 \
> >   --mem-fraction-static 0.85 \
> >   --mm-feature-transport cpu \
> >   --moe-runner-backend flashinfer_trtllm \
> >   --prefill-decode-interval 64 \
> >   --quantization modelopt_fp4 \
> >   --reasoning-parser muse \
> >   --speculative-algorithm DFLASH \
> >   --speculative-draft-attention-backend fa4 \
> >   --speculative-draft-model-path RadixArk/Muse-Spark-Open-DFlash2 \
> >   --speculative-num-draft-tokens 8 \
> >   --swa-full-tokens-ratio 0.1 \
> >   --tensor-parallel-size 4 \
> >   --trust-remote-code \
> >   --watchdog-timeout 3600
> > ```

> [accordion] Agg TP4·EP4, high throughput · 4 GPUs · concurrency 64
>
> > [tab] Env Vars
> >
> > ```bash theme={null}
> > export ETCD_IP=<node running etcd>
> > export AGG_HEAD_IP=<first node of the worker>
> > ```
>
> > [tab] etcd
> >
> > ```bash theme={null}
> > etcd \
> >   --data-dir /tmp/etcd \
> >   --listen-client-urls http://0.0.0.0:2379 \
> >   --advertise-client-urls http://$ETCD_IP:2379
> > ```
>
> > [tab] Dynamo frontend
> >
> > ```bash theme={null}
> > export DYN_REQUEST_PLANE=tcp
> > export DYN_ROUTER_QUEUE_THRESHOLD=None
> > export DYN_ROUTER_TEMPERATURE=0
> > export DYN_TOKENIZER=fastokens
> > export DYN_TOKENIZER_CACHE=1
> > export DYN_TOKENIZER_CACHE_BYTES=8000000000
> > export ETCD_ENDPOINTS=http://$ETCD_IP:2379
> >
> > python3 -m dynamo.frontend \
> >   --http-port 8000 \
> >   --router-mode kv \
> >   --router-session-affinity-ttl-secs 14400 \
> >   --active-decode-blocks-threshold None \
> >   --active-prefill-tokens-threshold None \
> >   --active-prefill-tokens-threshold-frac None
> > ```
>
> > [tab] SGLang worker
> >
> > ```bash theme={null}
> > export DYN_REQUEST_PLANE=tcp
> > export ETCD_ENDPOINTS=http://$ETCD_IP:2379
> > export NCCL_CUMEM_ENABLE=1
> > export SGLANG_OPT_UNIFIED_CACHE_FREE_OUT_OF_WINDOW_SLOTS=1
> > export SGLANG_TIMEOUT_KEEP_ALIVE=900
> >
> > python3 -m dynamo.sglang \
> >   --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
> >   --served-model-name meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
> >   --host 0.0.0.0 \
> >   --port 30000 \
> >   --kv-events-config '{"publisher":"zmq","topic":"kv-events","endpoint":"tcp://*:5557"}' \
> >   --request-plane tcp \
> >   --cuda-graph-max-bs-decode 64 \
> >   --dyn-reasoning-parser muse \
> >   --dyn-tool-call-parser muse \
> >   --enable-layernorm-sp \
> >   --enable-megamoe-for-layernorm-sp \
> >   --expert-parallel-size 4 \
> >   --kv-cache-dtype fp8_e4m3 \
> >   --max-running-requests 64 \
> >   --mem-fraction-static 0.85 \
> >   --mm-feature-transport cpu \
> >   --moe-runner-backend flashinfer_trtllm \
> >   --prefill-decode-interval 24 \
> >   --quantization modelopt_fp4 \
> >   --reasoning-parser muse \
> >   --speculative-algorithm DFLASH \
> >   --speculative-draft-attention-backend fa4 \
> >   --speculative-draft-model-path RadixArk/Muse-Spark-Open-DFlash2 \
> >   --speculative-num-draft-tokens 8 \
> >   --swa-full-tokens-ratio 0.15 \
> >   --tensor-parallel-size 4 \
> >   --trust-remote-code \
> >   --watchdog-timeout 3600
> > ```

> [accordion] Agg TP4·EP4 + HiCache, max throughput · 4 GPUs · concurrency 160
>
> > [tab] Env Vars
> >
> > ```bash theme={null}
> > export ETCD_IP=<node running etcd>
> > export AGG_HEAD_IP=<first node of the worker>
> > ```
>
> > [tab] etcd
> >
> > ```bash theme={null}
> > etcd \
> >   --data-dir /tmp/etcd \
> >   --listen-client-urls http://0.0.0.0:2379 \
> >   --advertise-client-urls http://$ETCD_IP:2379
> > ```
>
> > [tab] Dynamo frontend
> >
> > ```bash theme={null}
> > export DYN_REQUEST_PLANE=tcp
> > export DYN_ROUTER_QUEUE_THRESHOLD=None
> > export DYN_ROUTER_TEMPERATURE=0
> > export DYN_TOKENIZER=fastokens
> > export DYN_TOKENIZER_CACHE=1
> > export DYN_TOKENIZER_CACHE_BYTES=8000000000
> > export ETCD_ENDPOINTS=http://$ETCD_IP:2379
> >
> > python3 -m dynamo.frontend \
> >   --http-port 8000 \
> >   --router-mode kv \
> >   --router-session-affinity-ttl-secs 14400 \
> >   --active-decode-blocks-threshold None \
> >   --active-prefill-tokens-threshold None \
> >   --active-prefill-tokens-threshold-frac None
> > ```
>
> > [tab] SGLang worker
> >
> > ```bash theme={null}
> > export DYN_REQUEST_PLANE=tcp
> > export ETCD_ENDPOINTS=http://$ETCD_IP:2379
> > export NCCL_CUMEM_ENABLE=1
> > export SGLANG_OPT_UNIFIED_CACHE_FREE_OUT_OF_WINDOW_SLOTS=1
> > export SGLANG_TIMEOUT_KEEP_ALIVE=900
> >
> > python3 -m dynamo.sglang \
> >   --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
> >   --served-model-name meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
> >   --host 0.0.0.0 \
> >   --port 30000 \
> >   --kv-events-config '{"publisher":"zmq","topic":"kv-events","endpoint":"tcp://*:5557"}' \
> >   --request-plane tcp \
> >   --cuda-graph-max-bs-decode 176 \
> >   --dyn-reasoning-parser muse \
> >   --dyn-tool-call-parser muse \
> >   --enable-hierarchical-cache \
> >   --enable-layernorm-sp \
> >   --enable-megamoe-for-layernorm-sp \
> >   --expert-parallel-size 4 \
> >   --hicache-size 120 \
> >   --kv-cache-dtype fp8_e4m3 \
> >   --max-running-requests 176 \
> >   --mem-fraction-static 0.9 \
> >   --mm-feature-transport cpu \
> >   --moe-runner-backend flashinfer_trtllm \
> >   --prefill-decode-interval 6 \
> >   --quantization modelopt_fp4 \
> >   --reasoning-parser muse \
> >   --speculative-algorithm DFLASH \
> >   --speculative-draft-attention-backend fa4 \
> >   --speculative-draft-model-path RadixArk/Muse-Spark-Open-DFlash2 \
> >   --speculative-num-draft-tokens 8 \
> >   --swa-full-tokens-ratio 0.15 \
> >   --tensor-parallel-size 4 \
> >   --trust-remote-code \
> >   --watchdog-timeout 3600
> > ```

### MI355X deployment measured with SemiAnalysis InferenceX

DFlash V2 on MI355X, measured in [SemiAnalysis InferenceX](https://inferencex.semianalysis.com/) at concurrency 1–40: TP8·EP8 with the AMD monokernels at low concurrency, TP4·EP4 with HiCache at high concurrency.

* **Container image.** `lmsysorg/sglang-rocm:muse-spark-open-mi355-1106`.
* **Monokernels.** At low concurrency, add the monokernel flags below.
* **HiCache.** At high concurrency, add the TP4 HiCache flags below instead. `--hicache-size` is the host tier in GB per rank, so 310 GB needs about 1.24 TB of host memory across the four ranks.

```bash Command theme={null}
SGLANG_USE_AITER=1 \
SGLANG_USE_AITER_UNIFIED_ATTN=1 \
MUSE_MOE_BACKEND=flydsl \
python -m sglang.launch_server \
  --model-path amd/Muse-Spark-Open-816B-A42B-Quark-MXFP4 \
  --tp-size 8 \
  --ep-size 8 \
  --attention-backend aiter \
  --page-size 16 \
  --kv-cache-dtype fp8_e4m3 \
  --mem-fraction-static 0.85 \
  --max-running-requests 128 \
  --swa-full-tokens-ratio 0.2 \
  --prefill-decode-interval 20 \
  --scheduler-recv-interval 20 \
  --tokenizer-worker-num 4 \
  --speculative-algorithm DFLASH \
  --speculative-draft-model-path RadixArk/Muse-Spark-Open-DFlash2 \
  --speculative-draft-attention-backend triton \
  --speculative-num-draft-tokens 8 \
  --speculative-draft-window-size 2048 \
  --reasoning-parser muse \
  --tool-call-parser muse \
  --watchdog-timeout 1800 \
  --host 0.0.0.0 \
  --port 30000
```

```bash Monokernels (low concurrency) theme={null}
  --monokernel-backend amd \
  --max-running-requests 2 \
  --cuda-graph-max-bs-decode 2 \
  --prefill-decode-interval 64 \
  --swa-full-tokens-ratio 0.3 \
  --schedule-policy shortest-prefill-first \
  --stream-interval 40
```

```bash HiCache (high concurrency) theme={null}
PYTORCH_HIP_ALLOC_CONF=expandable_segments:True \
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
SGLANG_AITER_HONOR_EXPLICIT_MEM_FRACTION=1 \
  --tp-size 4 \
  --ep-size 4 \
  --page-size 128 \
  --mem-fraction-static 0.86 \
  --chunked-prefill-size 16384 \
  --max-prefill-tokens 16384 \
  --prefill-decode-interval 24 \
  --max-running-requests 80 \
  --cuda-graph-max-bs-decode 80 \
  --swa-full-tokens-ratio 0.2 \
  --schedule-policy shortest-prefill-first \
  --stream-interval 20 \
  --enable-hierarchical-cache \
  --hicache-size 310 \
  --hicache-write-policy write_through \
  --hicache-io-backend kernel \
  --hicache-mem-layout page_first
```

### TPU v7 deployment measured with SemiAnalysis InferenceX

> [!NOTE]
>
> **TPU v7 support is not merged yet.** The commands below run on the SGLang-TorchTPU branch [`haolin/ms-v11`](https://github.com/sgl-project/sglang-torchtpu/tree/haolin/ms-v11), which we are actively upstreaming. They are the settings used for the InferenceX submission, including many experimental environment variables and flags. We will productionize TPU v7 support and remove most of these settings.

DFlash V2 on one Google Cloud TPU v7 host (2x2x1: 4 chips, 8 TensorCores, `--tp-size 8`) with [SGLang-TorchTPU](https://github.com/sgl-project/sglang-torchtpu), measured in [SemiAnalysis InferenceX](https://inferencex.semianalysis.com/). The run is not public yet, so it has no link here. The explorer above is generated from public InferenceX data only, which is why TPU v7 is listed in this hand-written section.

* **Container image.** `<public sglang-torchtpu image: TBD>`.
* **Host.** 960 GiB of RAM. The HiCache host tier is 2.0x the device KV pool per rank through concurrency 10, and 56 GB per rank from concurrency 16 (`--hicache-size 56`, 448 GB across the eight ranks).
* **Acceptance.** SemiAnalysis measured these points with a synthetic speculative-decoding acceptance length of 4.05 (InferenceX golden AL via `SGLANG_SIMULATE_ACC_LEN`), which is not part of these commands. Where a command sets `SGLANG_TPU_DFLASH_ADAPTIVE_VERIFY=MIN_BS:4:3.06`, steps with at least `MIN_BS` decoding requests verify only the first 4 tokens of the 8-token draft block, and the measurement gave those steps the golden acceptance length for 3 draft tokens, 3.06 (the rule's third field). The engine reads that field only when `SGLANG_SIMULATE_ACC_LEN` is set. Real speed depends on your workload's acceptance.
* **Settings.** The commands are the submission's server settings, from [`agentx.py`](https://github.com/sgl-project/sglang-torchtpu/blob/haolin/ms-v11/benchmark/tpu/recipe/configs/muse_spark/agentx.py) in SGLang-TorchTPU, without its logging, diagnostics and telemetry settings and without values equal to the engine defaults.

```bash Concurrency 1 theme={null}
LIBTPU_INIT_ARGS="--xla_tpu_enable_async_collective_fusion=true --xla_tpu_overlap_compute_collective_tc=true --xla_tpu_enable_async_collective_fusion_multiple_steps=true --xla_tpu_enable_latency_hiding_scheduler=true --xla_latency_hiding_scheduler_rerun=10 --xla_tpu_all_gather_collective_matmul_mode=post_spmd_conservative --xla_tpu_reduce_scatter_collective_matmul_mode=post_spmd_conservative --xla_tpu_enable_sparse_core_collective_offload_all_reduce=false --xla_tpu_offload_gather_to_sparsecore=false --xla_tpu_enable_sparse_core_collective_offload_reduce_scatter=false --xla_tpu_enable_sparse_core_collective_offload_all_gather=false" \
SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 \
SGLANG_DFLASH_CONV_MATMUL_EXPAND=1 \
SGLANG_DFLASH_ROW_PARALLEL_FC=1 \
SGLANG_ENABLE_HEALTH_ENDPOINT_GENERATION=0 \
SGLANG_INIT_NEW_TOKEN_RATIO=1.0 \
SGLANG_MIN_NEW_TOKEN_RATIO_FACTOR=1.0 \
SGLANG_OPT_UNIFIED_CACHE_CHUNK_INSERT_STRIDE=131072 \
SGLANG_PLATFORM=tpu \
SGLANG_PREFILL_CHUNK_SHARE_MIN_TOKENS=1024 \
SGLANG_PREFILL_DECODE_INTERVAL_SKIP_IDLE=1 \
SGLANG_SPEC_TP_SYNC=rng \
SGLANG_TIMEOUT_KEEP_ALIVE=900 \
SGLANG_TPU_ALLOW_SPEC_RECOMPILE=1 \
SGLANG_TPU_DFLASH_ADAPTIVE_VERIFY=4:4:3.06 \
SGLANG_TPU_DFLASH_FP8_DRAFT=1 \
SGLANG_TPU_FP4_DEQUANT_VIA_FP8=1 \
SGLANG_TPU_FUSED_RS_ETP_FUSED_COMBINE=1 \
SGLANG_TPU_FUSED_RS_ETP_LOCAL_ROWS=1 \
SGLANG_TPU_FUSED_RS_ETP_PAIR_EXCHANGE=1 \
SGLANG_TPU_FUSED_RS_ETP_SKIP_OUT_ZERO=1 \
SGLANG_TPU_FUSED_RS_ETP_TILED_REDUCE=1 \
SGLANG_TPU_FUSED_RS_GMM2_ROW_OUT=1 \
SGLANG_TPU_FUSED_RS_PAIR_LOCAL_RANKS=1 \
SGLANG_TPU_FUSED_RS_PAIR_RUN_ADD=1 \
SGLANG_TPU_FUSED_RS_PAIR_RUN_TABLE=1 \
SGLANG_TPU_FUSED_RS_PAIR_WINDOW_ADD=1 \
SGLANG_TPU_FUSED_RS_ROW_LOOP_UNROLL=8 \
SGLANG_TPU_FUSED_RS_STAGING_SLOTS=10 \
SGLANG_TPU_FUSED_RS_WEIGHT_PINGPONG=1 \
SGLANG_TPU_HICACHE_TRIM_BEFORE_ALLOC=1 \
SGLANG_TPU_HOST_PADDING=1 \
SGLANG_TPU_KV_PACK_HEADS=1 \
SGLANG_TPU_MK_FOLD_ATTN_SCALE=1 \
SGLANG_TPU_MK_SAL_FP8_DOT=2 \
SGLANG_TPU_MK_Y_EARLY=1 \
SGLANG_TPU_MUSE_GATHER_COLUMNS_DIM=1 \
SGLANG_TPU_MUSE_MEGAKERNEL=1 \
SGLANG_TPU_MUSE_MK_ATTN_SKIP_IDLE=1 \
SGLANG_TPU_MUSE_MK_KV_WRITE_PIPELINED=1 \
SGLANG_TPU_MUSE_MK_LARGE_STEP_ATTN_PIPE=1 \
SGLANG_TPU_MUSE_MK_SAL_SWA_CHUNK_TOKENS=512 \
SGLANG_TPU_MUSE_PREFILL_SP=1 \
SGLANG_TPU_RAIDEN_COALESCE_PAGES=1 \
SGLANG_TPU_RPA_NO_MAX=1 \
SGLANG_TPU_RPA_OUT_HEAD_NORM_EPS=1e-05 \
SGLANG_TPU_RPA_SKIP_FULL_TILE_MASK=1 \
SGLANG_TPU_RPA_SKIP_PAD_Q=1 \
SGLANG_TPU_RPA_SKIP_PAD_Q_GROUP=256 \
SGLANG_TPU_RPA_SWA_PREFILL_BLOCKS=512:512 \
SGLANG_TPU_RPA_TRANSPOSED=1 \
SGLANG_TPU_USE_SEQ_ALONG_LANE_KV=1 \
TPU_PREMAPPED_BUFFER_SIZE=4294967296 \
python3 -m sglang.launch_server \
  --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
  --served-model-name meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
  --host 0.0.0.0 \
  --port 30000 \
  --attention-backend pallas_tpu_rpa_batched \
  --chunked-prefill-size 4096 \
  --device tpu \
  --dtype bfloat16 \
  --enable-hierarchical-cache \
  --enable-metrics \
  --enable-torch-compile \
  --grammar-backend none \
  --hicache-io-backend raiden \
  --hicache-mem-layout page_first_fused \
  --hicache-ratio 2.0 \
  --hicache-write-policy write_back \
  --kv-cache-dtype fp8_e4m3 \
  --max-prefill-tokens 4096 \
  --max-running-requests 2 \
  --mem-fraction-static 0.95 \
  --moe-runner-backend pallas_tpu_fused_rs \
  --page-size 256 \
  --prefill-decode-interval 128 \
  --quantization modelopt_fp4 \
  --reasoning-parser muse \
  --scheduler-recv-interval 8 \
  --speculative-algorithm DFLASH \
  --speculative-draft-attention-backend pallas_tpu_rpa_v3 \
  --speculative-draft-model-path RadixArk/Muse-Spark-Open-DFlash2 \
  --speculative-num-draft-tokens 8 \
  --swa-full-tokens-ratio 0.0625 \
  --tool-call-parser muse \
  --torch-compile-max-bs 2 \
  --tp-size 8 \
  --tpu-compile-bs 1 2 \
  --tpu-compile-tokens 1024 2048 4096 \
  --watchdog-timeout 3600
```

At concurrency 7, set `--max-running-requests 3`, `--torch-compile-max-bs 3`, and `--tpu-compile-bs 1 2 3`.

At concurrency 9, set `--max-running-requests 4`, `--torch-compile-max-bs 4`, and `--tpu-compile-bs 1 2 3 4`.

At concurrency 10, set `--max-running-requests 6`, `--prefill-decode-interval 64`, `--torch-compile-max-bs 6`, and `--tpu-compile-bs 1 2 3 4 5 6`.

From concurrency 16, the host KV pool, the sessions and the 16-request profile change enough that the command is shown in full:

```bash Concurrency 16 theme={null}
LIBTPU_INIT_ARGS="--xla_tpu_enable_async_collective_fusion=true --xla_tpu_overlap_compute_collective_tc=true --xla_tpu_enable_async_collective_fusion_multiple_steps=true --xla_tpu_enable_latency_hiding_scheduler=true --xla_latency_hiding_scheduler_rerun=10 --xla_tpu_all_gather_collective_matmul_mode=post_spmd_conservative --xla_tpu_reduce_scatter_collective_matmul_mode=post_spmd_conservative --xla_tpu_enable_sparse_core_collective_offload_all_reduce=false --xla_tpu_offload_gather_to_sparsecore=false --xla_tpu_enable_sparse_core_collective_offload_reduce_scatter=false --xla_tpu_enable_sparse_core_collective_offload_all_gather=false" \
SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 \
SGLANG_DFLASH_CONV_MATMUL_EXPAND=1 \
SGLANG_DFLASH_ROW_PARALLEL_FC=1 \
SGLANG_ENABLE_HEALTH_ENDPOINT_GENERATION=0 \
SGLANG_HICACHE_SWA_HOST_EVICT_PASSED_FIRST=1 \
SGLANG_HICACHE_SWA_HOST_FRACTION=0.3 \
SGLANG_INIT_NEW_TOKEN_RATIO=1.0 \
SGLANG_MIN_NEW_TOKEN_RATIO_FACTOR=1.0 \
SGLANG_OPT_UNIFIED_CACHE_CHUNK_INSERT_STRIDE=16384 \
SGLANG_PLATFORM=tpu \
SGLANG_PREFILL_CHUNK_SHARE_MIN_TOKENS=1024 \
SGLANG_PREFILL_DECODE_INTERVAL_SKIP_IDLE=1 \
SGLANG_SPEC_TP_SYNC=rng \
SGLANG_TIMEOUT_KEEP_ALIVE=900 \
SGLANG_TPU_ALLOW_SPEC_RECOMPILE=1 \
SGLANG_TPU_DFLASH_ADAPTIVE_VERIFY=3:4:3.06 \
SGLANG_TPU_DFLASH_FP8_DRAFT=1 \
SGLANG_TPU_FP4_DEQUANT_VIA_FP8=1 \
SGLANG_TPU_FUSED_RS_ETP_FUSED_COMBINE=1 \
SGLANG_TPU_FUSED_RS_ETP_LOCAL_ROWS=1 \
SGLANG_TPU_FUSED_RS_ETP_PAIR_EXCHANGE=1 \
SGLANG_TPU_FUSED_RS_ETP_SKIP_OUT_ZERO=1 \
SGLANG_TPU_FUSED_RS_ETP_TILED_REDUCE=1 \
SGLANG_TPU_FUSED_RS_GMM2_ROW_OUT=1 \
SGLANG_TPU_FUSED_RS_PAIR_LOCAL_RANKS=1 \
SGLANG_TPU_FUSED_RS_PAIR_RUN_ADD=1 \
SGLANG_TPU_FUSED_RS_PAIR_RUN_TABLE=1 \
SGLANG_TPU_FUSED_RS_PAIR_WINDOW_ADD=1 \
SGLANG_TPU_FUSED_RS_ROW_LOOP_UNROLL=8 \
SGLANG_TPU_FUSED_RS_STAGING_SLOTS=10 \
SGLANG_TPU_FUSED_RS_WEIGHT_PINGPONG=1 \
SGLANG_TPU_HICACHE_TRIM_BEFORE_ALLOC=1 \
SGLANG_TPU_HOST_PADDING=1 \
SGLANG_TPU_KV_PACK_HEADS=1 \
SGLANG_TPU_MK_FOLD_ATTN_SCALE=1 \
SGLANG_TPU_MK_SAL_FP8_DOT=2 \
SGLANG_TPU_MK_Y_EARLY=1 \
SGLANG_TPU_MUSE_GATHER_COLUMNS_DIM=1 \
SGLANG_TPU_MUSE_MEGAKERNEL=1 \
SGLANG_TPU_MUSE_MK_ATTN_SKIP_IDLE=1 \
SGLANG_TPU_MUSE_MK_EXPERT_SPLIT=4 \
SGLANG_TPU_MUSE_MK_KV_WRITE_PIPELINED=1 \
SGLANG_TPU_MUSE_MK_LARGE_STEP_ATTN_PIPE=1 \
SGLANG_TPU_MUSE_MK_MAX_ROWS=64 \
SGLANG_TPU_MUSE_MK_SAL_SWA_CHUNK_TOKENS=512 \
SGLANG_TPU_MUSE_PREFILL_SP=1 \
SGLANG_TPU_RAIDEN_COALESCE_PAGES=1 \
SGLANG_TPU_RPA_NO_MAX=1 \
SGLANG_TPU_RPA_OUT_HEAD_NORM_EPS=1e-05 \
SGLANG_TPU_RPA_SKIP_FULL_TILE_MASK=1 \
SGLANG_TPU_RPA_SKIP_PAD_Q=1 \
SGLANG_TPU_RPA_SKIP_PAD_Q_GROUP=256 \
SGLANG_TPU_RPA_SWA_PREFILL_BLOCKS=512:512 \
SGLANG_TPU_RPA_TRANSPOSED=1 \
SGLANG_TPU_USE_SEQ_ALONG_LANE_KV=1 \
TPU_PREMAPPED_BUFFER_SIZE=4294967296 \
python3 -m sglang.launch_server \
  --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
  --served-model-name meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
  --host 0.0.0.0 \
  --port 30000 \
  --attention-backend pallas_tpu_rpa_batched \
  --chunked-prefill-size 4096 \
  --device tpu \
  --dtype bfloat16 \
  --enable-hierarchical-cache \
  --enable-metrics \
  --enable-session-radix-cache \
  --enable-torch-compile \
  --grammar-backend none \
  --hicache-io-backend raiden \
  --hicache-mem-layout page_first_fused \
  --hicache-ratio 3.0 \
  --hicache-size 56 \
  --kv-cache-dtype fp8_e4m3 \
  --max-prefill-tokens 4096 \
  --max-running-requests 16 \
  --mem-fraction-static 0.95 \
  --moe-runner-backend pallas_tpu_fused_rs \
  --page-size 256 \
  --prefill-decode-interval 64 \
  --quantization modelopt_fp4 \
  --reasoning-parser muse \
  --scheduler-recv-interval 8 \
  --session-coverage-host-only \
  --session-id-header X-Correlation-ID \
  --session-leaf-at-prompt-end \
  --speculative-algorithm DFLASH \
  --speculative-draft-attention-backend pallas_tpu_rpa_v3 \
  --speculative-draft-model-path RadixArk/Muse-Spark-Open-DFlash2 \
  --speculative-num-draft-tokens 8 \
  --swa-full-tokens-ratio 0.0625 \
  --tool-call-parser muse \
  --torch-compile-max-bs 16 \
  --tp-size 8 \
  --tpu-compile-bs 1 2 3 4 5 6 7 8 9 10 11 12 16 \
  --tpu-compile-tokens 4096 \
  --watchdog-timeout 3600
```

At concurrency 22, also set `SGLANG_PREFILL_DECODE_INTERVAL_ADAPTIVE=6:8`.

## 1. Model introduction

This cookbook provides deployment recipes for the Muse Spark Open 816B-A42B checkpoints:

* **NVFP4:** `meta-models/Muse-Spark-Open-816B-A42B-NVFP4` (NVIDIA default).
* **MXFP4:** `amd/Muse-Spark-Open-816B-A42B-Quark-MXFP4` (MI355X default; Quark-quantized).
* **NVFP4 on MI355X (direct load):** the same `meta-models/Muse-Spark-Open-816B-A42B-NVFP4` checkpoint runs on MI355X with `--quantization quark_mxfp4`; the weights are requantized to MXFP4 while loading, so no separate export is needed. Select **MI355X / NVFP4** in the panel for this command.
* **INT4** `intel-ai/Muse-Spark-Open-816B-A42B-INT4` (Xeon default; AutoRound-quantized).
* **BF16:** `meta-models/Muse-Spark-Open-816B-A42B`.

## 2. Configuration tips

### H200 configuration

NVFP4 runs on one 8x H200 node with Marlin W4A16 experts (`--moe-runner-backend marlin`), since Hopper has no TRT-LLM FP4 MoE. The BF16 checkpoint does not fit on one node, so it runs TP16/EP16 across two nodes; replace `<node-rank>` and `<node0-ip>` for each node. Prefill sequence parallel and MegaMoE need SM100 kernels and are unavailable on H200.

### Xeon CPU service configuration

* Xeon serves the **INT4** checkpoint (quantized by Intel AutoRound, HF id: `intel-ai/Muse-Spark-Open-816B-A42B-INT4`) on the SGLang CPU engine. A typical Xeon 6 P-core platform (e.g., Xeon 6980P) is recommended.
* Set `--page-size 1` for the `intel_amx` attention backend (the CPU default attention backend).
* We recommend setting the TP size equal to the NUMA count. See the **Notes** under [Launch of the Serving Engine](https://docs.sglang.io/docs/hardware-platforms/cpu_server.md#launch-of-the-serving-engine) in the SGLang CPU server document for how to configure the arguments, especially TP and NUMA binding.

## 3. Advanced Usage

### 3.1 Reasoning

On the server, enable `--reasoning-parser muse` in your `sglang serve` command. The [Deployment](#deployment) recipes above already include this flag; in the [Playground](#playground), keep **Reasoning Parser** enabled under **Parsers**. The parser separates the model's reasoning into `message.reasoning_content` and its final answer into `message.content`.

On the client, set `reasoning_effort` for each chat completion request. Muse Spark Open supports **four levels: `low`, `medium`, `high`, and `xhigh`**. If you omit the parameter, the checkpoint's chat template defaults to **`xhigh`**. Use `low` or `medium` for faster, shorter responses, and `high` or `xhigh` for complex problem solving, coding, and agentic tasks. Other values, including `minimal`, are not supported. See the [model card](https://huggingface.co/meta-models/Muse-Spark-Open-816B-A42B-NVFP4) for the supported settings.

The example below connects to the server on port `30000` and discovers its model ID, so it works with whichever checkpoint you selected in Deployment. Change `base_url` if the server runs on another host or port. The current checkpoint's chat template does not require `chat_template_kwargs={"thinking": True}`; set the reasoning level with `reasoning_effort`.

> [accordion] Reasoning Example (Python)
>
> ```python Example theme={null}
> from openai import OpenAI
>
> client = OpenAI(
>     base_url="http://127.0.0.1:30000/v1",
>     api_key="EMPTY",
>     timeout=600.0,
> )
> model = client.models.list().data[0].id
> response = client.chat.completions.create(
>     model=model,
>     messages=[
>         {"role": "system", "content": "You are a helpful assistant."},
>         {"role": "user", "content": "Briefly explain: what is SGLang?"},
>     ],
>     max_tokens=16384,
>     reasoning_effort="xhigh",  # low | medium | high | xhigh (default)
> )
> choice = response.choices[0]
> print("Reasoning:", getattr(choice.message, "reasoning_content", None))
> print("Content:", choice.message.content)
> print("Finish reason:", choice.finish_reason)
> ```

> [accordion] Example Output
>
> ```text Output theme={null}
> Reasoning: We need to briefly explain what is SGLang. Likely want concise explanation. SGLang is structured generation language? It's a framework for programming LLMs. Developed by LMSYS? Actually SGLang is a serving framework.
>
> Need to explain: SGLang is a fast serving framework/DSL for LLMs? Let's recall.
>
> SGLang is a structured generation language, a domain-specific language for LLM programs. Created by LMSYS Org. Allows efficient LLM programming with structured prompting, caching, constrained decoding etc. Provides high-performance serving via RadixAttention, paged attention, etc. Used for chaining calls, multi-turn, function calling, reasoning.
>
> We should give brief explanation.
>
> Possibly user wants simple. Provide definition, key features, use cases.
>
> Make it brief but informative.
>
> Maybe need to distinguish from other? Should be neutral.
>
> Potentially also SGLang = Serving framework?
>
> SGLang is open-source system for efficient LLM serving and programming.
>
> Key features:
> - Front-end language (Python DSL) for controlling generation
> - Backend runtime: RadixAttention for KV cache reuse, continuous batching, tensor parallelism, quantization, speculative decoding.
> - Supports OpenAI-compatible API.
>
> Briefly explain.
>
> Keep concise.
>
> Add example maybe?
>
> User: "Briefly explain: what is SGLang?"
>
> Provide maybe 3-4 bullet points.
>
> Possibly mention origin: developed by LMSYS and UC Berkeley etc.
>
> Ensure not too long. Brief.
>
> Maybe add: SGL for Structured Generation Language.
>
> Make answer accessible.
>
> Probably mention advantages: faster, controllable.
>
> We should not hallucinate too much. Provide accurate info.
>
> SGLang GitHub: sgl-project/sglang.
>
> SGLang latest: SGLang is inference engine?
>
> Let's verify facts: SGLang was introduced in paper "SGLang: Efficient Execution of Structured Language Model Programs" arXiv 2312.07104, Dec 2023, authors Lianmin Zheng etc.
>
> It provides primitives: gen(), select(), etc.
>
> Runtime optimizations: RadixAttention, compressed FSM for constrained decoding, API speculative execution.
>
> Provides high throughput, low latency.
>
> Supports many models: Llama, Mistral, Qwen etc. Supports on NVIDIA GPUs, AMD.
>
> Should answer.
>
> User likely wants short. Provide 1 paragraph + bullets.
>
> Make tone helpful.
>
> Add use cases: agents, reasoning, data extraction.
>
> Probably not over.
>
> Potential need to add date knowledge cutoff 2026?
>
> Add nothing disallowed.
>
> Make final answer succinct.
>
> Maybe add link? Not needed.
>
> Use simple language.
>
> We should not mention reasoning strength.
>
> Proceed to final.
>
> Content: SGLang — **Structured Generation Language** — is an open-source system for programming and serving Large Language Models (LLMs).
>
> Created by LMSYS / UC Berkeley, it has 2 parts:
>
> **1. Frontend - a Python DSL:** Lets you write LLM programs with logic, not just string prompts. Primitives like `gen()`, `select()`, `fork()` for chaining calls, controlling reasoning, forcing JSON/tool-calling structure, multi-agent workflows, etc.
>
> **2. Backend - a high-performance inference engine:** Optimized runtime for fast, cheap serving with features like:
> * **RadixAttention:** automatic KV-cache reuse for prefixes, few-shot examples, multi-turn chat
> * Continuous batching, Tensor Parallelism, quantization, speculative decoding
> * Fast constrained/structured decoding
>
> In short: It's an alternative to vLLM / TensorRT-LLM. You get both a cleaner way to *program* LLMs and a very fast engine to *run* them, with an OpenAI-compatible API.
>
> Finish reason: stop
> ```

### 3.2 Tool calling

On the server, enable `--tool-call-parser muse` alongside `--reasoning-parser muse` in your `sglang serve` command. The [Deployment](#deployment) recipes above already include both flags; in the [Playground](#playground), keep **Tool Call Parser** and **Reasoning Parser** enabled under **Parsers**. SGLang converts Muse Spark Open's native tool-call format into OpenAI-compatible `message.tool_calls`, while keeping reasoning in `message.reasoning_content`.

On the client, pass function definitions in `tools`, with each function's arguments described by a JSON Schema. The checkpoint's [chat template](https://huggingface.co/meta-models/Muse-Spark-Open-816B-A42B-NVFP4/blob/main/chat_template.jinja) formats these definitions for the model. With `tool_choice="auto"`, the model decides whether to call a tool. The example below requests a weather lookup and prints each returned function name and its JSON arguments.

> [accordion] Tool Calling Example (Python)
>
> ```python Example theme={null}
> import json
>
> from openai import OpenAI
>
> client = OpenAI(
>     base_url="http://127.0.0.1:30000/v1",
>     api_key="EMPTY",
>     timeout=600.0,
> )
> model = client.models.list().data[0].id
>
> tools = [
>     {
>         "type": "function",
>         "function": {
>             "name": "get_weather",
>             "description": "Get the current weather for a city.",
>             "parameters": {
>                 "type": "object",
>                 "properties": {
>                     "location": {
>                         "type": "string",
>                         "description": "City name, for example Beijing.",
>                     },
>                     "unit": {
>                         "type": "string",
>                         "enum": ["celsius", "fahrenheit"],
>                     },
>                 },
>                 "required": ["location", "unit"],
>                 "additionalProperties": False,
>             },
>         },
>     }
> ]
>
> response = client.chat.completions.create(
>     model=model,
>     messages=[
>         {"role": "user", "content": "Use get_weather to check the current weather in Beijing in Celsius."},
>     ],
>     tools=tools,
>     tool_choice="auto",
>     reasoning_effort="xhigh",
>     max_tokens=16384,
> )
> choice = response.choices[0]
> message = choice.message
> print("Reasoning:", getattr(message, "reasoning_content", None))
> print("Content:", message.content)
> for tool_call in message.tool_calls or []:
>     print("Tool call ID:", tool_call.id)
>     print("Function:", tool_call.function.name)
>     print("Arguments:", json.loads(tool_call.function.arguments))
> print("Finish reason:", choice.finish_reason)
> ```

> [accordion] Example Output
>
> ```text Output theme={null}
> Reasoning: User wants get_weather to check current weather in Beijing in Celsius.
>
> We have function get_weather with parameters: location (string), unit (string enum celsius/fahrenheit)
>
> We need to call it.
>
> We must call the function with location=Beijing, unit=celsius
>
> Add reasoning.
>
> We should not add extra text beyond function call? In this format, we need to provide function call. Probably we need to output function call directly.
>
> We are Meta AI. Follow guidelines.
>
> We need to invoke get_weather.
>
> Be careful to JSON correct.
>
> Probably need thinking tags? But in this environment, we have tool access. We should call get_weather.
>
> We should do that now.
>
> Possibly reasoning strength 512, need thorough reasoning? No, we just need to call tool.
>
> Ensure we use correct recipient format: get_weather
>
> We need to produce "<atem:function_calls>..." block.
>
> We need to provide location: "Beijing", unit: "celsius"
>
> Make call.
>
> Content: Beijing in Celsius — checking the weather for you immediately.
> Tool call ID: call_43c0efae809d46988855bb79
> Function: get_weather
> Arguments: {'location': 'Beijing', 'unit': 'celsius'}
> Finish reason: tool_calls
> ```

This example inspects the requested tool calls; it does not fetch weather data. Your application executes the corresponding function. To continue the conversation, append the assistant message containing `tool_calls`, then a `role="tool"` message for each result with the matching `tool_call_id`, and send the updated messages with the same tool definitions.

### 3.3 Encode Prefill Decode Disaggregation

Encoder–Prefill–Decode (EPD) disaggregation separates media encoding, prompt processing, and token generation, so encoding-heavy image/video requests can be scheduled separately from language inference. The encoder sends features through `zmq_to_tokenizer`; prefill transfers KV state to decode through Mooncake, with a router exposing one client endpoint.

The examples below use one 8× B300 NVLink host: encoder TP2 shares GPUs 0–1 with prefill TP4/EP4 on GPUs 0–3; decode TP4/EP4 uses GPUs 4–7. Run each command in a separate shell using the NVIDIA image from [Deployment](#deployment), with a shared host network. Start encoder, prefill, decode, then router, waiting for each to become ready. Prefill (`30001`), decode (`30002`), and router (`8000`) match the Playground ports; the encoder uses `30010`.

> [!NOTE]
>
> These are simplified examples derived from [PR #265](https://github.com/radixark/sglang-muse-spark/pull/265). The source run checked transport with simulated outputs; this ordinary-serving configuration still needs runtime and accuracy validation. Leave GPU memory headroom for the encoder sharing the prefill GPUs.

> [accordion] Encoder server (B300, GPUs 0–1)
>
> ```bash Command theme={null}
> CUDA_VISIBLE_DEVICES=0,1 sglang serve \
>   --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
>   --quantization modelopt_fp4 \
>   --tp-size 2 \
>   --encoder-only \
>   --encoder-transfer-backend zmq_to_tokenizer \
>   --host 0.0.0.0 \
>   --port 30010
> ```

> [accordion] Prefill server (B300, GPUs 0–3)
>
> ```bash Command theme={null}
> export MC_INTRANODE_NVLINK=true
> export MC_TCP_ENABLE_CONNECTION_POOL=true
> export SGLANG_MOONCAKE_CUSTOM_MEM_POOL=INTRA_NODE_NVLINK
>
> CUDA_VISIBLE_DEVICES=0,1,2,3 sglang serve \
>   --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
>   --quantization modelopt_fp4 \
>   --moe-runner-backend flashinfer_trtllm \
>   --tp-size 4 --ep-size 4 \
>   --mem-fraction-static 0.8 \
>   --language-only \
>   --encoder-urls http://127.0.0.1:30010 \
>   --encoder-transfer-backend zmq_to_tokenizer \
>   --encoder-bootstrap-port 8997 \
>   --disaggregation-mode prefill \
>   --disaggregation-transfer-backend mooncake \
>   --disaggregation-bootstrap-port 8998 \
>   --reasoning-parser muse --tool-call-parser muse \
>   --host 0.0.0.0 \
>   --port 30001
> ```

> [accordion] Decode server (B300, GPUs 4–7)
>
> ```bash Command theme={null}
> export MC_INTRANODE_NVLINK=true
> export MC_TCP_ENABLE_CONNECTION_POOL=true
> export SGLANG_MOONCAKE_CUSTOM_MEM_POOL=INTRA_NODE_NVLINK
>
> CUDA_VISIBLE_DEVICES=4,5,6,7 sglang serve \
>   --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
>   --quantization modelopt_fp4 \
>   --moe-runner-backend flashinfer_trtllm \
>   --tp-size 4 --ep-size 4 \
>   --mem-fraction-static 0.75 \
>   --language-only \
>   --encoder-urls http://127.0.0.1:30010 \
>   --encoder-transfer-backend zmq_to_tokenizer \
>   --encoder-bootstrap-port 8999 \
>   --disaggregation-mode decode \
>   --disaggregation-transfer-backend mooncake \
>   --disaggregation-bootstrap-port 8998 \
>   --reasoning-parser muse --tool-call-parser muse \
>   --host 0.0.0.0 \
>   --port 30002
> ```

> [accordion] Router
>
> ```bash Command theme={null}
> sglang-router launch \
>   --pd-disaggregation \
>   --prefill http://127.0.0.1:30001 8998 \
>   --decode http://127.0.0.1:30002 \
>   --host 0.0.0.0 --port 8000
> ```

The language workers use distinct encoder-bootstrap ports (`8997` / `8999`) on this shared host; the router's `8998` matches the prefill KV bootstrap port. Send client requests to `http://localhost:8000/v1`. See the [EPD guide](https://docs.sglang.io/docs/advanced_features/epd_disaggregation.md) for the architecture and additional deployment options.

### 3.4 Sequence Parallel for Prefill

Sequence parallelism (SP) splits activations along the token dimension across TP ranks. Each rank processes its own token shard for normalization, pooling, and unpooling, reducing duplicated computation and activation storage during long-prompt prefill. NVFP4 MegaMoE connects these shards to expert parallelism through integrated all-to-all dispatch and combine: tokens reach their selected experts, and weighted expert outputs return to the original token ranks.

For a Blackwell NVFP4 configuration (B300, B200, or GB300), use the [Playground](#playground) to enable **Prefill Sequence Parallel** and **Prefill MegaMoE** together. This adds `--enable-layernorm-sp --enable-megamoe-for-layernorm-sp` to the launch command. Keep **Attention TP** and **MoE EP** equal; MegaMoE requires SP to remain on. These prefill options are unavailable on H200 and are omitted for a PD decode worker.

### 3.5 Speculative Decoding with DFlash v2 and Block Verification

DFlash V2 uses the target model's hidden states to propose a block of future tokens in one draft-model forward pass; Muse Spark Open then verifies the block in a single pass, advancing by multiple tokens when proposals are accepted. V2 mixes information across neighboring draft positions and selects candidates with their dependencies in mind. Optional [block verification](https://arxiv.org/abs/2403.10444) evaluates draft prefixes jointly instead of token by token, potentially accepting longer prefixes while preserving the target sampling distribution.

In the [Playground](#playground), select **DFlash V2** under **Speculative Decoding** to add `--speculative-algorithm DFLASH` and `--speculative-draft-model-path RadixArk/Muse-Spark-Open-DFlash2`. Then adjust:

* **Draft attention backend:** `fa4` for NVIDIA or `triton` for MI355X, inherited from Deployment and set with `--speculative-draft-attention-backend`.
* **Num draft tokens:** 1–8, default **8**, set with `--speculative-num-draft-tokens`.
* **Block Verification:** turn it on to add `--speculative-use-block-verification`; it is off by default.

The Deployment **Low Latency** strategy enables DFlash V2 on supported GPUs; **High Throughput** leaves speculative decoding off. The Playground inherits that choice and lets you override it.

### 3.6 MegaKernel with Helion (Experimental)

We support persistent Helion megakernels for DFlash V2 target verification. They fuse attention, projection and normalization boundaries, routing, MoE, and the layer tail, with a separate fused LM head, reducing kernel launches and communication overhead. TP4/EP1 shards each expert across four GPUs, avoiding the expert-load imbalance of EP4 at batch size 1. With **BS=1 + DFlash V2**, the reported decode performance is roughly **10% faster** than the TP4/EP4 baseline without megakernels on 4×GB300; gains depend on the workload.

Use this experimental recipe **only on a PD-disaggregated decode worker**, with four **GB300 (SM 10.3)** GPUs, NVFP4 weights, FP8 E4M3 KV cache, and `helion==1.5.0`. Keep prefill on the regular path: EP1 prefill is slower than the TP4/EP4 baseline. This specialized TP4/EP1 command is separate from the Playground's equal-TP/EP configuration.

> [accordion] Helion decode worker (4×GB300)
>
> Install the dependency in the serving environment, then launch the decode worker:
>
> ```bash Command theme={null}
> python -m pip install helion==1.5.0
>
> export NCCL_NVLS_ENABLE=1
> export NCCL_MNNVL_ENABLE=1
> export NCCL_CUMEM_ENABLE=1
> export SGLANG_MOONCAKE_CUSTOM_MEM_POOL=NVLINK
> export MC_FORCE_MNNVL=1
>
> SGLANG_FORCE_FUSED_OP_BACKEND=helion \
> SGLANG_FLASHINFER_NVFP4_PER_TOKEN_ACTIVATION=1 \
> python -m sglang.launch_server \
>   --model-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
>   --tokenizer-path meta-models/Muse-Spark-Open-816B-A42B-NVFP4 \
>   --served-model-name external \
>   --json-model-override-args '{"eos_token_id":[200001,200008]}' \
>   --tp-size 4 \
>   --ep-size 1 \
>   --context-length 131072 \
>   --max-running-requests 1 \
>   --quantization modelopt_fp4 \
>   --moe-runner-backend flashinfer_trtllm \
>   --attention-backend trtllm_mha \
>   --kv-cache-dtype fp8_e4m3 \
>   --page-size 128 \
>   --disable-flashinfer-autotune \
>   --disable-prefill-cuda-graph \
>   --cuda-graph-max-bs-decode 1 \
>   --reasoning-parser muse \
>   --tool-call-parser muse \
>   --speculative-algorithm DFLASH \
>   --speculative-draft-model-path RadixArk/Muse-Spark-Open-DFlash2 \
>   --speculative-draft-attention-backend fa4 \
>   --speculative-num-draft-tokens 8 \
>   --disaggregation-mode decode \
>   --disaggregation-transfer-backend mooncake \
>   --disaggregation-bootstrap-port 8998 \
>   --mem-fraction-static 0.80 \
>   --host 0.0.0.0 \
>   --port 30002
> ```

Pair this worker with a compatible prefill worker using the same target checkpoint, TP4, `--kv-cache-dtype fp8_e4m3`, `--page-size 128`, and `--served-model-name external`, with bootstrap port `8998`. Use the [Playground](#playground) PD router command with the decode URL pointing to this worker on port `30002`; send client requests to the router on port `8000`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.