feat(qwen4_exp): support Qwen3.8-Flash-Next - #257
Conversation
Serve Qwen3.8-Flash-Next (HF model_type qwen4_exp) text-only: 36 GDN + 12 QSA compressed-sparse attention layers on 4 hyper-connection residual streams, a PLE n-gram embedding layer backed by a 47.7 GiB pinned-host table with UVA gather, and 512 NVFP4 / block-fp8 routed experts (top-10) plus a gated shared expert. - attention: qsa_sparse backend (AttnType.QSA) over QSAKVCache -- paged GQA K/V, a 1/ratio compressed index-key slab shadowing the KV pages, and a per-request pending ring sized from index_ratio - kvcache: declarative slot-sibling states (ModelConfig.slot_states) on LinearStatePool carry the PLE conv history and n-gram context through the hybrid-radix snapshot/COW lifecycle - scheduler: hybrid prefill chunks align to the page size so snapshots land on donatable boundaries - kernels: triton kernels adapted from vLLM/SGLang (hc, qsa, ple gather, moe router / shared gate) plus an original radix block top-k; int64 row addressing throughout - moe: non-power-of-2 top-k router, deep-K marlin decode config, one fp8 scale-bank padding rule shared with the AOT row table - engine: the PLE table load reserves its pinned bytes from the pin budget before the expert banks plan their residency
A100 80 GB / sm_80 result (official FP8 checkpoint)I tested this PR at The pre-sm_89 software-E4M3 path works. The PR's sm_80 compile gate passed unchanged, the server initialized, and no Ampere source patch was needed. Command was the documented route plus observability flags: OMP_NUM_THREADS=16 MKL_NUM_THREADS=16 OPENBLAS_NUM_THREADS=16 NUMEXPR_NUM_THREADS=16 \
ft serve --model /workspace/models/Qwen3.8-Flash-Next-FP8 \
--moe-backend offload --moe-cache-auto \
--max-running-requests 1 --kv-reserve-tokens 50000Cache auto selected 12,949 expert slots. Each measured request was greedy (
Mean decode was 68.30 tok/s (67.60–69.33). That is +3.30 tok/s / +5.08% over the README's 65 tok/s RTX 5090 number. FreeToken's engine-side steady decode counter ended around 70 tok/s. Correctness outputsAll four remained coherent and on-topic. In particular, there was no multilingual/repetitive degeneration at 2.7k or 6.5k prompt tokens. Full measured text is pasted below; every sample stops mid-answer because it hit the configured 511-token length cap. 130 prompt tokens — coherent
700 prompt tokens — coherent
2,701 prompt tokens — coherent
6,500 prompt tokens — coherent
MemoryPeak The exact CUDA-registered host banks for the official block-FP8 checkpoint are about 160.20 GiB, not ~111 GiB:
The smaller ~63 GiB expert-bank estimate applies to NVFP4, not the required official FP8 checkpoint. Reproducible loader oversubscription issueOne non-sm_80 issue was substantial on this RunPod host. The container saw CPUs 0–127, while cgroup
With the |
|
@jason-fxz Great work! |
|
Follow-up A100 optimization result (separate NVFP4 experiment, not a replacement for the official-FP8 number above): With I tested a small opt-in fast path that preloads a deterministic contiguous 512-expert slice per layer, gives the existing native-NVFP4 kernel that slice with unchanged layer-local expert IDs, and bypasses LRU/copy/prefill-buffer machinery. Greedy 511-token generations were byte-for-byte identical to the unmodified path at 130, 700, 2,701, and 6,500 prompt tokens (matching SHA-256 at every length; all coherent).
That is +6.84% mean, with the long-context steady gain at +4.4–5.0%. Peak VRAM was 79,637 MiB, so this is specifically useful when the entire expert bank genuinely fits. The prototype is environment-gated, validates full-cache/native-NVFP4/GPU/pinned-bank conditions, and disables the prefill buffers that would otherwise overwrite the first two fixed slices. I have the tested patch and full four-length outputs saved and can submit it as a focused PR with unit coverage if this full-residency mode fits the project's direction. |
What
Support Qwen3.8-Flash-Next (
qwen4_exp), text-only.Model structure:
Engine support:
How to run
# bs=1, 50k tokens reserved for KV, rest of VRAM to the expert cache ft serve --model RadixArk/Qwen3.8-Flash-Next-NVFP4 \ --moe-backend offload --moe-cache-auto \ --max-running-requests 1 --kv-reserve-tokens 50000Performance
bs=1 decode, AIME25, with the command above. Host RAM: ~111 GiB pinned (63 GiB NVFP4 expert banks + 48 GiB PLE table), 128 GB recommended.