Downloads · 30 days
0
pendraga/Qwen3.8-Flash-Next-GB10-SGLang-Recipe
Qwen3.8-Flash-Next-GB10-SGLang-Recipe is a text generation model from pendraga. Use it when you need the model to write or continue text. The card lists the license as other.
Superseded (2026-10-31). On the same GB10, with the same tests and the same 524k context, pendraga/Qwen3.8-Flash-Next-GB10-vLLM-524k (vLLM + b12x, built on diffbot's FP4-Local recipe) decodes +32 % on code and +23 % o…
Downloads · 30 days
0
Access
Public
Updated Oct 31, 2026
Repo size
15.9 MB
Likes
1
Public
Click a slice to open those files.
.xz15.7 MB · 86%
From the Hugging Face model README
Superseded (2026-10-31). On the same GB10, with the same tests and the same 524k context,
pendraga/Qwen3.8-Flash-Next-GB10-vLLM-524k(vLLM + b12x, built on diffbot's FP4-Local recipe) decodes +32 % on code and +23 % on thinking (78 vs 59.4 and 65 vs 52.4 tok/s) and passes long-context checks up to 489k tokens. This SGLang recipe still builds and runs as documented below and remains the deterministic option (bit-identical NLL across runs), but it is no longer maintained.
A buildable, validated fork of
single-spark-ai/Qwen3.8-Flash-Next-DGX-Spark-Optimized-Recipe
(v4, commit 10e8a24, MIT, © 2026 hashd1ve). The upstream recipe describes an excellent
design — NVFP4 routed experts + FP8 blockwise dense bypass + FP8-serialized MTP draft +
YaRN×2 to 524K + bounded io_uring PLE — but does not build or run from public sources as
published. This fork fixes that, fixes a scheduler crash, re-enables vision, and adds an
FR-Spec hot-token map for the draft that brings decode from 48.5 to 60 tok/s on code.
Everything below was run end to end on one GB10 on 2026-09-17. No weights in this repo. Not affiliated with the upstream author, NVIDIA, RadixArk, LMSYS/SGLang or Qwen.
| tok/s | upstream design, fixed | this recipe (+ hot-token map) | Δ |
|---|---|---|---|
| Code | 48.5 | 60.0 | +24 % |
| Prose (EN) | 34.1 | 39.5 | +16 % |
| German | 36.9 | 46.4 | +26 % |
| Thinking | 41.6 | 52.9 | +27 % |
Clean-room re-run from a fresh clone (see below): code 59.1 · prose 40.4 · German 44.9 · thinking 51.6 tok/s. GSM8K (200 problems, thinking on): 191/200 = 95.5 %.
| measured | |
|---|---|
| Context | 524,288 tokens (YaRN ×2 over native 262,144) |
| KV pool | 1.16–1.20 M tokens (fp8_e4m3 target KV + bf16 draft KV), sized from free memory at start |
| Target load | ≈450 s, 76.98 GB incl. vision tower |
| Draft (MTP) load | ≈17 s, FP8 serialized |
| Speculative accept | 3.4–3.5 / 4 on code (NEXTN 3/1/4) |
| Vision | enabled (image test passes); 0.84 GiB, no measurable decode impact |
| Free after CUDA-graph capture | 7.5–11.6 GB (pool sized from free memory at start) |
| GSM8K, 200 problems, thinking | 95.5 % (results/gsm8k-cleanroom.json) |
| Previous stack on the same box | llama.cpp fork, IQ4_XS + MTP: 45.97 tok/s code |
Upstream claims 63.1 tok/s on code; see Why not 63 tok/s.
| # | Upstream problem | Fix |
|---|---|---|
| 1 | Base image qwen38-flashnext-sm121-community:344f9d0d is private. The public nightly d91c3682 it names has no Qwen4 support (configs/qwen4_exp, attention/qsa/*, layers/hyperconnection missing). | Base lmsysorg/sglang:dev-cu13-qwen38-next-local (branch qwen4-main-squashed @ 4ccff141) pinned by digest. Same CUDA 13.0.3 / cuBLAS 13.1.1.3 / FlashInfer 0.6.17 as the nightly. |
| 2 | bounded-ple/rust/ (io_uring PLE reader) not shipped. | Vendored from SGLang PR #36567 head d866243, unmodified, Apache-2.0 (bounded-ple/rust/SOURCE.md). |
| 3 | Deploy reads build/path_qsa.txt, file is at repo root → abort. | Fallback to root file. |
| 4 | Backend overlay imports qsa_nvfp4_kv, which no public SGLang has. | build/kda_overlay/qsa_nvfp4_kv_stub.py (FP8-KV path), mounted by deploy. |
| 5 | Scheduler crash AssertionError: Unsupported rhs dtype fp8e4nv on every extend with KV history — the first prefix-cache hit or any prompt > chunked-prefill-size (1024). Raw float8 KV rows reach a BF16-only Triton chunk-prefill kernel (upstream SGLang 4ccff141 had the same bug; fixed in #38855 / v0.5.20). | Widen to query dtype in forward_extend (exact, KV scales are 1.0). Regression test: tests/crashtest.py. Fixed upstream on 2026-09-10 in #38855 (v0.5.20+), so this overlay only matters for the pinned 4ccff141 base. |
| 6 | --language-only silently drops the vision tower although the weights are in the tree. | Vision on by default; LANGUAGE_ONLY=1 restores upstream behaviour. |
| 7 | Delta download needs model.safetensors.index.json and a specific dir name; probes and 07-prepare-draft are documented as host-runnable but need sglang/torch; probe-mixed asserts a pre-v4 state; draft shard written 0600. | scripts/00-download.sh, scripts/02-build-trees.sh, scripts/03-probe-trees.sh; probe and chmod fixed. |
| 8 | Deploy binds 127.0.0.1:18400, no restart policy, container name qwen38-abliterated-sglang, and passes --allow-auto-truncate (an over-long prompt is silently cut instead of erroring — invisible context loss in an agent loop). | HOST_BIND (default 127.0.0.1), HOST_PORT (default 8000), optional API_KEY, RESTART_POLICY=unless-stopped, name qwen38-flash-next, auto-truncate off by default (ALLOW_AUTO_TRUNCATE=1 to restore). |
| + | Draft lm_head projects onto the full 248,320-token vocabulary every draft step. | FR-Spec hot-token map (65,536 ids, 97 % holdout coverage) → +16…27 % decode. SPEC_TOKEN_MAP= (empty) disables it. |
Removed from the upstream tree (pre-v4 or unused, never exercised here): 02/03/04-*,
legacy-start/stop.sh, hybrid-sharp-review.md, hybrid_sharp_tree_check.py.
They remain available in the upstream repo.
graph TD
A[nvidia/Qwen3.8-Flash-Next-NVFP4<br/>official quantized tree] -->|FP4 experts + FP8 mtp + FP8 PLE| C[HybridSharp-nv target tree<br/>08-merge, hardlinks only]
B[RadixArk Hybrid-Sharp delta<br/>FP8 blockwise dense bypass] -->|300 FP8 weight pairs| C
A -->|mtp.* FP8 tensors| D[qwen38-draft-mtp-fp8 draft tree<br/>07-prepare]
H[tokenmap/hot_token_map_de_code_65536.pt] -->|draft lm_head rows| E
C --> E[SGLang server<br/>--quantization modelopt_fp4 → modelopt_mixed<br/>NEXTN 3/1/4, vision on]
D --> E
| domain | format | runner |
|---|---|---|
| target routed experts (48 layers × 512) | NVFP4 (ModelOpt) | flashinfer_cutlass |
| target dense bypass (attn / GDN / shared expert / hyper-connection) | FP8 e4m3 blockwise [128,128] | fp8-gemm auto |
| MTP draft routed experts | FP8 e4m3 blockwise, serialized | triton (--speculative-moe-runner-backend triton) |
draft lm_head | BF16, restricted to 65,536 hot ids | cuBLAS |
Key runtime facts from upstream still hold: the draft must load from its own tree
(_mtp_quant_config drops quantization for drafts inheriting a modelopt_mixed target);
Fp8MoEMethod has no cutlass runner, hence the triton draft MoE; YaRN is injected via
--json-model-override-args without original_max_position_embeddings.
--device nvidia.com/gpu=all)uv/uvx, Hugging Face CLI login (uvx --from huggingface_hub hf auth login)git clone <this repo> qwen38-flash-next-gb10-sglang && cd qwen38-flash-next-gb10-sglang
export MODEL_DIR=$HOME/ai-models
bash scripts/00-download.sh # ~137 GB, pinned revisions -> DOWNLOAD-OK
bash scripts/02-build-trees.sh # target merge + FP8 draft tree -> HYBRIDSHARP-NV-OK, DRAFT-OK
bash bounded-ple/01-build-bounded-ple.sh # pulls base by digest, builds io_uring -> "smoke test: PASS"
bash bounded-ple/01b-build-hybrid-runtime.sh # server-args gate -> "gate: PASS"
bash scripts/03-probe-trees.sh # CPU probes in image -> PROBE-MIXED-OK, PROBE-DRAFT-FP8-OK
bash bounded-ple/hybrid-start-nv.sh # ~10 min load; health + smoke + rollback trap
Deploy knobs (environment, read by bounded-ple/05-deploy-hybrid-sharp.sh):
| variable | default | meaning |
|---|---|---|
HOST_BIND | 127.0.0.1 | set 0.0.0.0 to serve the LAN |
HOST_PORT | 8000 | OpenAI-compatible API, /metrics, /health |
API_KEY | empty | bearer token required when set |
RESTART_POLICY | unless-stopped | survive reboots; docker stop keeps it down |
SPEC_TOKEN_MAP | tokenmap/hot_token_map_de_code_65536.pt | empty = full-vocab draft head |
LANGUAGE_ONLY | 0 | 1 = upstream text-only behaviour |
SPEC_STEPS / SPEC_DRAFT_TOKENS | 3 / 4 | 4 is the maximum: QSA requires draft tokens ≤ compress ratio 4 |
ALLOW_AUTO_TRUNCATE | 0 | 1 restores upstream's silent input truncation instead of an error |
NAME | qwen38-flash-next | container name |
SERVED_MODEL_NAME | qwen3.8-flash-next | model id in the API |
Port, bind, key, restart policy, token map, spec and vision knobs are not part of the
deploy fingerprint: combine changes with FORCE_REDEPLOY=1.
Crash loop note: with unless-stopped, a server that keeps dying is restarted forever
(each start loads 76 GB for ~10 min). Use bash bounded-ple/hybrid-stop.sh.
Every step above was re-run from a fresh clone of this repo on 2026-09-17, including a
byte-identical rebuild of both model trees and a numerically identical deployment
(teacher-forced NLL equal to 4 decimals). Full log: results/cleanroom-2026-09-17.md.
python3 tests/crashtest.py # prefix hit, 9.6k-token prompt, follow-up — all "OK", correct facts
python3 tests/spec_bench.py mylabel 3 # streaming decode for code / prose / German / thinking
python3 tests/quality.py mylabel # teacher-forced NLL (exactly reproducible) + task checks
uv run --no-project --with huggingface_hub --with pyarrow \
python3 tests/gsm8k_eval.py mylabel 200 --thinking # accuracy sanity check
QWEN_BASE_URL=http://host:8000 python3 tests/crashtest.py # remote server
Server log lines to expect:
| what | expected line |
|---|---|
| mixed entry | Load weight end ... type=Qwen4ExpForConditionalGeneration, quant=modelopt_mixed, quant_algo=MIXED_PRECISION |
| FP8 draft (not BF16) | Load weight end ... type=Qwen4ExpForCausalLMMTP, quant=fp8 |
| PLE | Qwen4 PLE NVMe backend=io_uring O_DIRECT queue_depth=512 max_batch_pages=4096 cache_pages=0 |
| pool | KV Cache is allocated. dtype: torch.float8_e4m3fn, #tokens: 11xxxxx |
| vision | no [language_model_only] ... skipped N visual weights line |
| expected warnings | rope_scaling (type=yarn) missing key 'original_max_position_embeddings', Using FP8 KV cache but no scaling factors, Using default MoE kernel config (draft MoE, 1.5 % of step time) |
As of SGLang v0.5.21 every patch in this fork exists upstream, and scripts/10-deploy-upstream.sh
deploys the same trees on the stock image with no overlays. It boots, but the merged Hybrid-Sharp tree
emits garbage there — isolated to the tree itself, not to speculation, the token map, the PLE
table or the quantization flag. The plain NVIDIA NVFP4 checkpoint does work upstream, at 28 tok/s
versus 59 tok/s here, because upstream cannot read the FP8 dense bypass that makes this recipe
fast. The pinned 4ccff141 + overlays therefore remain the supported path:
docs/gb10-findings.md §11.
Long-context fidelity is clean (verbatim lines and retrieval exact at 172k prompt tokens,
tests/longctx_fidelity.py), and identifier fidelity is 30/30. But a file-writing agent needs
generous max_tokens: a full single-file HTML page is ≈2,300 completion tokens inside the
tool-call argument. At max_tokens=2048 the server returns finish_reason=length and the
truncated arguments still parse as valid JSON, so a client writes a broken file and the
model loops trying to repair it. Set max_tokens ≥ 16k in your client and reject tool calls
whose finish_reason is length; leaving max_tokens unset works too (measured: 10,432
tokens, finish_reason=stop, complete file). No server flag can raise a client's explicit cap
— --max-total-tokens only sizes the KV pool. On the input side this fork does drop upstream's
--allow-auto-truncate, so an over-long prompt now fails with HTTP 400 instead of being cut
silently. Details: docs/gb10-findings.md §9.
Per speculative step this stack takes 72 ms vs ≈54 ms implied upstream (63.1 / 3.41), at
equal acceptance (3.43 on code) and 99 % GPU busy. Ruled out by measurement: measurement
method (TTFT 0.2 s), acceptance, draft MoE config, vision (A/B), library versions,
hot-path source diffs between the PR head and 4ccff141, throttling and swap.
Profile per step: 38 % BF16 GEMM (verify + draft lm_head), 21 % NVFP4 experts, 17 % FP8
dense, 10 % hyper-connection mix. The upstream author's private base image contained code no
public SGLang has; that is the most likely difference. The hot-token map recovers most of
the gap. Details and all tested levers: docs/gb10-findings.md.
scripts/ 00-download, 02-build-trees, 03-probe-trees
bounded-ple/ 01/01b image builds, Dockerfiles, 05 deploy, start/stop, PLE overlay, vendored rust/
build/ runtime overlays (loader, fp8, modelopt_quant, kda backend + stub), tree builders 06/07/08, probes
tokenmap/ hot-token map, build_map.py (byte-identical rebuild), corpora, gen_corpus.py
tests/ crash regression, decode bench, quality/NLL, GSM8K, golden, BF16 kernel microtest
results/ raw outputs of the 2026-09-17 runs incl. the clean-room validation
upstream-pr/ prepared (unsubmitted) SGLang patch for the fp8-KV extend crash
docs/ gb10-findings.md (this fork), runbook-spark2.de.md, upstream failure-history / verification / memory-budget
LICENSE).bounded-ple/rust/ and SGLang-derived overlays in build/ and bounded-ple/overlay/: Apache-2.0 (LICENSES/Apache-2.0.txt).tokenmap/: token ids of the Qwen3.8 tokenizer and model outputs (Qwen Community License 1.0 notice in LICENSES/); corpus_de_wiki.txt.xz is Wikipedia text under CC BY-SA 4.0; corpus_local.txt.xz is SGLang source (Apache-2.0). See tokenmap/README.md.Measured on one GB10 in one day. Verify on your own hardware.