README проекта с github.com/MiaAI-Lab/Qwen3.8-Flash-Next-Dual-DGX-Sparks. Одним файлом markdown: README.md.
by Mia'a AI Lab
Multi-node inference for nvidia/Qwen3.8-Flash-Next-NVFP4 across 2 DGX Sparks using vLLM with TP2+EP+MTP3.
local-inference-lab and
RadixArk builds are also supported —
see MODEL_ID in .env.sample.
Based on getrefined/Qwen3.8-Flash-Next-NVFP4-vLLM-DGX-Spark.
All numbers in KV cache budget and Default runtime below were read from the running
server (docker logs vllm-fn, docker inspect vllm-fn) — they are measurements, not estimates.
That container runs GPU_MEMORY_UTILIZATION=0.835, the value .env.sample shipped until 2026-09-26 (now 0.80, see CHANGELOG).
; start.sh` rsyncs the worker copy from the head once. Enable NFS weight sharing to skip the worker copy entirely.# 1. Edit .env (set IPs, interface, IB HCA, etc.)
cp .env.sample .env
vim .env
# 2. Download weights onto the head
./download.sh
# ./download.sh --fp8 # official FP8 instead
# ABLIT=1 ./download.sh # gated Keys house QSA L3-47 (HF_TOKEN + accept terms)
# 3. Sync to worker, apply patches, launch (NVFP4)
./start.sh --no-download
# or ./start.sh if you want start.sh to download as well
# or ./start.sh --nfs to share the head cache over NFS instead of rsyncing
# or ABLIT=1 ./start.sh --no-download
# Optional — official FP8 instead of NVFP4 (see below):
# ./download.sh --fp8 && ./start-fp8.sh --no-download
# 4. Confirm the KV cache pool that vLLM actually allocated (~11 min after launch)
docker logs vllm-fn 2>&1 | grep -E "Available KV cache memory|GPU KV cache size"
./start.sh and ./start-fp8.sh both launch containers named vllm-fn on the same port — stop first with ./stop.sh before switching checkpoints.
| Flag | Description |
|---|---|
--no-download |
Skip HF download (weights already in the head cache) |
--no-launch |
Download + distribute weights only, don't start the server |
--launch |
Skip download + sync; apply patches and launch (weights already on both nodes) |
--nfs |
Distribute weights over NFS instead of rsync (see below) |
--no-nfs |
Force rsync distribution even if NFS_SHARE=true in .env |
ABLIT=1 |
Env/.env flag: serve the gated Keys house QSA L3–47 checkpoint (see Abliterated checkpoint) |
./start-v030.sh runs the same two-node launch on stock vllm/vllm-openai:v0.30.0.
Both nodes need the image. The worker has no internet here, so copy the image
over the CX7 link: docker save vllm/vllm-openai:v0.30.0 | ssh <worker> docker load.
docker pull vllm/vllm-openai:v0.30.0
./stop.sh
./start-v030.sh --launch
VLLM_USE_BREAKABLE_CUDAGRAPH
on for this model; on GB10 that made decode vary 10-18% between identical
runs and lose 13-19% at S>=2. The lane sets it to 0
(V030_BREAKABLE_CUDAGRAPH=1 restores the upstream default).OVERRIDE_KV_CACHE_DTYPE=fp8 ./start-v030.sh --launch gives 2.64M tokens
through a backport of vllm#55557 (files/patch_qsa_fp8_kv_v030.py, delete it
once the image is vLLM 0.31+), at about 5% slower decode.files/patch_mtp_draft_vocab_v030.py), plus the FP8 backport when enabled.FP8_DENSE, QSA_PROFILE, the
determinism knobs.Same two-Spark launch as ./start.sh, but serve
Qwen/Qwen3.8-Flash-Next-FP8
instead of NVFP4. Cluster IPs, TP/EP/MTP, image and ports still come from .env.
Context is native 262K with YaRN off — FP8 weights leave too little KV for 1M
on this kit. Available KV cache is around 500k tokens, not the 3.65M of
the nvidia NVFP4 checkpoint with KV_CACHE_DTYPE=fp8.
./download.sh --fp8
./stop.sh # start.sh and start-fp8.sh share vllm-fn
./start-fp8.sh --no-download
# API name: qwen3.8-flash-next-fp8
This is not FP8_DENSE=true (hybrid NVFP4 experts + FP8 dense projections)
and not fp8 KV on stock NVFP4. ABLIT=1 is ignored when ./start-fp8.sh
sets OVERRIDE_MODEL_ID.
./download.sh pulls MODEL_ID from .env (stock NVFP4) to the head HF cache (./download.sh --fp8 for official FP8; ABLIT=1 ./download.sh for the gated Keys house checkpoint).rsync copies the checkpoint into the worker's own ~/.cache/huggingface/hub over the ConnectX link, skipped when the worker already has it. With NFS_SHARE=true / --nfs this is replaced by the NFS share.vllm/vllm-openai:qwen38-flash-next is on both nodesple_layer.py from the image and patches it into files/ple_layer_patched.py (no image rebuild; bind-mounted at runtime)modelopt.py and patches it into files/modelopt_patched.py, routing the MXFP8 shapes FlashInfer's mm_mxfp8 cannot run to the BF16 emulation kernel (also bind-mounted)REQUIRE_IDLE_GPU=false to override); prepares the FP8_DENSE / QSA_PROFILE bind-mounts:8888. Both launch
scripts render the same VLLM_ARGS array (EXTRA_VLLM_ARGS really is appended last now;
ENABLE_EXPERT_PARALLEL=false and MTP_NUM_SPECULATIVE_TOKENS=0 are honored). The head's
rendered script is kept as .last_head_launch.sh for inspection.Page cache. On GB10 the page cache shares one unified-memory pool with the model, so a checkpoint left resident from a download, an rsync or a previous launch can push weight loading into a
CUDA out of memoryon an otherwise idle box (see Gotchas).
start.shnow releases the checkpoint's own clean pages on both nodes before launching, viaposix_fadvise(POSIX_FADV_DONTNEED)(files/evict_page_cache.py). That needs no root, and touches only this checkpoint. Measured: 4.15 GiB → 0.00 GiB resident for a single shard, byte -identical on re-read. SetEVICT_PAGE_CACHE=falseto skip it.Both nodes are covered in both distribution modes. Under
NFS_SHARE=falsethe worker's copy is evicted over ssh; underNFS_SHARE=truethe worker has no local copy — its pages are NFS client cache, so the pass runs inside a throwaway container holding the same volume.fadviseevicts over NFS 4.2 exactly as it does locally (measured 3.00 GiB → 0.00 GiB resident).It does not drop the system-wide cache — that still needs root, and is still worth doing yourself if something other than the checkpoint has filled it:
sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
Both containers are named vllm-fn (head and worker); ./stop.sh removes both.
Off by default. By default each node keeps its own copy of the checkpoint in
~/.cache/huggingface, and start.sh rsyncs the worker's copy from the head once (subsequent
launches detect it and skip the transfer). That costs ~126 GiB on the worker and one long copy the
first time, but the worker is then self-sufficient.
Turn NFS sharing on to skip the worker copy entirely — the head exports its HF cache and the worker mounts it read-only:
NFS_SHARE=true ./start.sh --launch # or set NFS_SHARE=true in .env
./start.sh --nfs # same, per-run flag
./start.sh --no-nfs # force rsync even with NFS_SHARE=true in .env
A privileged vllm-fn-nfs container on the head exports $HF_CACHE_DIR over NFSv4 on the ConnectX
address (NFS_SERVER_IP, auto-detected from IFACE — do not use the 10.0.0.1 loopback
alias). The worker Docker volume vllm-fn-hf mounts it read-only at /root/.cache/huggingface.
| rsync (default) | NFS_SHARE=true |
|
|---|---|---|
| Worker disk | ~126 GiB | none |
| First launch | one full copy, then free | no copy |
| Every cold start | reads local disk | streams ~126 GiB over ConnectX |
| Head must stay up | only to launch | for the whole serving run |
| Failure mode | worker cache goes stale silently | share dies → worker loses its weights |
Prefer NFS when worker disk is tight or you re-pull checkpoints often; prefer the default when you want the two nodes decoupled. Switching checkpoints is where NFS earns its keep — no re-sync.
Notes when it is on:
./stop.sh leaves the share up so the next --launch does not rebuild it; ./stop.sh --nfs
tears it down and removes the worker volume. Kernel NFS in Docker can ignore SIGKILL when
rpcbind is in D-state, so that path has a 15 s timeout and reports if the container survives.vllm-fn-nfs while vLLM is loading or running — the worker reads shards from it../check-weights.sh follows NFS_SHARE: it verifies the worker's local copy by default, or the
NFS volume when sharing is on.sample = value in .env.sample · live = value in the .env on this box, which produced
every measurement in this README.
| Variable | sample | live | Description |
|---|---|---|---|
HEAD_IP |
10.0.0.1 |
10.0.0.1 |
Head node inter-node IP |
WORKER_IP |
10.0.0.2 |
10.0.0.2 |
Worker node inter-node IP |
WORKER_USER |
(empty) | zurih |
SSH user on worker (blank = same user) |
IFACE |
enp1s0f0np0 |
enp1s0f1np1 |
Head-side inter-node interface |
WORKER_IFACE |
(unset → IFACE) |
enp1s0f0np0 |
Worker-side interface (nodes are cross-wired) |
IB_HCA |
=rocep1s0f0 |
=rocep1s0f1 |
NCCL IB HCA (leading = = exact match, one device) |
WORKER_IB_HCA |
(unset → IB_HCA) |
=rocep1s0f0 |
Worker-side HCA (cross-wired link) |
IB_GID_INDEX |
3 |
3 |
IB GID index (3 for ConnectX + RoCE) |
MODEL_ID |
nvidia/Qwen3.8-Flash-Next-NVFP4 |
same | HuggingFace model when ABLIT=0 (the snapshot in the head cache) |
ABLIT |
0 |
0 |
0 = stock MODEL_ID. 1 = gated Keys house QSA o_proj L3–47 (drowzeys/keys-Qwen3.8-Flash-Next-NVFP4-dual-ablit-house-qsa-L3-47). Environment wins over .env for this flag. See Abliterated checkpoint |
FP8_DENSE |
false |
false |
true → serve the hybrid NVFP4+FP8-dense checkpoint with the files/overlay loader patches (see below) |
QSA_PROFILE |
stock |
stock |
gb10 or a JSON from files/qsa_gb10/bench_qsa_kernels.py |
REQUIRE_IDLE_GPU |
true |
true |
abort if nvidia-smi shows a compute process on either node |
SERVED_MODEL_NAME |
qwen3.8-flash-next |
same | Name in /v1/models |
MAX_MODEL_LEN |
1000000 |
1000000 |
Context length (262144 = native, no YaRN) |
YARN_ENABLE |
true |
true |
Extend context via YaRN rope scaling — auto force-disabled when MAX_MODEL_LEN ≤ 262144 |
YARN_FACTOR |
4.0 |
4.0 |
262144 × 4.0 ≈ 1M |
GPU_MEMORY_UTILIZATION |
0.80 |
0.835 |
Fraction of the 121.69 GiB budgeted by vLLM (see KV cache budget) |
MAX_NUM_SEQS |
8 |
8 |
Max concurrent sequences |
MAX_NUM_BATCHED_TOKENS |
8192 |
8192 |
Prefill chunk / cudagraph ceiling |
PORT |
8888 |
8888 |
API server port (--network host) |
KV_CACHE_DTYPE |
fp8 |
fp8 |
Default. 3.65M cache tokens (13.93× at 262K) via files/patch_qsa_fp8_kv.py, applied automatically. auto = bf16 = 2.13M (8.13×) |
TENSOR_PARALLEL_SIZE |
2 |
2 |
1 GB10 per node × 2 nodes |
ENABLE_EXPERT_PARALLEL |
true |
true |
EP for the NVFP4 experts (required) |
MTP_NUM_SPECULATIVE_TOKENS |
3 |
3 |
MTP draft tokens (0 = disable) |
MTP_DISABLE_BLOCK_DROP |
1 |
(new) | Keep the last prefix-cache block per turn (vllm#53388 backport). Fixes the zero-hit second turn (#62): turn 1 TTFT 3.25 → 0.63 s on 9.5k (median of 3). See CHANGELOG 2026-09-25 |
MTP_INDEX_SHARE |
true |
(new) | Reuse the QSA top-k across MTP draft steps. Code decode +6% (S=1) to +27% (S=8), prose within noise |
VLLM_QSA_DET_TOPK / VLLM_MOE_DET_FINALIZE |
unset | (new) | 1 + 1 = bit-identical greedy output across TP2+EP; about −4% prose decode and prefill |
PLE_OFFLOAD |
false |
false |
true → CPU-RAM offload of the 51 GB PLE table (see gotcha) |
IMAGE |
vllm/vllm-openai:qwen38-flash-next |
same | Day-0 image |
VLLM_ALLOW_LONG_MAX_MODEL_LEN |
1 |
1 |
Required when MAX_MODEL_LEN > 262144 |
MASTER_PORT |
50000 |
50000 |
Distributed coordination port |
NFS_SHARE |
false |
false |
true → share the head HF cache over NFS instead of rsyncing a worker copy (details) |
NFS_SERVER_IP |
(unset → IFACE IPv4) |
(unset → 10.0.22.1) |
Head ConnectX address that exports the HF cache. Only used when NFS_SHARE=true. Do not use the 10.0.0.1 loopback alias |
EXTRA_VLLM_ARGS / EXTRA_DOCKER_ARGS |
unset | unset | Escape hatches (EXTRA_VLLM_ARGS is appended last) |
HF_TOKEN |
unset | unset | Required for ABLIT=1 (gated Hugging Face repo). Environment wins over .env |
KV cache dtype: the default is now
fp8, which needsfiles/patch_qsa_fp8_kv.py— the stock QSA kernels declaresupported_kv_cache_dtypes = ["auto", "bfloat16"]and raiseQwen3.8-Flash-Next QSA requires a BF16 main KV cacheotherwise.start.shapplies the patch automatically wheneverKV_CACHE_DTYPEstarts withfp8. SetKV_CACHE_DTYPE=autofor bf16. See KV cache budget for both measured sets.
ABLIT)ABLIT=0 serves stock MODEL_ID (nvidia NVFP4 by default). ABLIT=1 serves the gated
Keys checkpoint
drowzeys/keys-Qwen3.8-Flash-Next-NVFP4-dual-ablit-house-qsa-L3-47:
the same nvidia dual-Spark NVFP4 layout with a house residual-writer projection on 12 QSA
self_attn.o_proj tensors at layers 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43 and 47. GDN
out_proj, routed experts, MTP, PLE, vision and the chat template stay stock. It is valid
only on this recipe — do not use it with the single-Spark MXFP8 tree, official FP8, or
FP8_DENSE=true. ./start-fp8.sh and FP8_DENSE=true still win if you set them, and
ABLIT=1 is ignored for checkpoint selection in those cases.
That Hugging Face repo is gated. ABLIT=1 ./download.sh fails immediately if
HF_TOKEN is unset and prints the steps below. Set the token, Accept the terms on that
page, then download the full snapshot (same nvidia NVFP4 size class, ~133 GiB). Stock
and ablit caches sit side by side; flipping ABLIT is the only switch. start.sh rsyncs
whichever checkpoint ABLIT selected onto the worker (or shares it over NFS). An interrupted
download is not treated as ready — rerun ABLIT=1 ./download.sh to resume.
# 1. In .env: set ABLIT=1 and uncomment HF_TOKEN (or export both for this shell)
# 2. In the browser, accept the terms on:
# https://huggingface.co/drowzeys/keys-Qwen3.8-Flash-Next-NVFP4-dual-ablit-house-qsa-L3-47
HF_TOKEN=hf_... ABLIT=1 ./download.sh
ABLIT=1 ./start.sh
HF_TOKEN is required for ABLIT=1. A 403 means access has not been granted yet —
Accept the terms on that page, then retry with HF_TOKEN set. Unlike most knobs in
this launcher, ABLIT and HF_TOKEN honour the environment over .env, so
ABLIT=1 ./start.sh works even when .env still has ABLIT=0. Switch back with
ABLIT=0 ./start.sh (stock MODEL_ID; no re-download if that cache is already complete).
The gate is a binding agreement, not a download button. The checkpoint ships its own
responsible-use terms, and requesting access means accepting them. In summary: you must be
18 or older; you are accountable for harm from generated recipes or knowledge; and the
terms prohibit sexual content involving minors, material promoting self-harm or suicide,
harassment, doxxing or fraud targeting real people, anything illegal in your jurisdiction,
and any use barred by the NVIDIA Open Model License or the Qwen Community License 1.0.
The weights are provided as-is with no warranty and inherit their licence from
nvidia/Qwen3.8-Flash-Next-NVFP4. Read the repo's own terms before requesting access —
this paragraph is a summary, and those terms are what bind.
Safety refusals are removed in this checkpoint, which moves the guardrails onto you:
filtering, human review and access control are yours to supply. That matters more here
than on stock, because start.sh binds the server to 0.0.0.0 — anything that can reach
the port can reach an unfiltered model.
The abliteration splice is by Keys (drowzeys), a house projection on NVIDIA stock (axis recovered per QSA layer from Dealign, not a Dealign weight dump). See the checkpoint's model card, and Credits below.
The Keys config.json mislabels MTP routed experts as FP8_PB_WO; nvidia and
this snapshot's own hf_quant_config.json record FP8_BLOCK_SCALES (same 128×128
tensors). start.sh rewrites that overlay the same way it adds the mtp.layers.48
alias, so MTP 3 still works.
Measured on the running container at the shipped defaults (KV_CACHE_DTYPE=fp8,
GPU_MEMORY_UTILIZATION=0.835, MAX_MODEL_LEN=262144, MTP3, TP2, nvidia NVFP4 checkpoint).
Official FP8 (./start-fp8.sh) is a different checkpoint — see
Official FP8 checkpoint; its available KV
cache is around 500k tokens, not the 3.65M below.
[gpu_worker.py:693] Available KV cache memory: 32.02 GiB
[kv_cache_utils.py] GPU KV cache size: 3,652,200 tokens,
Maximum concurrency for 262,144 tokens per request: 13.93x
FP8 vs bf16 on this kit, same GMU, same checkpoint, KV dtype the only change:
auto (bf16) |
fp8 (default) |
|
|---|---|---|
| KV pool | 31.7 GiB | 32.02 GiB |
| Cache size | 2,131,159 tok | 3,652,200 tok |
| Concurrency at 262,144 | 8.13× | 13.93× |
| Tokens per GiB | 67,229 | 114,060 (1.70×) |
| Reasoning + needle suite | 12/12 | 12/12 (no regressions) |
1.70×, not 2×, because the QSA indexer and compressor stay BF16 — only the main K/V halve. A 1M-token context now fits 3.5× over. Weights (68.52 GiB/GPU), not KV, are the binding constraint on this box.
Credit. The FP8-KV kernel work in
files/patch_qsa_fp8_kv.pyis vendored from MiaAI-Lab/Qwen3.8-Flash-Next-Single-DGX-Spark (AGPL-3.0-or-later), which credits the underlying approach to lancelind/qwen3.8-Flash-DGX (Apache-2.0). Applied here unchanged — every anchor matched this image's QSA sources.
How to read those two lines. They are the same number in two units: 32.02 GiB is the byte budget, 3,652,200 tokens is what fits in it (~9.2 KB/token at fp8). The token figure is the capacity of the whole block pool, shared by every concurrent request — it is not per-request, and it is not summed over TP (TP2 shards each token across both GPUs, so ~64 GiB of VRAM is committed while the usable token space is 3.65M once). The third figure is the practical one: 13.93× = 13.93 resident requests at the full 262,144 context — more than
MAX_NUM_SEQS=8can even admit, so at these defaults the scheduler, not the cache, is the limit. At a 1M-token context (YaRN) the same pool is 3.5×.
Per-GPU memory accounting (GB10, per node — from gpu_worker.py:919):
| Line | GiB |
|---|---|
| Total memory visible to CUDA | 121.69 |
| Free at startup | 108.79 |
| Budgeted at GMU 0.835 | 101.61 |
Weights (model_runner.py:407) |
64.46 |
| Weights + non-torch | 68.52 |
| Peak activation | 1.07 |
| CUDA graphs | 0.54 |
| KV cache | 32.02 |
vLLM reports headroom for --kv-cache-memory=41360080896 (38.52 GiB) if you want to push
GMU higher.
The nvidia checkpoint is 124 GiB on disk / 11 shards (NVFP4 experts, FP8 PLE n-gram table ≈ 51 GB, bf16 attention/dense/vision). With EP + TP the per-GPU weight footprint lands at 64.46 GiB — roughly experts 34 GB + PLE shard ~25 GB + bf16 dense ~10 GB. Weights, not KV, are what eats this box, and that is more true at fp8 than it was at bf16.
Why the cache is so cheap: of the 48 layers only every 4th is full_attention
(full_attention_interval: 4) → 12 KV-bearing layers + 1 MTP draft layer = 13. The other
36 are Gated-DeltaNet linear attention: constant-size recurrent state per request, not per
token. With num_key_value_heads: 2, head_dim: 256:
13 layers × 2 (K,V) × 2 kv_heads × 256 × 2 B (bf16) = 26,624 B/token (= 13,312 B/GPU at TP2)
13 layers × 2 (K,V) × 2 kv_heads × 256 × 1 B (fp8) = 13,312 B/token (= 6,656 B/GPU at TP2)
At fp8 vLLM reports 32.02 GiB / 3,652,200 tokens = 9,418 B/token/GPU, ~41% above the pure attention figure (bf16 was 15,192 B/token/GPU, ~14% above). The overhead grows in relative terms precisely because the attention half halved while the rest did not: the 36 GDN layers' state and the sparse-attention (QSA) index state stay BF16, which is why the pool expands 1.70× rather than 2×. Rounding is forced: vLLM sets the attention block size to 1600 tokens so the attention page size matches (and never falls below) the Mamba/GDN page size.
| Config | KV pool | Cache tokens | 1M-ctx concurrency | 262K-ctx concurrency |
|---|---|---|---|---|
| fp8 KV, GMU 0.835 — measured (shipped default, running now) | 32.02 GiB | 3,652,200 | 3.65× | 13.93× |
| bf16 KV, GMU 0.835 — measured (same container, dtype only change) | 31.70 GiB | 2,131,159 | 2.13× | 8.13× |
fp8 KV, --kv-cache-memory=41360080896 (38.52 GiB, log-suggested) |
38.52 GiB | ≈ 4.39M | ≈ 4.4× | ≈ 16.8× |
| bf16 KV, GMU 0.85 — measured (older container, older checkpoint) | 36.35 GiB | 2,572,755 | 2.57× | 9.8× |
There is headroom at 0.835 — the startup log says so explicitly:
Replace gpu_memory_utilization config with `--kv-cache-memory=33651431445` (31.34 GiB) to fit
into requested memory, or `--kv-cache-memory=41360080896` (38.52 GiB) to fully utilize gpu memory.
Current kv cache memory in use is 32.02 GiB.
So ~6.5 GiB (≈ +740k fp8 cache tokens) is sitting unused; the 31.34 GiB "strict fit" figure is
just vLLM recomputing the 0.835 budget from its own profiling deltas — the pool ended up
~0.7 GiB larger than that. At 13.93× against MAX_NUM_SEQS=8 there is little reason to chase
it: the scheduler admits fewer requests than the cache can already hold.
The default
.envis oversubscribed.MAX_MODEL_LEN=1000000×MAX_NUM_SEQS=8asks for 8M cache tokens; the pool holds 2.48M. That is fine — vLLM preempts/evicts rather than OOM — but only ~2 concurrent 1M requests stay resident, and the 3rd+ gets preempted and re-prefilled. Pick one of:
Goal Settings Result Deep-context, sequential MAX_MODEL_LEN=1000000MAX_NUM_SEQS=2matches bf16 pool, no thrash 1M + more concurrency MAX_MODEL_LEN=1000000EXTRA_VLLM_ARGS="--kv-cache-memory=45502283776"MAX_NUM_SEQS=3≈ 3 resident (42.38 GiB → ≈ 3.0M tokens) Throughput / agentic MAX_MODEL_LEN=262144YARN_ENABLE=falseMAX_NUM_SEQS=88 resident, ~15% headroom (8 of 9.5 possible), no YaRN accuracy risk Middle ground MAX_MODEL_LEN=512000MAX_NUM_SEQS=4≈ 4 resident at full 512K (2.48M bf16 pool)
Live occupancy / re-check after any change:
docker logs vllm-fn 2>&1 | grep -E "Available KV cache|GPU KV cache size|Free memory on device"
curl -s localhost:8888/metrics | grep -i "kv_cache_usage\|preemption"
vLLM also prints its own arithmetic on startup — the Free memory on device line suggests exact
--kv-cache-memory=<bytes> values (quoted above). start.sh always emits
--gpu-memory-utilization (and validates it as required), so prefer GPU_MEMORY_UTILIZATION for
headroom control; EXTRA_VLLM_ARGS is appended last if you want --kv-cache-memory. Rough rule
of thumb for extrapolating: 1 GiB of KV pool ≈ 71–74K tokens ≈ +0.07× at 1M ctx — from the
measured 15,192 B/token, and from the 0.835 → 0.85 delta (+1.24 GiB → +91,331 tokens). Block/page
rounding in the hybrid allocator means it is ±5%, not exact.
docker inspect vllm-fn on the head:
vllm serve nvidia/Qwen3.8-Flash-Next-NVFP4 \
--served-model-name qwen3.8-flash-next \
--tensor-parallel-size 2 --nnodes 2 --node-rank 0 \
--master-addr 10.0.0.1 --master-port 50000 \
--distributed-executor-backend mp \
--enable-expert-parallel --all2all-backend allgather_reducescatter \
--gpu-memory-utilization 0.835 --max-num-seqs 8 --max-num-batched-tokens 8192 \
--max-model-len 1000000 --kv-cache-dtype auto \
--load-format safetensors --safetensors-load-strategy lazy \
--enable-chunked-prefill --reasoning-parser qwen3 \
--enable-auto-tool-choice --tool-call-parser qwen3_coder \
--speculative-config '{"method":"mtp","num_speculative_tokens":3}' \
--compilation-config '{"mode":0,"cudagraph_mode":"FULL_DECODE_ONLY"}' \
--hf-overrides '{"rope_parameters":{"rope_type":"yarn","factor":4.0,
"original_max_position_embeddings":262144}}' \
--host 0.0.0.0 --port 8888
As measured from the running container (--gpu-memory-utilization 0.835, the shipped default —
see KV cache budget for what that buys in tokens).
Container: vllm/vllm-openai:qwen38-flash-next (sha256:d464f3b4…, ~20.6 GB, NVIDIA dev build),
--gpus all --network host --ipc host, --cap-add SYS_NICE, memlock=-1,
--device /dev/infiniband, --restart unset (die-on-crash).
Env injected by start.sh: PLE_QUANT_OVERRIDE=fp8, HF_HUB_OFFLINE=1, TRANSFORMERS_OFFLINE=1,
VLLM_ALLOW_LONG_MAX_MODEL_LEN=1, NCCL_IB_HCA/NCCL_IB_GID_INDEX/NCCL_IB_DISABLE=0,
{GLOO,NCCL,TP}_SOCKET_IFNAME=$IFACE, NCCL_DEBUG=WARN.
Mounts: patched ple_layer.py → /usr/local/lib/python3.12/dist-packages/vllm/models/qwen3_8_flash_next/nvidia/ple_layer.py:ro,
patched modelopt.py → …/vllm/model_executor/layers/quantization/modelopt.py:ro,
$HOME/.cache/vllm → /root/.cache/vllm on each node. HuggingFace cache: head bind-mounts
$HF_CACHE_DIR; the worker bind-mounts its own ~/.cache/huggingface by default, or the NFS
volume vllm-fn-hf read-only when NFS_SHARE=true.
Container runs as root — the mount target must be /root, or offline HF lookups fail.
Versions / backends actually selected:
| Component | Selected |
|---|---|
| vLLM | v0.1.dev20073+g8e685d198, V1 engine, V2 model runner |
| NCCL | 2.30.7, PYNCCL all-reduce only (no MNNVL multicast / symm-mem on sm_121) |
| Full attention (12 QSA layers) | Model-specific Triton QSA kernels (_qsa_sparse_paged_gqa_splitk_kernel, persistent_topk, _qsa_mqa_paged_kernel); FlashAttention v2 is only the nominal base class and never executes for text decode |
| Linear attention (36 GDN layers) | Triton/FLA GDN prefill, CUDA GDN decode (head_k_dim=128) |
| Sparse attention state | QWEN38_FLASH_NEXT_EXP_QSA_STATE |
| NVFP4 MoE | FlashInfer CUTLASS; shared expert → FlashInferExperts |
| MXFP8 linear | FlashInferCutlassMxfp8LinearKernel, except linear_attn.in_proj_a/b ([48, 2560]) and all visual.* → EmulationMxfp8LinearKernel (BF16, dequantized at load time) — see The MXFP8 Kernel-Fallback Patch |
| Sampling | FlashInfer top-k/top-p; generation_config defaults temp 1.0, top_p 0.95, top_k 20 |
| Prefix caching | on (shared across requests) |
| KV block size | attention page = 1600 tokens (raised so it matches/pads the GDN page) |
| CUDA graphs | FULL_DECODE_ONLY, sizes 1–64, 0.39 GiB |
Cold start ≈ 10m55s (21:47:41 → API up 21:58:36 UTC): NCCL setup ~40 s, weight load 458 s (target 392 s + MTP drafter 67 s, lazy safetensors), engine init 92.4 s (profile + KV alloc + warmup), graph capture ~7 s. First request after launch is slow while FlashInfer autotunes.
Endpoints: /v1/chat/completions, /v1/completions, /v1/models, /tokenize,
/detokenize, /metrics, /health, /version, /docs on http://$HEAD_IP:8888.
FP8_DENSE=true)This experimental lane builds from
RadixArk/Qwen3.8-Flash-Next-NVFP4, not thenvidia/…default the rest of this README describes (SRC_REPOinfiles/fp8dense/build.sh). Download that checkpoint first, or pointSRC_REPOat another NVFP4 build. The byte figures below were measured on the RadixArk layout.
The routed experts are the only NVFP4 tensors in RadixArk/Qwen3.8-Flash-Next-NVFP4; every dense
projection (GDN in/out, attention q/k/v/o, both HyperConnections per layer, shared experts, lm_head —
≈9.1 GiB bf16) is streamed from LPDDR5x on every decode step and is ~6.9 of the ≈9.2 GiB a step
reads per GPU. (Qwen's official Qwen3.8-Flash-Next-FP8 does not help here: it keeps exactly
the same dense tensors in bf16 and only makes the experts FP8, i.e. more bytes per step.)
files/fp8dense/ builds a hybrid checkpoint on the head, CPU-only, in ~2 minutes and ~1 GB RAM:
./files/fp8dense/build.sh # -> ~/.cache/huggingface/hub/models--MiaAI-Lab--Qwen3.8-Flash-Next-NVFP4-FP8dense
# then in .env:
FP8_DENSE=true
./start.sh --launch
in_proj_a/b, conv1d, norms, PLE projections, the MTP layer, vision tower.MIXED_PRECISION config (quantized_layers per tensor). vLLM's
loader needs four bind-mounted patch files (files/overlay/*.py, generated from the image's own
sources by apply_patches.py, diffs alongside): the mixed config learns to dispatch
FP8_PER_CHANNEL_PER_TOKEN, and the HyperConnection / lm_head modules stop hard-coding
quant_config=None. start.sh mounts them on both nodes when FP8_DENSE=true.Selected CutlassFP8ScaledMMLinearKernel in the log.QSA_PROFILE)The 12 full-attention layers run the model's own Triton sparse-attention kernels, whose tile tables
were tuned on GB300 (160 SMs). files/qsa_gb10/ adds a bind-mounted ops/qsa.py that reads the
launch profile from VLLM_QSA_PROFILE / VLLM_QSA_PROFILE_JSON, a conservative 48-SM table
(QSA_PROFILE=gb10), and bench_qsa_kernels.py, which sweeps block/split/warp configs on the
real kernels with this deployment's decode shapes and writes the best table as JSON:
docker run --rm --gpus all --ipc host \
-v $PWD/files/qsa_gb10/qsa.py:/usr/local/lib/python3.12/dist-packages/vllm/models/qwen3_8_flash_next/nvidia/ops/qsa.py:ro \
-v $PWD/files/qsa_gb10:/work -v $HOME/.cache/vllm:/root/.cache/vllm \
--entrypoint python3 vllm/vllm-openai:qwen38-flash-next /work/bench_qsa_kernels.py --tp 2 --out /root/.cache/vllm/qsa_gb10.json
# .env: QSA_PROFILE=$HOME/.cache/vllm/qsa_gb10.json
stock (default) leaves the image untouched. The gb10 table is a starting point, not a result.
The NVFP4 checkpoint stores the 51B-param N-gram/PLE embedding table as FP8 shards + one global
weight_scale, but declares *.ple.* excluded in the ModelOpt-NVFP4 quant config. vLLM's PLE
resolver only enables FP8-PLE when the whole checkpoint is FP8-serialized, so it builds a BF16
embedding (≈102 GB) and crashes.
The fix: a resolver shim installed in ple_layer.py — when PLE_QUANT_OVERRIDE=fp8 is set, the
quant-method lookup for the PLE embedding short-circuits to the image's own
Qwen3_8FlashNextPLEFp8EmbeddingMethod (which handles exactly this "FP8 shards + one global
weight_scale" layout), bypassing the FP8-checkpoint and ignored_layers checks. Applied at
runtime via bind-mount; no image rebuild needed. start.sh extracts and patches automatically;
delete files/ple_layer_patched.py to force re-extraction after an image update.
On GB10 the MXFP8 linear layers run through FlashInferCutlassMxfp8LinearKernel, whose
mm_mxfp8 only accepts weights with N ≥ 128, N % 32 == 0, K ≥ 128, K % 32 == 0
(measured on sm_121 against vllm/vllm-openai:qwen38-flash-next; the limits do not depend on
the token count). Two shapes in this checkpoint miss that:
| Layer | [N, K] |
Why it fails |
|---|---|---|
language_model.layers.*.linear_attn.in_proj_a / in_proj_b (×72) |
[48, 2560] |
N < 128 → AssertionError: mm_mxfp8 requires N >= 128, got N=48 |
visual.blocks.*.mlp.linear_fc1 (×27) |
[4304, 1152] |
4304 % 32 == 16 → ValueError: Problem size is not supported for mm_mxfp8 |
The first one is fatal at engine start — it fires on the very first forward pass, during the
determine_available_memory() profile run, ~7 minutes into the launch and after the weights are
already resident.
The fix: files/patch_modelopt_mxfp8.py rewrites ModelOptMxFp8LinearMethod.create_weights to
check the post-TP-split (N, K) it is about to hand the kernel and swap in
EmulationMxfp8LinearKernel when the native GEMM cannot take them. Emulation dequantizes MXFP8 →
BF16 once at load time, so those layers then run as plain BF16 linears (≈17 MB extra across all
72 in_proj_a/b). Each layer gets its own quant-method instance, so the downgrade is per-layer —
everything else keeps the native kernel. The fallback logs one line per distinct shape:
WARNING [modelopt.py] MXFP8 layer [N=48, K=2560] is not supported by
FlashInferCutlassMxfp8LinearKernel (needs N,K >= 128 and divisible by 32);
falling back to BF16 emulation for this shape.
On top of the shape check, all visual.* MXFP8 layers are routed to emulation by prefix.
That is the verified multimodal configuration; emulating only visual.* (rather than the whole
model) is also what keeps the load-time BF16 dequant from OOMing the GPU.
Applied at runtime via bind-mount on both nodes; no image rebuild. Delete
files/modelopt_patched.py.orig to force re-extraction after an image update.
The model supports Text, Image, and Video input. vLLM auto-detects multimodal capabilities
from the config — no extra flags needed. Caveat: the MTP drafter logs
Draft model … does not support external multimodal embeddings, so image/video prompts draft
from text-only inputs (lower acceptance rate on those requests).
curl http://localhost:8888/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model":"qwen3.8-flash-next","messages":[{"role":"user","content":[{"type":"text","text":"What is in this image?"},{"type":"image_url","image_url":{"url":"https://example.com/image.jpg"}}]}]}'
Verified live on this deployment — fine OCR (48 px text inside a 3840×2160 frame, ≈8.2k vision tokens), color/shape/scene QA, and correct refusal to read text that isn't in the image. Two caveats: (1) this is a reasoning model and thinking consumes
max_tokensfirst — ifcontentis empty withfinish_reason: "length", just raisemax_tokens(2–4k covers most image QA);chat_template_kwargs.thinking_budgetis not honored by this build. (2) media must be a URL or base64 data-URL (no local paths —--allowed-local-media-pathis not set), default limit is 1 image + 1 video per prompt, and the vision encoder budget is 16,384 tokens (larger inputs are auto-resized / sparse-sampled for video).
Two kwargs the checkpoint's chat_template.jinja reads, neither of them obvious from the
config. Pass both under chat_template_kwargs:
reasoning_effort — low | medium | xhigh, default xhigh. Anything else is
rejected while the template renders, so the request fails with HTTP 400 before it reaches
the engine:
Unexpected reasoning effort max. Supported types are xhigh (default), medium, and low.
high and max are both not accepted. Worth knowing if you share one client config
with models where they are valid — that is how we found it.
enable_thinking — default true; false prefills an empty <think></think> block
for a non-thinking turn. Note the interaction with the above: the reasoning_effort check
sits inside the thinking branch of the template, so with enable_thinking: false an
invalid reasoning_effort is silently ignored instead of rejected. The same client config
400s in thinking mode and passes here.
curl http://localhost:8888/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model":"qwen3.8-flash-next","messages":[{"role":"user","content":"Hi"}],"max_tokens":2048,"chat_template_kwargs":{"reasoning_effort":"low"}}'
See Multimodal for the two adjacent facts that thinking consumes
max_tokens and that thinking_budget is not honored by this build.
133 GB / 11 shards: BF16 dense (attention, GDN, hyper-connections, shared experts,
vision, lm_head) + NVFP4 routed experts + a 51 GB FP8 per-tensor PLE table.
Measured on this 2-Spark kit at MAX_MODEL_LEN=262144, GMU=0.835:
| value | |
|---|---|
| Weights resident | 62.72 GiB / node (66.14 GiB incl. non-torch) |
| KV cache (fp8, default) | 32.02 GiB — 3,652,200 tokens, 13.93× at 262K |
| Peak activation / CUDA graphs | 2.15 GiB / 0.4 GiB |
| Load time | ~6:15 weights, 122 s engine init |
| Decode (batch-1, greedy) | ~24.5 tok/s |
vLLM reports headroom for --kv-cache-memory=44208844800 (41.17 GiB) if you want
to push GMU up. At 2.66M cache tokens a 1M-token context still fits ~2.6×.
Two checkpoint-specific fixes are applied automatically by start.sh; both exist
because this checkpoint records metadata differently from local-inference-lab/…:
PLE table dtype (files/detect_ple_dtype.py) — the FP8 PLE table is declared
only in quantization_config.config_groups, not as text_config.ple_embedding_dtype
which the patched ple_layer.py dispatches on. Recovered and re-injected via
--hf-overrides. Without it the 51 GB FP8 PLE table fails to load.
MTP layer-index alias (files/patch_checkpoint_config.py) — vLLM builds the MTP
draft layer at the absolute index mtp.layers.48, and matches quantization metadata
by exact string. This checkpoint records only mtp.layers.0. The alias is added in
both config.json and the legacy hf_quant_config.json (vLLM reads the legacy
file on the draft-model path) and bind-mounted in; the HF cache is never modified.
FP8_BLOCK_SCALES routed experts (files/patch_modelopt_fp8_block_moe.py) — this
checkpoint's MTP routed experts are 128x128 block-scaled FP8, but
ModelOptMixedPrecisionConfig.get_quant_method builds RoutedExperts only for
FP8 / NVFP4 / W4A16_NVFP4 / MXFP8. Anything else returns None, giving a
silently unquantized MoE that dies ~7 min into the load with
Layer mtp.layers.48.mlp.experts has no parameter 'w2_weight_scale_inv'.
The patch adds the missing branch, routing to vLLM's own Fp8MoEMethod with
weight_block_size read from the checkpoint's group_size (it refuses to guess —
a wrong block shape applies misaligned scales silently rather than failing).
This gap is not specific to this image. Upstream vLLM has no
FP8_BLOCK_SCALESbranch either — not at commitd4d703ca(which the model card recommends, and which only fixes FP8 PLE loading, #54882), nor on currentmain. Upgrading vLLM does not enable MTP here.start.shpreflights the MTP expert algo and fails in seconds if it ever sees one the dispatch cannot build.
| MTP off | MTP=3 | |
|---|---|---|
| Decode (batch-1, greedy) | 24.5 tok/s | 52.1 tok/s (2.13x) |
| Draft acceptance | — | 72.8% (823/1131) |
| Acceptance by position | — | 89% / 74.5% / 60% |
| Weights resident | 62.72 GiB | 64.3 GiB |
| KV cache (bf16) | 2,663,445 tok (10.16x) | 2,131,159 tok (8.13x) |
| KV cache (fp8, default) | — | 3,652,200 tok (13.93x) |
The decaying per-position acceptance curve is the check that matters: a wrong block shape would show up as near-random acceptance, not as a crash.
Concurrency and prefill numbers for this configuration are in Performance.
On by default since 2026-09-10 — .env.sample ships
MTP_DRAFT_VOCAB=files/draft_vocab_en_code_47k.txt (47,149 code-tuned ids, vendored from the
single-Spark recipe). Empty the knob to draft over the full vocabulary. start.sh resolves
relative paths against the repo root (the overlay mount needs an absolute host path) and warns
when MTP runs without a vocab.
This checkpoint's vocabulary is 248,320 tokens, and the MTP drafter carries its own BF16
ParallelLMHead over all of it (tie_word_embeddings is false): 248320 × 2560 × 2 B = 1.18 GiB,
0.59 GiB per GPU at TP=2, read once per draft step. At MTP=3 that is three of the four lm_head
reads in an engine step — roughly a quarter of the ~9.2 GiB a single-stream step moves per GPU.
Slicing that head down for drafting is the largest single bandwidth lever in the decode step.
It cannot change what the server emits. Draft sampling is greedy and every draft is verified against the target model, so a token outside the subset is simply rejected, exactly like any other bad draft. The cost is acceptance, not correctness.
Measured live on this kit 2026-09-11 (nvidia NVFP4, NFS-shared weights, TP2+EP, MTP 3, fp8 KV,
BF16 SSM, bench/sweep.py driving sparkDash: prose and code, 600 tokens, S=1/2/4/8, three repeats
in alternating order, one launch per arm). Aggregate decode tok/s, means of three:
| baseline (full head) | tuned (47k vocab) | change | |
|---|---|---|---|
| code, 1 stream | 62.0 | 71.5 | +15.3% |
| code, 2 streams | 113.8 | 124.9 | +9.7% |
| code, 4 streams | 193.4 | 211.1 | +9.1% |
| code, 8 streams | 312.4 | 325.0 | +4.0% |
| prose, 1 stream | 49.2 | 56.8 | +15.5% |
| prose, 2 streams | 84.1 | 91.6 | +8.9% |
| prose, 4 streams | 134.8 | 146.0 | +8.3% |
| prose, 8 streams | 213.4 | 225.3 | +5.6% |
+9.6% mean across the eight cells. The gain is all step time — code 61.2 → 54.0 ms at one stream, prose 59.9 → 53.3 — with tokens per step unchanged (code 3.80 → 3.85, prose ~2.9 both): the byte saving with acceptance preserved, the same mechanism the single-Spark recipe measured at +13.1% mean. The dual win is smaller for two reasons: at TP=2 each rank holds only half the head (0.59 GiB), and the 47k ids land ~97% in rank 0's id range, so the step's critical rank reads 0.22 GiB where single-Spark's only GPU went 1.18 → 0.22 — rank 1's slice shrinks to ~0.01 GiB, but a step waits for the slowest rank, so that does not shorten it. The win tapers with concurrency as the batch itself fills the step (+4.0% at code S=8). In six of the eight cells the tuned arm's worst repeat beats the baseline arm's best (code S=4, 193.4 vs 194.5, and S=8, 318.0 vs 321.8, overlap at the extremes; the means stay separated).
Zero NV_ERR_NO_MEMORY kernel lines on either arm; minimum host MemAvailable 2.38 vs 2.33 GiB,
no level failed and no streams failed. Host memory on this kit runs tight under the nvidia weights
(tighter than the 4.8+ GiB seen serving the smaller Mia-AiLab checkpoint) — worth watching
regardless of the draft vocab; see the GMU notes in .env.sample.
Build your own vocabulary if your traffic is not code-heavy — the shipped file was tuned on host code+docs and may draft worse for other languages:
python3 bench/gen_draft_corpus.py --out corpus.jsonl # the model's own output
python3 files/build_draft_vocab.py corpus.jsonl \
--out draft_vocab.txt --size 65536 --fill-to-size --balance-shards 2
MTP_DRAFT_VOCAB=$PWD/draft_vocab.txt ./start.sh --launch
Watch per-position acceptance in /metrics (spec_decode_num_accepted_tokens_per_pos_total);
rebuild from your own output if coverage drops.
start.sh then patches nvidia/mtp.py (step 4e) and sets use_local_argmax_reduction, which is
the only path that reaches the reduced head — compute_logits keeps the full vocabulary.
Balance the vocabulary across TP ranks. A vocab-parallel lm_head splits by id range, and a
decode step waits for the slowest rank. Filling with the lowest-numbered ids put 65,392 of 65,536
on rank 0, so only one rank saved anything; --balance-shards 2 splits them 32,768/32,768:
| draft vocab | draft head per rank | decode: prose / code / entropy / copy | acceptance |
|---|---|---|---|
| full 248,320 (default) | 0.59 GiB | 40.0 / 43.2 / 40.1 / 59.1 | 56.5% |
| 65,536, lowest-id fill | 0.31 GiB | 40.3 / 44.1 / 42.3 / 65.0 | 53.2% |
65,536, --balance-shards 2 |
0.16 GiB | 42.5 / 44.5 / 45.4 / 56.5 | 47.8% |
(bf16 KV, 400 decoded tokens at 1k context, greedy, bench/decodebench.py; acceptance as a delta
via bench/mtp_accept.py.)
Read this honestly: it is a real trade, not a free win. Balancing helps prose, code and
entropy, but acceptance falls 56.5% → 47.8% and the copy task — the one that leans hardest on
the drafter predicting quoted text — ends up below the full-vocabulary baseline. Bandwidth and
acceptance pull in opposite directions.
The vocabulary above is mostly padding, and that is the likely culprit. The corpus behind it
was 85 documents / 49,141 token occurrences, which yielded only 8,305 distinct ids — coverage
saturates by 16,384, so --fill-to-size padded the rest with the lowest-numbered unseen ids on the
theory that byte-level BPE is built in merge order. That is a proxy, not a measurement. Two
things worth trying before judging the lever: a much larger corpus so 65k can be ranked honestly,
and the corpus-only ~8.3k vocabulary, which would cut the draft head to ~0.02 GiB per rank.
build_draft_vocab.py --report-only prints coverage at several sizes; tune on coverage, not size.
files/test_draft_vocab.py checks the shard slicing and the cross-rank reduction against a
full-vocabulary argmax restricted to the draft set — run it after touching the patch.
Credit. The idea and
files/build_draft_vocab.pycome from MiaAI-Lab/Qwen3.8-Flash-Next-Single-DGX-Spark (AGPL-3.0-or-later), which implements it for TP=1. The shippedfiles/draft_vocab_en_code_47k.txtis vendored unchanged from that repo (its PR #39, where it measured +13.1% mean single-Spark);files/patch_mtp_draft_vocab.pyis a TP-aware rewrite: upstream refuses to engage attp_size != 1, since its reduced head is a plain matmul rather than a vocab-parallel one. FR-Spec is the general technique.
files/draft_vocab_{es,zh,ja,de,pt,fr,ru}_en_code_65k.txt — the single-Spark
recipe's language-extend method (files/build_draft_vocab_extend.py, ported
here) applied to this kit's 47k floor: the 47,149-id file whole as a floor
(verified in every file), all 400 byte-fallback ids pinned unconditionally,
then 18,387 ids by frequency over 668 MiB of that language's Wikipedia,
65,536 rows. Switch with MTP_DRAFT_VOCAB=files/draft_vocab_<lang>_en_code_65k.txt.
The 47k floor covers other languages poorly. Measured on 68 MiB of held-out (disjoint) Wikipedia per language, 12–20M token occurrences each:
| language | 47k coverage | 65k coverage |
|---|---|---|
| Spanish | 63.8% | 99.3% |
| Chinese | 34.7% | 96.7% |
| Japanese | 30.0% | 99.7% |
| German | 60.2% | 99.5% |
| Portuguese | 65.4% | 99.2% |
| French | 69.4% | 99.5% |
| Russian | 31.5% | 99.7% |
Correctness is identical either way (rejection sampling); poor coverage only costs speed. The TP=2 cost of a language file, stated honestly: the added language ids land mostly in rank 0's id range, so the slowest rank's draft shard grows from ~0.22 GiB (47k, 97% on rank 0) to 0.23–0.29 GiB (65k) against the full 0.57 GiB per-rank head — about 20% of the byte saving at the waiting rank. zh Wikipedia alone spans 152k distinct ids, so zh tops out at 96.7% even at 65,536 rows.
Wikipedia-only build (no model-output corpus; see the single-Spark README
section for the rebuild path if acceptance measures low). Watch
spec_decode_num_accepted_tokens_per_pos_total in /metrics after switching.
Measured on this kit (2026-09-29, one boot per arm through lmswitch,
.env.sample profile, medians over 400-token completions, temperature 0,
thinking off; accepted/draft from /metrics deltas). Two prompt sets were
used: the full one (5 prompts × 2 reps) for the first baseline, the es arm and
the first zh arm, and a trimmed one (3 prompts × 1 rep, dropping the
mechanical counting and JSON prompts, which draft near-perfectly and flatter
the baseline) for the rest — so each language is compared only against the
baseline measured with the same set.
Read the normalized column, not the raw one. The English control in each arm doubles as a per-boot speed check: across ten boots of the same configuration it spans 49.4–64.0 tok/s, i.e. ±12% boot-to-boot. Comparing a language's tok/s against the English tok/s of the same boot divides that out, so the column below is the vocabulary's effect rather than the boot's luck. Raw is kept alongside for transparency.
| language | 47k tok/s | lang 65k tok/s | raw | normalized | 47k acc/draft | lang 65k acc/draft |
|---|---|---|---|---|---|---|
| Russian | 24.3 | 40.5 | +67% | +53% | 0.39 | 1.55 |
| Japanese | 25.4 | 39.4 | +55% | +37% | 0.45 | 1.34 |
| Chinese | 24.3 | 32.7 | +35% | +19% | 0.45 | 1.14 |
| Chinese (full set) | 41.5 | 56.4 | +36% | +39% | 0.96 | 1.65 |
| German | 30.4 / 32.8 † | 40.1 † | +27% | +31…+36% † | 0.78 / 0.85 | 1.30 / 1.50 |
| Spanish | 50.7 | 60.5 | +19% | +20% | 1.35 | 1.88 |
| French | 34.0 | 42.3 | +24% | +10% | 0.92 | 1.34 |
| Portuguese | 33.0 | 38.4 | +16% | +9% | 0.96 | 1.39 |
| English (control) | 56.3 | 49.4–64.0 | ~flat | ~flat | 2.12 | 1.98–2.15 |
German was re-measured with an ABBA protocol (de-65k / 47k / 47k / de-65k, four boots, baseline measured inside the same window) because its first single-boot cell came from the slowest boot of the whole project. Result: +31…+36% normalized, acceptance 0.81 → 1.40 — the original +3% raw and the +17% normalized estimate were both too low. The pair is what settles it: the two de-65k arms read 29% apart raw (31.10 and 40.13 tok/s) but agree at +31% and +36% once each is divided by its own English control, so the disagreement was boot speed, not the vocabulary. The two 47k arms agreed to 8% de / 0.7% control. † those four cells are the ABBA run, not the first pass; the other rows are the first pass and have not been re-run.
Acceptance is the mechanism, and it needs no normalization: every one of the seven language arms raises accepted tokens per proposal substantially (ru 0.39 → 1.55, zh 0.45 → 1.14, ja 0.45 → 1.34, de 0.81 → 1.40, pt 0.96 → 1.39, fr 0.92 → 1.34, es 1.35 → 1.88) while the English control sits at 1.98–2.15 in every arm. The normalized ordering still tracks baseline coverage: the three deepest holes (ru 31.5%, ja 30.0%, zh 34.7% held-out) take the three largest gains, and the best-covered (pt 65.4%, fr 69.4%) the smallest.
Caveat on the method. Normalizing against a control from a different workload (English prose) assumes the boot's speed difference transfers to the language prompts; it is a correction, not a substitute for a clean measurement. German now has the clean measurement (ABBA, two arms each side, agreements reported above), which is why its caveat is retired and it exceeds the single-Spark figure (+18% normalized, +14…+16% raw) rather than matching it — at TP=2 the larger recovered headroom shows up more in tok/s. The other six rows remain single-boot normalized values and deserve the same treatment before being quoted as final. The proper harness change, not in this PR: treat the English control as a per-boot validity check and re-run any arm whose control falls outside the established band.
# .env
MAX_MODEL_LEN=1000000
YARN_ENABLE=true
YARN_FACTOR=4.0
VLLM_ALLOW_LONG_MAX_MODEL_LEN=1
max_position_embeddings is 262144, so vLLM logs a VLLM_ALLOW_LONG_MAX_MODEL_LEN must be used with extreme caution warning — YaRN is what makes the 1M positions valid. Quality at 1M with
factor 4.0 is beyond the checkpoint's trained range: benchmark before trusting long-context
answers, and fall back to MAX_MODEL_LEN=262144 / YARN_ENABLE=false for comparison runs.
Rule: YaRN exists to extend context beyond native. At
MAX_MODEL_LEN≤ 262144 it has no benefit and costs accuracy, sostart.shnow force-disables it automatically (prints a NOTE) — no need to rememberYARN_ENABLE=falsewhen testing at native context.
Fixed Sep 2026 — YaRN was previously a silent no-op.
start.shemitted--hf-overrides '{"rope_parameters":{...}}'at the top level. vLLM'sModelConfig._apply_dict_overridesonly recurses into keys that are themselves nested configs; forqwen4_expthe parent config exposesrope_parametersas a plain dict, so the override wassetattr'd onto the parent and never reachedtext_config, which the model actually reads. Verified in the image: after the top-level overridetext_config.rope_parametersstill readrope_type: "default". Every earlier "1M context" run was therefore serving 1M positions on unscaled rope. The override is now nested undertext_config(together withple_embedding_dtype), soYARN_ENABLE=truechanges rope for the first time — treat 1M as unvalidated on this kit and benchmark it before trusting long-context answers.
Measured with sparkDash against the running server.
vllm/vllm-openai:v0.30.0, GMU 0.80, BF16 KV (1,340,476 tokens), MAX_NUM_SEQS=8, 47k draft
vocab, breakable CUDA graphs off. sparkDash decode bench, 512 tokens per stream, one run per
prompt type. Aggregate / per-stream decode tok/s:
| Concurrency | structured | prose | code |
|---|---|---|---|
| ×1 | 76.0 / 76.0 | 59.2 / 59.2 | 66.6 / 66.6 |
| ×2 | 126.6 / 63.9 | 75.1 / 37.7 | 140.8 / 70.4 |
| ×4 | 165.9 / 42.4 | 118.5 / 29.9 | 245.6 / 61.4 |
| ×8 | 258.5 / 32.5 | 216.4 / 28.8 | 313.6 / 39.2 |
| ×16 | 326.3 / 41.5 | 194.9 / 25.5 | 327.5 / 42.7 |
×16 is over MAX_NUM_SEQS=8: half the streams queue, so mean TTFT jumps to 6.5-9.7 s (vs
0.1-0.4 s at ×1-×8) and aggregate is not a batch-16 number. Code drafts best, prose worst.
A structured run earlier the same session gave 210.9 at ×4 and 308.1 at ×8, so expect ±20%
between single runs at mid concurrency.
| Prompt | Tokens | Throughput | TTFT |
|---|---|---|---|
| 1k | 1,060 | 2791.3 tok/s | 0.38 s |
| 4k | 4,133 | 3313.5 tok/s | 1.25 s |
| 16k | 16,421 | 3489.8 tok/s | 4.71 s |
| 32k | 32,804 | 2982.3 tok/s | 11.00 s |
| 64k | 65,576 | 2045.7 tok/s | 32.05 s |
| 128k | 131,107 | 2897.6 tok/s | 45.25 s |
128k reading faster than 64k reproduced across two runs; it is not explained yet.
Configuration at capture: fp8 KV (the shipped default) plus the 65,536-id balanced MTP draft
vocabulary — at capture time the draft vocab was not a default, it was passed via
MTP_DRAFT_VOCAB (see
Reduced-vocabulary MTP drafting). Since 2026-09-10 the shipped
default is the 47,149-id vocabulary, so these tables no longer describe a fresh clone: drop the
draft vocab and expect the decode column to move further; the prefill column should not. The
47k-default A/B on this kit (measured on the nvidia checkpoint, NFS weights) is tabulated in
the draft-vocab section above.
| Concurrency | Aggregate | Per stream | TTFT |
|---|---|---|---|
| ×1 | 54.4 tok/s | 54.4 tok/s | 160 ms |
| ×2 | 86.5 tok/s | 45.1 tok/s | 426 ms |
| ×4 | 128.1 tok/s | 34.2 tok/s | 471 ms |
| ×6 | 169.7 tok/s | 29.7 tok/s | 490 ms |
| ×8 | 207.0 tok/s | 26.7 tok/s | 432 ms |
Aggregate scales 3.8× from ×1 to ×8 while per-stream falls to 49%. Batch-1 decode is bound by weight bandwidth, so extra streams ride the same weight fetch nearly for free at first, and the per-stream cost only starts to bite once the batch itself fills the step. (Speculative decoding normally contributes to that decay — drafts compete with real tokens for the step budget — but acceptance was not measured per concurrency level here, so treat the split as unattributed.)
| Prompt | Tokens | Throughput | TTFT |
|---|---|---|---|
| 8k | 8,230 | 2874.9 tok/s | 2.86 s |
| 16k | 16,423 | 2962.1 tok/s | 5.54 s |
| 32k | 32,806 | 2962.2 tok/s | 11.08 s |
| 64k | 65,575 | 2893.4 tok/s | 22.66 s |
| 128k | 131,109 | 2727.1 tok/s | 48.08 s |
Prefill is flat at ~2.96k tok/s from 16k to 64k and sheds 8% by 128k — QSA keeps attention from dominating at long context, so TTFT stays close to linear in prompt length.
Same kit, same checkpoint, same GMU. Both changes (fp8 KV, reduced draft vocab) are folded in, so the deltas are not individually attributable — the per-lever measurements are in FP8 KV and draft vocab.
| before | now | Δ | |
|---|---|---|---|
| decode ×1 | 52.1 tok/s | 54.4 | +4.4% |
| decode ×2 | 83.3 | 86.5 | +3.8% |
| decode ×4 | 136.5 | 128.1 | −6.2% |
| decode ×6 | 170.7 | 169.7 | −0.6% |
| decode ×8 | 210.1 | 207.0 | −1.5% |
| TTFT ×1 | 236 ms | 160 ms | −32% |
| prefill 32k | 2933.3 tok/s | 2962.2 | +1.0% |
| prefill 128k | 2697.1 tok/s | 2727.1 | +1.1% |
| KV cache | 2,131,159 tok | 3,652,200 | +71% |
Low concurrency and TTFT improved; mid-range concurrency (×4) regressed. Prefill is essentially unchanged, which is the expected shape — these levers act on the decode step and the cache, not on prefill compute.
Re-measure after changing MAX_MODEL_LEN, MTP_NUM_SPECULATIVE_TOKENS, KV_CACHE_DTYPE,
MTP_DRAFT_VOCAB, FP8_DENSE or QSA_PROFILE. Each decode step streams ≈9 GiB per GPU (lm_head
×4 because of the three MTP draft passes, routed experts, GDN projections, replicated bf16
HyperConnection); a reduced draft vocabulary is a direct cut into three of those four lm_head
reads. See docs/CLAUDE/fable5-1-report.md §2 for the byte model and FP8_DENSE below for
another lever.
Captured on an earlier container (GMU 0.85, MTP off, different weights) — kept only as a content-mix reference; the numbers above supersede these.
| Content | Tokens | TTFT | Decode |
|---|---|---|---|
| code | 545 | 0.26s | 55.8 tok/s |
| reasoning | 575 | 0.28s | 56.0 tok/s |
| C# | 1200 | 0.27s | 44.4 tok/s |
| prose | 718 | 0.31s | 36.4 tok/s |
PLE_OFFLOAD=true needs ~51 GB of free CPU RAM. The launch log reported
Available RAM: 44.92 GiB at target-weight load and 41.71 GiB before the MTP drafter
loads on this box — offloading will OOM or thrash swap. Keep it false
here; the FP8 PLE shard fits comfortably on the GPU.
Drop page caches before every launch if you hit a CUDA out of memory that
"worked yesterday" on unified memory: sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
on both nodes. start.sh does not do this for you (it needs no root).
Never point IB_HCA at an HCA cabled to another cluster — NCCL will hang mid-NCCL-init
with no useful error. One exact-match device per node (leading =).
IB_GID_INDEX=3 does not come up on every ConnectX/RoCE setup. If NCCL/RoCE fails
to initialise, try IB_GID_INDEX=5 (some clusters route on GID 5 instead).
Cross-wired nodes: head uses f1, worker f0 — hence the separate WORKER_IFACE /
WORKER_IB_HCA overrides. If you re-cable, set both.
fp8 KV needs the QSA patch, which start.sh applies for you. The stock kernels declare
supported_kv_cache_dtypes = ["auto", "bfloat16"]; passing --kv-cache-dtype fp8 to an
unpatched image raises Qwen3.8-Flash-Next QSA requires a BF16 main KV cache. Do not hand-roll
the flag — set KV_CACHE_DTYPE in .env so the patch is applied with it.
.env beats the environment, except ABLIT and HF_TOKEN. start.sh sources .env
after reading the environment, so KV_CACHE_DTYPE=fp8 ./start.sh is silently ignored for
any key that .env already defines. Edit .env, or check the KV dtype: line in the
launch summary. ABLIT=1 ./start.sh and HF_TOKEN=hf_... ./download.sh do win over
.env, matching the single-Spark 0/1 flag.
MTP >1 token logs running multiple times of forward on same MTP layer, which may result in lower acceptance rate, and the QSA backend can't fuse multi-step draft decode (it rebuilds
attention metadata per draft step). MTP_NUM_SPECULATIVE_TOKENS=1 is the safe comparison point.
./stop.sh force-removes vllm-fn on both nodes. If the NFS share is in use it stays up
so the next --launch does not rebuild it; ./stop.sh --nfs tears it down too.
FlashInfer autotune cache in ~/.cache/vllm is the only per-node state that carries over.
NFS_SHARE=true only: do not stop vllm-fn-nfs while vLLM is loading or running — the
worker reads shards from it. Cold start streams ~126 GiB over CX7 (lazy safetensors); once
weights are in GPU memory the share is idle.
Weights corruption is silent until load. A shard corrupted mid-download keeps its
apparent size close enough that check-weights.sh (size + file count) passes, then the
engine dies at ~33% weight load with safe_open → "incomplete metadata, file not fully
covered". Run ./check-weights.sh --verify after any download or rsync to hash every
shard against the Hugging Face manifest (read-only; ~1 min for 135 GB at the 2.4 GiB/s
8-thread hash rate measured on local NVMe, proportionally slower over NFS). If the nodes
are busy, ./check-weights.sh --dry-run does the same planning and presence/size checks
without reading the weights.
No route to huggingface.co from the nodes? --verify needs the file manifest, not
the weights. Save it once where the API is reachable and pass it in — nothing else phones
home, and the same file is shipped to the worker:
python3 verify-weights.py --repo nvidia/Qwen3.8-Flash-Next-NVFP4 \
--save-manifest manifest.json --fetch-only # where the API is reachable
./check-weights.sh --manifest manifest.json # on the head node
HF_API_BASE in .env points the fetch at a mirror instead.
No route to Docker Hub from the nodes? start.sh runs docker pull on head and
worker, so both need to reach the registry. If only one node can, pull there and ship the
image over SSH — docker save "$IMAGE" | ssh worker docker load. If neither can, fetch it
from a host that can (crane pull "$IMAGE" image.tar, HTTP proxy if needed) and
docker load < image.tar on both nodes before running ./start.sh --launch.
huggingface_hub >= 1.x offline mode fails with "Cannot find cached snapshot" if
refs/main has a trailing newline. Write refs/main with printf, not echo.
| Base deployment | getrefined/Qwen3.8-Flash-Next-NVFP4-vLLM-DGX-Spark |
| FP8 KV cache kernels, draft-vocabulary builder | MiaAI-Lab/Qwen3.8-Flash-Next-Single-DGX-Spark (AGPL-3.0-or-later) — the single-Spark TP=1 recipe |
| FP8-KV approach (via the above) | lancelind/qwen3.8-Flash-DGX (Apache-2.0) |
| Concurrency / prefill benchmarks | MiaAI-Lab/sparkDash |
| PLE quant dispatch | ported from vLLM PR #53899 (qwen4_exp) |
| Model | nvidia/Qwen3.8-Flash-Next-NVFP4 |
Abliteration splice (ABLIT=1) |
Keys (drowzeys) — keys-Qwen3.8-Flash-Next-NVFP4-dual-ablit-house-qsa-L3-47 (gated; house QSA o_proj L3–47 on nvidia NVFP4) |
AGPL-3.0-or-later (this repository only) — see LICENSE, matching
MiaAI-Lab/Qwen3.8-Flash-Next-Single-DGX-Spark,
from which files/patch_qsa_fp8_kv.py and files/build_draft_vocab.py are vendored. Those files
are AGPL-3.0-or-later, so the repository that carries them has to be too.
vLLM remains Apache-2.0; the container image and the model checkpoint are governed by their own
upstream terms, and nothing here relicenses them. Files under files/ that carry an
SPDX-License-Identifier header keep the license of their origin — see each file.
The abliterated checkpoint
drowzeys/keys-Qwen3.8-Flash-Next-NVFP4-dual-ablit-house-qsa-L3-47, served only when you
opt in with ABLIT=1, is gated on Hugging Face behind its own responsible-use agreement,
with its licence inherited from nvidia/Qwen3.8-Flash-Next-NVFP4 (NVIDIA Open Model
License + Qwen Community License 1.0). This repository ships a flag that can serve those
weights. It does not redistribute them and does not relicense them.
| Script | Purpose |
|---|---|
download.sh |
fetch weights onto the head (ABLIT=1 for the gated Keys house snapshot — requires HF_TOKEN and accepted Hugging Face terms; --fp8 for official FP8); start.sh handles the worker |
start.sh |
optional download on head → distribute to worker (rsync, or NFS with --nfs) → verify complete snapshot → image sync → PLE + MXFP8 patches → launch rank 1 then rank 0. ABLIT=1 selects the Keys house checkpoint |
start-fp8.sh |
optional official FP8 path (Qwen/Qwen3.8-Flash-Next-FP8); native 262K, no YaRN; ~500k KV cache tokens on this kit |
stop.sh |
docker rm -f vllm-fn on worker, then head (--nfs also stops the share) |
check-weights.sh |
verify the checkpoint on the head and on the worker (local copy, or over NFS when NFS_SHARE=true) |
check-weights.sh --verify |
per-file SHA-256 verification against the Hugging Face manifest (~1 min read-only) |
check-weights.sh --dry-run |
plan --verify (fetch manifest, check presence/size) without hashing or scp |
check-weights.sh --dry-run |
plan --verify (fetch manifest, check presence/size) without hashing or scp |
check-weights.sh --manifest FILE |
verify against a manifest saved earlier — no Hugging Face API call |
verify-weights.py |
per-file SHA-256 verification against the Hugging Face manifest (used by check-weights.sh --verify) |