NewsCrawler.org

3 Ways to Boost MoE Inference on NVIDIA DGX Spark

3 Ways to Boost MoE Inference on NVIDIA DGX Spark
Image: Reddit

Profiling Ling-3.0-flash from Inclusion AI on NVIDIA DGX Spark showed that batch-size-1 decoding was memory-bound, with the mixture-of-experts (MoE)[1] computation and the output-layer projection — the LM head[2] — dominating execution time. The evaluated model, Ling-3.0-flash-fp4, has 124 billion total parameters and 5.1 billion active per token across 42 layers: 35 Kimi Delta Attention linear-attention layers and seven multi-head latent attention layers, with each MoE layer routing each token to eight of 512 routed experts plus one shared expert. The baseline followed the official cookbook's W4A8 configuration — FlashInfer MXFP4 MoE kernels, NVIDIA CUTLASS dense GEMM, and the --enable-fp32-lm-head option — with the LM head projecting a hidden dimension of 2,560 to a vocabulary of 157,184 tokens.

The first optimization replaces the flashinfer_mxfp4 backend with Humming, an independent kernel library (humming-kernels on pip) that uses NVIDIA CUDA Runtime Compilation (NVRTC)[3] to compile CUBINs at runtime for the actual dimensions, data types, and GPU architecture, caching them in ~/.humming/cache and specializing kernels for the model's moe_intermediate_size of 768; a single kernel compiles in seconds, while the FlashInfer CUTLASS path builds 97 targets over tens of minutes. The second enables online FP8 quantization of the LM head via SGLANG_ENABLE_FP8_LM_HEAD=1, halving the weight-read volume for its 157,184 × 2,560 vocabulary GEMM; the setting is mutually exclusive with --enable-fp32-lm-head. The third is multi-token prediction (MTP) speculative decoding[4] with NEXTN, the model's built-in prediction layer that needs no extra training or downloads: the draft predicts three tokens per round and the target verifies four positions at once. The measured verification-cost ratio — the cost of one verification step relative to a normal decode step — was about 2.26, driven not by attention computation but by MoE expert activation: a normal decode activates eight experts for one token, while verification processes four tokens and can activate up to 32.

Combining FP8 LM-head quantization with MTP requires the draft model to share the entire LM-head module, not just its weight tensor; otherwise the framework silently falls back, the draft reads FP8 weights as BF16, accept length (the average number of accepted tokens per round) drops to 1.00, and throughput ends up lower than with no optimizations. Synthetic workloads overstate the benefits: accept length there was 3.90 versus 2.68 across all 1,319 GSM8K questions, and the 185.1% synthetic throughput gain does not establish the gain for other workloads; GSM8K median output is about 310 tokens against the fixed 2K of the synthetic test. Across the full GSM8K evaluation (five-shot prompting, temperature 0.6, top_p 0.95, top_k 29, max_tokens 32,768), the three optimizations raised decode throughput by 42.5%, cut mean end-to-end latency by 24.5%, and produced no statistically detectable accuracy change; the mechanisms do not overlap — Humming and the FP8 LM head reduce the cost of each step, while MTP reduces the number of steps.

Read the original developer.nvidia.comDiscussion

Sources

Published: First seen: Читать по-русски

Open as a page