|
| 1 | +--- |
| 2 | +title: "SGLang Day-0 Support for MiMo-V2-Flash Model" |
| 3 | +author: "SGLang Team and Xiaomi LLM Core Team" |
| 4 | +date: "December 16, 2025" |
| 5 | +previewImg: /images/blog/mimo-v2-flash/decode_1.png |
| 6 | +--- |
| 7 | + |
| 8 | +## Introduction |
| 9 | +MiMo-V2-Flash, with 309B total parameters and 15B activated parameters, is a new inference-centric model designed to maximize decoding efficiency. It is based on two key designs: **sliding window attention** and **multi-layer MTP**. MiMo-V2-Flash is explicitly co-designed for real-world serving workloads, enabling flexible tradeoffs between throughput and latency on different hardware. Combined with SGLang’s optimized Spec v2 runtime, which provides near-zero-overhead support for multi-layer MTP and efficient SWA execution, MiMo-V2-Flash delivers balanced TPOT and throughput on H200. In this blog, we will introduce the model and SGLang's efficient support. |
| 10 | + |
| 11 | +## Inference-Efficient Modeling |
| 12 | +The design of MiMo-V2-Flash follows an inference-efficiency principle. The MiMo-V2-Flash adopted two critical designs: |
| 13 | + |
| 14 | +1. Sliding Window Attention (SWA): In SWA, each token’s receptive field is limited to a fixed, constant-sized window, to reduce the attention's complexity on the sequence dimension. |
| 15 | +2. MTP: MiMo-V2-Flash's multi-layer MTP uses a chain of prediction heads, where each head sequentially predicts the next token. The resulting draft tokens are then verified in parallel in the following step using an extended query. |
| 16 | +The overview of MiMo-V2-Flash is shown in the figure below: |
| 17 | + |
| 18 | +<small><center>MiMo-V2-Flash Overview</center></small> |
| 19 | + |
| 20 | +Now let's see how those designs lead to a cost-efficient inference. |
| 21 | + |
| 22 | +### SWA |
| 23 | +In MiMo-V2-Flash, every five attention layers with a sliding window pattern are alternated with one dense GQA. The wide use of SWA can benefit the inference from multiple perspectives. First, during the prefilling stage, compute dominates the cost. Especially when the sequence is long, $O(N^2)$ attention computation is the bottleneck. SWA reduces the $O(N^2)$ complexity to a linear level to sequence length, $O(Nw)$, where $w$ is the window size. In a long context scenario, this design can significantly reduce the TTFT. SWA also reduces KV cache complexity to a constant level - releasing more resources for a larger batch size, and allows a better TPOT through fewer KV cache loading operations. |
| 24 | + |
| 25 | +The figure below shows the prefill benchmarking results for MiMo-V2-Flash. |
| 26 | + |
| 27 | +<small><center>MiMo-V2-Flash Prefill Benchmark (Radix Cache Disabled)</center></small> |
| 28 | + |
| 29 | +### MTP |
| 30 | +One of the most important designs in MiMo-V2-Flash is the multi-layer MTP, with 3 MTP layers. |
| 31 | + |
| 32 | +In decoding scenarios, most of the kernels are memory-bound. Since the query length is always 1, using a larger number of parallel decoding tokens is the most intuitive way to achieve higher throughput. |
| 33 | + |
| 34 | +However, as the batch size increases to a certain level, this effect will be restricted - the KV cache memory access also grows linearly with the batch size, and it performs as the memory-bounded bottleneck. At this time, the device's computing potential is still not fulfilled, but it's hard to increase throughput by increasing batch size. |
| 35 | + |
| 36 | +MTP can still leverage this underexploited compute to reduce the TPOT. In MTP, multiple tokens are generated at the same time by sequential prediction heads, and the tokens will be verified in parallel in the same query, increasing the query length. This will not trigger more KV cache access; it will always increase arithmetic intensity. When the inference is still heavily memory-bound, and the batch size's effect has been marginal, an aggressive MTP strategy with a satisfying acceptance rate can theoretically leverage the rest of the device's potential and achieve a better TPOT. |
| 37 | + |
| 38 | +## Hardware-Aware MTP Configuration |
| 39 | +Since MTP benefits from an unsaturated arithmetic intensity, and GQA's arithmetic computation is low - MiMo-V2-Flash attention design is natively well-suited for multi-layer MTP. However, when deploying MiMo-V2-Flash, choosing the right combination of batch size and MTP depth is still essential for achieving the optimal compute–memory balance and maximizing performance across different hardware platforms. Theoretically, we want to choose the best tradeoff, which achieves a satisfying throughput and TPOT simultaneously. The sweet spot of this trade-off depends on the hardware, because each hardware platform has its own roofline model. |
| 40 | + |
| 41 | +Generally speaking, devices with a higher roofline benefit more from aggressive MTP because they have abundant compute capacity that is harder to saturate in memory-bound decoding. In contrast, inference-oriented accelerators, e.g., H20, have comparatively limited FLOPs, and the usage of MTP should be more careful: aggressive MTP depth can push the workload to compute-bound and degrade the throughput. |
| 42 | + |
| 43 | +Here, we provide the benchmarking results on H200. MiMo-V2-Flash achieves balanced performance in both throughput and per request TPS. Thanks to SWA and MTP, the per request decoding throughput remains at 150 TPS even under long-context settings of up to 64K input tokens with per DP rank batch size 16. |
| 44 | + |
| 45 | +<small><center>MiMo-V2-Flash Decode Benchmark (DP 2, TP 4, EP 8, MTP Accept Length 3.6, Input Token Length 16k, Varying Batch Size)</center></small> |
| 46 | + |
| 47 | +<small><center>MiMo-V2-Flash Decode Benchmark (DP 2, TP 4, EP 8, MTP Accept Length 3.6, Per DP Rank Batch Size 16, Varying Input Token Length)</center></small> |
| 48 | + |
| 49 | +## Fast MTP Serving with SGLang Spec v2 |
| 50 | +MiMo’s multi-layer MTP is implemented natively on SGLang’s spec v2. We apply the fully overlapped MTP feature to improve throughput and latency, delivering faster MTP serving. In spec v2, the overlap scheduler is fused with speculative decoding: output sync/processing is delayed while the next batch’s kernels launch early, so CPU overhead for batching and syncing is hidden in GPU forward. This cuts GPU bubbles and improves throughput and latency. |
| 51 | + |
| 52 | +The figure below is a screenshot of the profiling, showing the overlapped decoding process with spec v2. |
| 53 | + |
| 54 | +<small><center>Overlapped Speculative Decoding Profile</center></small> |
| 55 | + |
| 56 | +## More Discussions |
| 57 | +In most LLM-serving workloads, the decoding stage is memory-bounded, leaving substantial compute underutilized, particularly on the mainstream training-oriented GPUs. While inference-specific accelerators with high bandwidth and lower FLOPs offer a cost-efficient choice, their speed is limited. MiMo-V2-Flash attempts to take another perspective to make the model itself inference-efficient. The multi-layer MTP model may be a generalizable solution - if the acceptance rate can be further optimized, it allows people to leverage their GPU's computation to achieve faster decoding. With a more adaptable architecture, hardware selection becomes more flexible: each device can operate at its own optimal compute–memory balance point. This opens the possibility of using the same class of hardware for both training and inference, simplifying deployment and reducing overall system cost. |
| 58 | + |
| 59 | +MiMo-V2-Flash support is already available in SGLang via PR ([#15207](https://github.com/sgl-project/sglang/pull/15207), [#15208](https://github.com/sgl-project/sglang/pull/15208)) and will be merged into the main branch shortly. The benchmarks in this blog were conducted on MiMo’s optimized branch, and the corresponding optimizations will be upstreamed into SGLang main in the near future. |
| 60 | + |
| 61 | +## Getting Started |
| 62 | + |
| 63 | +MiMo-V2-Flash is currently available in SGLang via Docker image and pip install. Please see the instructions below to launch the SGLang server and start using MiMo-V2-Flash. |
| 64 | + |
| 65 | +See Instructions below: |
| 66 | + |
| 67 | +<br> |
| 68 | + |
| 69 | +<details> |
| 70 | +<summary><span style="font-size: 1.3em; font-weight: bold;">Docker</span></summary> |
| 71 | + |
| 72 | +```bash |
| 73 | +# Pull the docker image |
| 74 | +docker pull lmsysorg/sglang:dev-pr-15207 |
| 75 | + |
| 76 | +# Launch the container |
| 77 | +docker run -it --gpus all \ |
| 78 | + --shm-size=32g \ |
| 79 | + --ipc=host \ |
| 80 | + --network=host \ |
| 81 | + lmsysorg/sglang:dev-pr-15207 bash |
| 82 | + |
| 83 | +# Start the server |
| 84 | +SGLANG_ENABLE_SPEC_V2=1 python3 -m sglang.launch_server \ |
| 85 | + --model-path XiaomiMiMo/MiMo-V2-Flash \ |
| 86 | + --dp-size 2 \ |
| 87 | + --enable-dp-attention \ |
| 88 | + --tp-size 8 \ |
| 89 | + --trust-remote-code \ |
| 90 | + --mem-fraction-static 0.75 \ |
| 91 | + --max-running-requests 128 \ |
| 92 | + --chunked-prefill-size 16384 \ |
| 93 | + --reasoning-parser qwen3 \ |
| 94 | + --tool-call-parser mimo \ |
| 95 | + --model-loader-extra-config '{"enable_multithread_load": "true","num_threads": 64}' \ |
| 96 | + --attention-backend fa3 \ |
| 97 | + --speculative-algorithm EAGLE \ |
| 98 | + --speculative-num-steps=3 \ |
| 99 | + --speculative-eagle-topk=1 \ |
| 100 | + --speculative-num-draft-tokens=4 \ |
| 101 | + --enable-mtp |
| 102 | +``` |
| 103 | + |
| 104 | +</details> |
| 105 | + |
| 106 | +<br> |
| 107 | + |
| 108 | +<details> |
| 109 | +<summary><span style="font-size: 1.3em; font-weight: bold;">Pip Installation</span></summary> |
| 110 | + |
| 111 | +```bash |
| 112 | +# On a machine with SGLang dependencies installed or inside a SGLang nightly container |
| 113 | +# Start an SGLang nightly container |
| 114 | +docker run -it --gpus all \ |
| 115 | + --shm-size=32g \ |
| 116 | + --ipc=host \ |
| 117 | + --network=host \ |
| 118 | + lmsysorg/sglang:nightly-dev-20251215-4449c170 bash |
| 119 | + |
| 120 | +# If you already have SGLang installed, uninstall the current SGLang version |
| 121 | +pip uninstall sglang -y |
| 122 | + |
| 123 | +# Install the PyPI Package |
| 124 | +pip install sglang==0.5.6.post2.dev7970+pr.15207.g62f95e0c6 \ |
| 125 | + --index-url https://sgl-project.github.io/whl/pr/ \ |
| 126 | + --extra-index-url https://pypi.org/simple |
| 127 | + |
| 128 | +#Launch the server |
| 129 | +SGLANG_ENABLE_SPEC_V2=1 python3 -m sglang.launch_server \ |
| 130 | + --model-path XiaomiMiMo/MiMo-V2-Flash \ |
| 131 | + --dp-size 2 \ |
| 132 | + --enable-dp-attention \ |
| 133 | + --tp-size 8 \ |
| 134 | + --trust-remote-code \ |
| 135 | + --mem-fraction-static 0.75 \ |
| 136 | + --max-running-requests 128 \ |
| 137 | + --chunked-prefill-size 16384 \ |
| 138 | + --reasoning-parser qwen3 \ |
| 139 | + --tool-call-parser mimo \ |
| 140 | + --model-loader-extra-config '{"enable_multithread_load": "true","num_threads": 64}' \ |
| 141 | + --attention-backend fa3 \ |
| 142 | + --speculative-algorithm EAGLE \ |
| 143 | + --speculative-num-steps=3 \ |
| 144 | + --speculative-eagle-topk=1 \ |
| 145 | + --speculative-num-draft-tokens=4 \ |
| 146 | + --enable-mtp |
| 147 | +``` |
| 148 | + |
| 149 | +</details> |
| 150 | + |
| 151 | +<br> |
| 152 | + |
| 153 | +<details> |
| 154 | +<summary><span style="font-size: 1.3em; font-weight: bold;">Testing the deployment</span></summary> |
| 155 | + |
| 156 | +Once the server is running, test it with a chat completion request in another terminal: |
| 157 | + |
| 158 | +```bash |
| 159 | +curl http://localhost:30000/v1/chat/completions \ |
| 160 | + -H "Content-Type: application/json" \ |
| 161 | + -d '{ |
| 162 | + "model": "XiaomiMiMo/MiMo-V2-Flash", |
| 163 | + "messages": [ |
| 164 | + {"role": "user", "content": "Hello! What can you help me with?"} |
| 165 | + ], |
| 166 | + "temperature": 0.7, |
| 167 | + "max_tokens": 100 |
| 168 | + }' |
| 169 | + |
| 170 | +``` |
| 171 | + |
| 172 | +**Expected response:** |
| 173 | + |
| 174 | +```json |
| 175 | +{ |
| 176 | + "id": "...", |
| 177 | + "object": "chat.completion", |
| 178 | + "model": "XiaomiMiMo/MiMo-V2-Flash", |
| 179 | + "choices": [{ |
| 180 | + "message": { |
| 181 | + "role": "assistant", |
| 182 | + "content": "Hello! I can help you with..." |
| 183 | + } |
| 184 | + }] |
| 185 | +} |
| 186 | +``` |
| 187 | + |
| 188 | +</details> |
| 189 | + |
| 190 | +<br> |
| 191 | + |
| 192 | +<details> |
| 193 | +<summary><span style="font-size: 1.3em; font-weight: bold;">Troubleshooting</span></summary> |
| 194 | + |
| 195 | +**DeepGEMM Timeout Error** |
| 196 | +Occasionally DeepGEMM timeout errors occur during first launch. Simply rerun the server command in the same container - the compiled kernels are cached and subsequent launches will be fast. |
| 197 | + |
| 198 | + |
| 199 | +</details> |
0 commit comments