Accelerating MiniMax-H3
SGLang Diffusion achieves a 6.24x speedup for MiniMax-H3 video generation by combining fused kernels, step reuse, and sub-block sparse attention.
Deep dive
- Lossless speedup reached 1.95x using optimized runtime and kernels.
- Cache-DiT reuses redundant denoising steps, providing the largest throughput gain.
- SubBlock sparse attention reduces the computational cost of the attention mechanism by routing top-k scores.
- Fused kernels (AdaLN, SwiGLU, QK-RMSNorm) reduce memory traffic for non-GEMM operations.
- Benchmarked across T2VA and FL2VA workloads at 1344×768 resolution.
Decoder
- SSIM (Structural Similarity Index Measure): A perceptual metric used to measure the similarity between two images or videos.
- Kernel: A low-level function that runs directly on the GPU to perform specific mathematical operations efficiently.
- GEMM: General Matrix Multiply, the core operation of transformer models; non-GEMM refers to auxiliary calculations.
Original article
MiniMax-H3 on 8×H200: 1.95× Lossless, Up to 6.24× at 0.76–0.91 SSIM
TL;DR
We benchmarked MiniMax-H3 video generation on 8× NVIDIA H200 with SGLang Diffusion, holding prompts, seeds, resolution, frame rate, and denoising steps fixed across six workloads.
- SGLang's dense, lossless path is 1.85–1.95× faster than Diffusers with no approximation: the same denoising work, on a faster runtime.
- Stacking step reuse and sparse attention reaches up to 6.24×, at 0.76–0.91 mean SSIM. The fastest tested profile, SubBlock 0.80 + Cache-DiT stride, delivers 5.06×/5.72× on 5 s/10 s T2VA and 5.86×/6.24× on FL2VA. The cost is not uniform: FL2VA holds 0.85–0.91 SSIM there, while T2VA drops to 0.76–0.78.
- For a quality-first default, use Cache-DiT alone (up to 2.99×, mean SSIM 0.90–0.92). For a balanced trade-off, SubBlock 0.75 + Cache-DiT stride gives 4.90–5.93× at SSIM 0.79–0.90.
- The gains come from three layers that compose: fused kernels, step reuse (Cache-DiT skips redundant denoising steps), and SubBlock sparse attention (NVIDIA's block-sparse forward, which cuts the cost of the steps that do run).
Background
While SGLang Diffusion already delivers a fast lossless path for MiniMax-H3, faster lossy generation of high-quality video has long been sought after by the community. Video diffusion is dominated by two costs: the denoising loop runs the same transformer dozens of times, and each step spends most of its budget in attention over a very long token sequence.
Three accelerations attack that from different directions, and they compose:
- Fused kernels cut the fixed cost of every step without changing its math.
- Cache-DiT reuses results between denoising steps, so some steps never run.
- SubBlock sparse attention reduces the cost of the steps that do run, by skipping attention blocks whose contribution is below a threshold.
Detailed Results
T2VA
| Mode | 5 s median / speedup | 10 s median / speedup | 5 s mean SSIM | 10 s mean SSIM |
|---|---|---|---|---|
| Diffusers | 74.34 s / 1.00× | 207.71 s / 1.00× | — | — |
| SGLang lossless | 39.67 s / 1.87× | 112.44 s / 1.85× | 1.0000 | 1.0000 |
| Cache-DiT conservative | 28.02 s / 2.65× | 78.28 s / 2.65× | 0.8986 | 0.9179 |
| SubBlock 0.75 | 30.90 s / 2.41× | 77.12 s / 2.69× | 0.8006 | 0.8301 |
| SubBlock 0.75 + Cache-DiT conservative | 21.41 s / 3.47× | 57.48 s / 3.61× | 0.7936 | 0.8288 |
| Cache-DiT stride | 18.13 s / 4.10× | 52.07 s / 3.99× | 0.8037 | 0.8078 |
| SubBlock 0.75 + Cache-DiT stride | 15.16 s / 4.90× | 38.21 s / 5.44× | 0.7713 | 0.7834 |
| SubBlock 0.80 | 29.49 s / 2.52× | 72.85 s / 2.85× | 0.7858 | 0.8193 |
| SubBlock 0.80 + Cache-DiT stride | 14.68 s / 5.06× | 36.29 s / 5.72× | 0.7584 | 0.7765 |
FL2VA
| Mode | 5 s median / speedup | 10 s median / speedup | 5 s mean SSIM | 10 s mean SSIM |
|---|---|---|---|---|
| Diffusers | 80.44 s / 1.00× | 217.31 s / 1.00× | — | — |
| SGLang lossless | 41.31 s / 1.95× | 114.02 s / 1.91× | 1.0000 | 1.0000 |
| Cache-DiT conservative | 26.90 s / 2.99× | 78.24 s / 2.78× | 0.9389 | 0.9771 |
| SubBlock 0.75 | 31.27 s / 2.57× | 76.95 s / 2.82× | 0.8946 | 0.9385 |
| SubBlock 0.75 + Cache-DiT conservative | 20.64 s / 3.90× | 56.39 s / 3.85× | 0.8924 | 0.9414 |
| Cache-DiT stride | 18.02 s / 4.46× | 51.31 s / 4.24× | 0.8903 | 0.9248 |
| SubBlock 0.75 + Cache-DiT stride | 14.27 s / 5.64× | 36.62 s / 5.93× | 0.8629 | 0.9202 |
| SubBlock 0.80 | 29.74 s / 2.71× | 72.44 s / 3.00× | 0.8837 | 0.9350 |
| SubBlock 0.80 + Cache-DiT stride | 13.73 s / 5.86× | 34.80 s / 6.24× | 0.8498 | 0.9144 |
Where the Speedup Comes From
Fused kernels reduce the cost of each step that still runs. The H3 path fuses indexed AdaLN updates, gated residuals, SwiGLU activation, and QK RMSNorm with 3D RoPE.
Cache-DiT attaches one DBCache context to MiniMax-H3's shared DiT block stack. After the warmup steps, it evaluates the configured boundary blocks and compares the normalized residual change with the previous cached state. All cache modes use Fn=1, Bn=0, and four warmup steps.
SubBlock sparse attention reduces the KV blocks read on computed steps. It uses n_k=n_q=4; the first ten denoising steps use dense attention, and SubBlock is enabled afterward. The minimum sequence length is 4096.
The Kernel Layer
| Operator | Eager composition | SGLang kernel | Speedup |
|---|---|---|---|
| AdaLN modulation (indexed scale-shift) | 136.7 μs | 38.2 μs | 3.58× |
| AdaLN gated residual (indexed) | 93.2 μs | 46.6 μs | 2.00× |
| SwiGLU activation (in place) | 364.5 μs | 105.2 μs | 3.46× |
| QK RMSNorm | 334.0 μs | 76.9 μs | 4.35× |
| QK RMSNorm + 3D RoPE, one kernel | 1335.6 μs | 109.8 μs | 12.16× |
How SubBlock Sparse Attention Works
SubBlock is a training-free router for block-sparse attention. It divides the sequence into 64-token query and key blocks, then splits each block into four 16-token sub-blocks on both sides. A lightweight pooling and log-sum-exp score estimates each key block's unnormalized softmax mass for each query block and head. The router keeps the highest-scoring key blocks and passes their indices to the block-sparse attention kernel.
Acknowledgement
- SGLang Diffusion Team — wrote the first version of this post, drives the SGLang kernel work these results build on, and provides the diffusion runtime, the fused kernels, and the parallelism measured here.
- Ji Huang (@IPostYellow), Ant Group — ran the H200 benchmark, brought SubBlock sparse attention into SGLang Diffusion, and revised this post.
- Cache-DiT Team — @DefTruth and the vipshop.com team, for Cache-DiT and for support integrating its cache profiles into SGLang Diffusion.
- MiniMax — for open-sourcing MiniMax-H3, the model every measurement here runs on.
- NVIDIA — for the underlying SubBlock sparse attention support, including the block-sparse attention forward these results depend on.
Fresh dev news, AI-digested daily. Never miss a trend at devoured.fyi