by Mia's AI Lab
NVIDIA's quantization-aware-distilled (QAD) FP4 checkpoint, close to bf16. The default model is
nvidia/Qwen3.8-Flash-Next-FP4-Local: NVIDIA trained the NVFP4 and MXFP8 weights against the bf16 model as teacher, so the 4-bit weights are tuned to match it. On NVIDIA's own numbers it scores 91.5% on GPQA Diamond and 88.7% on ToolEvalBench against 92.2% and 89.4% for bf16 (model card, not measured here). It is what./start.shserves; the performance numbers below are for it.
Serve Qwen3.8 Flash Next from a single NVIDIA DGX Spark (GB10, 128 GB) through an OpenAI-compatible API. It runs
TensorFold's Zig engine, tensorfold-native (release
v1.2.7, commit 93a2e93e, with this recipe's patches on top), in NVIDIA's PyTorch container. One GPU,
with image input (VISION=1) and, with VIDEO=1, video too (see Images and video). VISION=0 serves text only.
The default checkpoint is NVIDIA's FP4 QAD export: routed experts in NVFP4 (group size 16, CSF-compressed scale factors),
attention and shared-expert linears in MXFP8, the MTP experts and the vision tower quantized too (MXFP8 attention, W4A16
NVFP4 MLP), an FP8 n-gram table, and all 512 routed experts with 10 per token (the INT4 cut keeps 5). The INT4-AutoRound checkpoint (served by the db281878 recipe on main, not by this branch) uses 5 experts per token (4.8B active
parameters) and scores about 10% lower general capability on its authors' own harness (46.6-47.6 against 51.8). Tool use
is unchanged.
- Checkpoint (default):
nvidia/Qwen3.8-Flash-Next-FP4-Localat revisionb9ce18a6887e18c089fdea8509a33e63429a3300(~96 GiB; loading takes about 81 GiB of memory with vision on, measured). - Checkpoint (not supported on this branch; the db281878 recipe on
mainserves it):azampatti/Qwen3.8-Flash-Next-125B-A5B-INT4-AutoRoundat revision1464274120d36a4d8fcaa934552334a7d83ce0fd(~122 GiB). Routed experts are GPTQ int4 (group size 128), the n-gram table is FP8 and lives inple-table/, and it is loaded with the weights. There is no SSD n-gram reader and no int8 KV cache. KV is FP8 by default (lossy, ~98.8% top-1 agreement with bf16);KV_DTYPE=bf16is exact. FP8 works with image input. - API model id:
Qwen3.8-Flash-Next - Context: 262,144 tokens a request (the native window). Up to 5 requests at once (
PARALLEL). A full 262,144-token window takes 4.78 GiB a stream with the fp8 cache, and aPARALLELwhose windows do not all fit is refused when the server starts (see KV and memory). The engine keeps 9 GiB free, and another 2 GiB for the vision path. - One command:
./start.shsets everything up on the first run and starts the server;./stop.shstops it
The sparkDash tables below are the v1.1.4 build's (TensorFold v1.1.4 with its patches
0001to0017, 2026-10-27). The recipe now builds TensorFold v1.2.7 with patches0001to0013(What the patches are; the A/B below ran on0001to0004); sparkDash has not been re-run on it. What has been measured is an A/B of the two builds withtools/bench_streams.pyon the same Spark (2026-11-12, defaults, greedy, 256 tokens, median of 3, every stream the same prompt; v1.2.7 here with its default 1,536-row passes):
v1.1.4 build v1.2.7 build Change Decode prose, 1 / 3 / 5 streams (total tok/s) 57.8 / 133.4 / 167.9 58.5 / 156.1 / 230.1 +1% / +17% / +37% Decode code, 1 / 3 / 5 streams (total tok/s) 48.2 / 104.0 / 141.3 51.9 / 138.8 / 206.8 +8% / +33% / +46% TTFT at 5 streams, prose / code (ms) 440 / 372 177 / 173 -60% / -53% Prefill 4k / 31k / 126k tokens (tok/s) 2,329 / 2,566 / 2,397 2,108 / 2,166 / 2,047 -9% / -16% / -15% With
TF_FLASHNEXT_CHUNK=3072(now the recipe's default, as the v1.1.4 build had) v1.2.7 prefilled 2,143 / 2,252 / 2,140 tok/s. With patch0004(the MXFP8 prompt tile, ported 2026-11-13) it prefills 2,303 / 2,443 / 2,293 tok/s, 1-5% behind the v1.1.4 build, and a 199,730-token prompt in 95.7 s (v1.1.4: 100.7 s). Decode and time to first token are unchanged by0004and faster than v1.1.4 at every stream count.
Numbers for the default checkpoint, nvidia/Qwen3.8-Flash-Next-FP4-Local (NVIDIA's QAD FP4 export), as ./start.sh served it: 262,144-token
window, 5 requests at once, fp8 KV, vision on, MTP drafts, TensorFold v1.1.4 with patches 0001 to 0017. One DGX Spark (GB10), measured with
sparkDash's Decode and Prefill benchmarks, running on the same Spark as the server (no network between
them). Prose: temperature 0.7, thinking on. Code: temperature 0, thinking off. Aggregate is the sum of the per-request decode speeds; TTFT is the
time to the first token.
How a decode figure is taken (sparkDash's DecodeBench): each request streams, and its decode speed is (completion_tokens - 1) / (time of the last streamed token - time of the first), so TTFT is not in it. The prose prompt asks for a step-by-step explanation of how a hash map works. The code prompts (DECODE_CODE_TASKS in sparkDash's
src/shared/llmPrompts.js) each name a small Python function or class and end "Output only Python source. No comments, no docstrings, no markdown fences. Then add tests and the helpers this
needs. Keep writing code.", and every concurrent stream gets a different task. MTP drafts pay only when they are accepted, so decode speed depends on the text: a code request that asks for docstrings and
comments, or a different prose prompt, decodes at another speed, and a figure from another harness is comparable only with the same prompts, sampling and thinking setting. tools/bench_streams.py
uses its own, shorter prompts and does not turn thinking off for code, so its code rows are not comparable with the table's (#85,
#86).
Decode, prose
| Concurrent requests | Aggregate | Per request | TTFT |
|---|---|---|---|
| 1 | 55.6 tok/s | 55.6 tok/s | 136 ms |
| 2 | 95.4 tok/s | 49.4 tok/s | 234 ms |
| 4 | 145.1 tok/s | 38.1 tok/s | 300 ms |
| 5 | 156.1 tok/s | 35.0 tok/s | 370 ms |
Decode, code
| Concurrent requests | Aggregate | Per request | TTFT |
|---|---|---|---|
| 1 | 110.5 tok/s | 110.5 tok/s | 164 ms |
| 2 | 147.2 tok/s | 78.7 tok/s | 212 ms |
| 4 | 192.9 tok/s | 52.7 tok/s | 374 ms |
| 5 | 217.6 tok/s | 48.0 tok/s | 403 ms |
Prefill (cold prompts, no prompt-cache hit)
| Prompt tokens | Prefill | TTFT |
|---|---|---|
| 4,134 | 3,050 tok/s | 1.52 s |
| 8,231 | 2,956 tok/s | 2.95 s |
| 16,421 | 2,839 tok/s | 5.95 s |
| 32,807 | 2,735 tok/s | 12.16 s |
| 65,574 | 2,230 tok/s | 29.57 s |
| 131,110 | 2,269 tok/s | 57.94 s |
Three concurrent requests were not part of this run. Against the previous sparkDash run of the db281878 build with patches 0001 to 0015 (same Spark, same
tool; the CHANGELOG has every row): prose aggregate is +10% at one request, +30% at two, +36% at four and +18% at five; code is +63%, +47%, +47% and +45%;
cold prefill is +14.5% at 4k, +14.4% at 8k, +13.5% at 16k, +12.6% at 32k, -4.3% at 64k and +3.3% at 128k. Time to first token under load is higher at four
and five requests (+23% and +39% on prose, +16% and +24% on code) and lower at one (-30% prose, -9% code). The 64k prefill point reads below the 32k and 128k points and
below the 2,331 tok/s of the earlier run; we have not repeated it, so treat it as one noisy reading until we do.
Single-stream prose varied from run to run in the earlier measurements, 46 to 55 tok/s with the same settings (46.2, 46.9, 48.5 and 55.0 tok/s in four runs, about 15%). The one new reading, 55.6 tok/s, is at the top of that range, so the +10% at one request is within the old spread. Run sparkDash on the Spark itself: from another machine over a slow link it adds the link's round trip to every TTFT (about 1.1 s over a 387 ms Tailscale path in our test) and staggers the requests, which lowers the multi-stream numbers.
Against our earlier Python-engine build of the same checkpoint (measured the same way on another Spark: prose 54.4, 81.3, 88.5, 101.6 and 123.1 tok/s aggregate at 1 to 5 requests; code 84.9, 128.3, 142.3, 159.5 and 181.9; prefill 2,315 tok/s at 4k down to 1,889 at 128k), this build is ahead at every point measured: prose +2% at one request, +17% at two, +43% at four and +27% at five; code +30%, +15%, +21% and +20%; prefill +32% at 4k and +20% at 128k. The Python numbers come from an earlier run with its own settings, so read these percentages as indicative.
On the v1.2.7 build with patches 0001 to 0004 (2026-11-13, one Spark, the defaults: 5 requests, 262,144-token window, fp8 KV, vision on), all passing:
tools/exact.py --pad 3000 (six drafted greedy replies, 551 drafts accepted, equal "draft": false; six concurrent equal one-at-a-time) and tools/exact.py,
tools/toolcheck.py 3/3, tools/visioncheck.py, tools/prompt_reuse.py 30000 (worst 99.3%), a 199,730-token needle found (prefill 95.7 s),
tools/context_boundary.py --context 262144 (16 checks), and tf-cuda-test qmmf-prompt-mx on the GPU (the prompt tile's FP64 bound and row-independent bytes).
With patches 0001 to 0003 (2026-11-12) the same checks passed, plus live tool_choice: "required", a named function, Anthropic {"type":"any"} and a
response_format JSON schema. Not re-run on v1.2.7: the sampled-exactness check.
0005 (video) has not been run on a Spark: it compiles (zig build check-native-cuda-host, zig 0.17.0) and its library builds (zig build video), but no
server has served a video from this image. Nothing a text request runs goes through it, and an image request meets only its placeholder check, which now
accepts a group of <|video_pad|> rows beside the image groups it already knew.
Run on one DGX Spark with the defaults (5 requests, 262,144-token window, fp8 KV, vision on), all passing. The sampled-exactness check and the 200k needle ran on the integration build with patches 0001 to 0016 (patch 0017 changes only how many drafts are proposed); the others also ran on the live container with 0017:
tools/exact.py --pad 3000: six drafted greedy replies (538 drafts accepted) equal the"draft": falseones, and six concurrent replies equal the one-at-a-time ones.- A sampled-exactness check (six sampled replies, drafted against
"draft": false, equal across runs) with the engine's prompt-keyed seeds (--prompt-seed). tools/toolcheck.py3/3,tools/visioncheck.py(the model sees the red circle and the blue square),tools/prompt_reuse.py 30000(every follow-up resumed at least 90% of its prompt, worst 99.3%).- A 199,730-token needle in a haystack is found, with a prefill of 100.7 s.
tool_choice: "required", a named function, Anthropic{"type":"any"}and aresponse_formatJSON schema each return a valid call or object (live requests).tools/context_boundary.py --context 262144: a prompt plus reply that fills the window is admitted, with drafts on and off; one token over is refused.
- A DGX Spark (or another GB10 system with 128 GB unified memory) with nothing else large on the GPU. The default
window needs
MemAvailableof about 107 GiB at start (loading takes ~81 GiB): weights, one full cache, scratch slack and a floor.start.shstops before launching below that (MEM_NEED_GIB). - Docker with the NVIDIA container runtime, and your user in the
dockergroup. - ~160 GB free disk on a fresh machine: ~96 GiB for the checkpoint under
~/.cache/huggingfaceand the image under Docker's root.scripts/prepare.shchecks both. Keep at least 100 GB free. - Optional: the
hfCLI on the host and a Hugging Face token in~/.cache/huggingface/tokenorHF_TOKEN. The checkpoint is public.ABLIT=1(below) needs a token, because its overlay is gated.
git clone https://github.com/MiaAI-Lab/Qwen3.8-Flash-Next-Single-DGX-Spark-TensorFold.git
cd Qwen3.8-Flash-Next-Single-DGX-Spark-TensorFold
./start.shThe first run builds the engine (TensorFold v1.2.7 plus patches/; the kernels are embedded in the binary) and
downloads the checkpoint if it is not already in the cache. Later starts load the weights. start.sh shows each
step, runs a smoke test, prints Qwen3.8-Flash-Next is now LIVE! on port 8888, and returns you to the shell.
curl -s http://<spark-address>:8888/v1/models
curl -s http://<spark-address>:8888/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "Qwen3.8-Flash-Next",
"messages": [{"role": "user", "content": "Write a Python fibonacci function."}],
"max_tokens": 1000
}'Any OpenAI client works with base_url = "http://<spark-address>:8888/v1" and the model Qwen3.8-Flash-Next.
Streaming, tool calls and reasoning content are supported. The model thinks before it answers, so give replies
enough max_tokens. "draft": false on a request serves one token at a time; a drafted reply matches that.
./start.sh restart
./stop.sh
docker logs -f qwen38-flash-next-tf
curl -s http://<spark-address>:8888/health./start.sh serves NVIDIA's FP4 QAD checkpoint, nvidia/Qwen3.8-Flash-Next-FP4-Local at the pinned revision (CHECKPOINT=nvfp4, the default). The
INT4-AutoRound checkpoint (CHECKPOINT=int4) is not supported on this branch: TensorFold's Flash Next CUDA engine has no INT4 path, and none of the numbers
or patches here were tried with it. The db281878 recipe on main still serves it.
Check which checkpoint is running with docker inspect -f '{{.Config.Cmd}}' qwen38-flash-next-tf: the path after serve names it. DRY_RUN=1 ./start.sh
prints what a start would do (the model, the memory it needs and the docker command) without stopping or starting anything. To serve a different model directory of the same
format, set MODEL_ID (and MODEL_REVISION, or leave it empty for the latest) instead of CHECKPOINT. A MODEL_ID set by hand takes no preset revision pin.
ABLIT=1 serves NVIDIA's FP4 checkpoint with drowzeys's Keys "house-qsa" abliteration overlay
grafted in. The overlay replaces 24 tensors: self_attn.o_proj (weight and scale, MXFP8) of the 12 attention (QSA) layers (L3, 7, 11, ... 47), edited by a
rank-1 refusal-direction projection and requantized. DeltaNet out_proj, every expert, the MTP head, the n-gram table, the vision tower and the chat template stay NVIDIA's
(see the overlay's own ABLIT_META.json). The model has had its safety refusals removed; read the overlay's Responsible Use Agreement, which you accept to download it.
The overlay is gated, free and approved automatically. Accept its terms at its Hugging Face page while logged in, then export HF_TOKEN=hf_... or hf auth login
with that account, before:
ABLIT=1 ./start.sh restartSet ABLIT=0 (the default) to return to the stock checkpoint. The first ABLIT=1 start downloads the overlay's ~190 MB sidecar; the checkpoint itself is not downloaded
again and is not modified. The replaced tensors have the stock tensors' dtypes and shapes, so the memory a start needs is the same; speed has not been measured with the overlay.
How it is applied: scripts/prepare.sh runs scripts/ablit_view.py, which builds a folder $HF_CACHE/tensorfold-qwen38/ablit-b9ce18a6-c44f5b92 holding
symlinks to every file of the stock snapshot, the sidecar as tensors/house-qsa-oproj-mxfp8-L3-47.safetensors, and a model.safetensors.index.json that points the 24 tensor
names at it. TensorFold's engine reads the shards its index names, in path order, and takes a tensor from the first shard that holds it; the sidecar's path sorts before the
stock tensors/model-* shards. The script refuses to build the folder if the sidecar does not hold exactly those 24 names, if a stock tensor has another dtype or shape, or if the
sidecar would not sort first. It only works for CHECKPOINT=nvfp4 at the pinned revision (ABLIT=1 with another MODEL_ID, MODEL_REVISION or CHECKPOINT=int4 stops with a message). Check it
is active with docker inspect -f '{{.Config.Cmd}}' qwen38-flash-next-tf: the path after serve ends in ablit-b9ce18a6-c44f5b92.
What has been checked. The folder builder against the real sidecar and the real stock index and shard headers (24 of 24 names, same dtypes and shapes), and offline tests
(tools/test_ablit_view.py). A server has booted with ABLIT=1 on this build and answered /health; tools/exact.py, tools/needle.py and a refusal check on it have not been run yet. The overlay author's own
numbers (refusal32 32/32 on a thinking-off run of their TensorFold recipe) are theirs, not measured here. The edit changes the weights, so replies differ from the stock checkpoint's: the byte-identical
checks in this repository compare a build against itself, not ABLIT=1 against ABLIT=0.
The model's own vision tower (27 layers, 0.84 GiB, from the same checkpoint) turns images into tokens. The engine decodes them itself (libjpeg-turbo for JPEG, libwebp's decoder for WebP, both built into the image) and runs the tower on the GPU. Send them as OpenAI-style content parts in a user message:
IMG=$(base64 -w0 photo.jpg)
curl -s http://<spark-address>:8888/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "Qwen3.8-Flash-Next",
"messages": [{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,'"$IMG"'"}},
{"type": "text", "text": "What is in this picture?"}]}],
"max_tokens": 2000
}'Video is opt-in (VIDEO=1 ./start.sh restart). The engine samples a clip at 2 frames a second and gives the tower
two frames a group, each group costing tokens like an image does. Decoding runs in the server through
libtfvideo.so — TensorFold's own tf_video.c over a static FFmpeg 9.0.2 that scripts/prepare.sh builds from the
tarball whose SHA-256 it pins, configured with only the H.264, HEVC, VP8, VP9 and MPEG-4 decoders, the MP4/MOV and
Matroska/WebM demuxers, and --disable-network and --disable-programs. The image keeps that library in
/opt/tensorfold/libexec/tfvideo, off every path the server probes for it, so with the default VIDEO=0 a
video_url part is refused and nothing links FFmpeg at all; VIDEO=1 puts that directory on the loader's path and
passes --vision-video-tokens. It needs VISION=1, and takes OpenAI's part shape:
VID=$(base64 -w0 clip.mp4)
curl -s http://<spark-address>:8888/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "Qwen3.8-Flash-Next",
"messages": [{"role": "user", "content": [
{"type": "video_url", "video_url": {"url": "data:video/mp4;base64,'"$VID"'"}},
{"type": "text", "text": "What happens in this clip?"}]}],
"max_tokens": 2000
}'-
Per request: up to
MAX_VIDEOSclips (4) sharingTENSORFOLD_VIDEO_TOKENS(16,384 rows) between them, at most 256 frames a clip. A clip's frame groups count against the same 50-group and 16,384-row budgets as images, so with everything at its defaults a request carries roughly 50 seconds of footage, its images included. -
Where it comes from: the engine patch is chai-md's (#90), re-based onto v1.2.7 as
patches/0005; the server side (--vision-max-videos,--vision-video-tokens, the video part, the sampler incore/qwen_vl/video.zig) is TensorFold's, and it is the same path the Triton host already runs. -
Not measured on a Spark yet: the patch compiles (
zig build check-native-cuda-host) andzig build videomakes the library, but no live video request has been served here, andtools/visioncheck.pycovers images only. Say what you see. -
Formats: JPEG, PNG, WebP.
-
Per request: up to 50 images (all of a chat's turns count), 10 MB each, 64 MB in all.
-
Tokens: up to 16,384 for all images, at most 4,096 an image (
"detail": "low": 256 an image).
PDF document parts are opt-in (PDF=1 ./start.sh restart). With it the server takes --vision-pdf and reads Anthropic's
{"type": "document"} part, OpenAI's file / input_file part and an image_url carrying a data:application/pdf;base64,
URL: the engine renders each page to an image with its own PDFium (libpdfium.so, from the pinned pypdfium2 wheel in the
image) and the request continues as an image prompt. Upstream's caps apply: 32 MiB a document, 16 pages
(TENSORFOLD_MAX_PDF_PAGES lowers the count) and the pages share the request's image budget; the document's bytes are
checked before anything parses them, and rendering runs in a tensorfold-native --pdf-render-worker child started per
document and killed at its deadline. Inline data only: a document.source.url is refused rather than fetched, and
VISION_URLS does not change that. Without PDF=1 these parts are refused with PDF inputs are off on this server; start the server with --vision --vision-pdf, so a client never gets a silently different treatment than it asked for.
By default only data URLs are accepted. VISION_URLS=1 also lets the server fetch public https:// URLs. Image prompts are kept for prefix reuse
(each image matched by a hash of its bytes, built into TensorFold since v1.1.4), so a chat's next turn after an image
prefills only its new rows, but the vision tower still runs for every image each turn. A request body
can be up to 96 MiB. VISION=0 ./start.sh restart serves text only and gives the 2 GiB vision workspace back to the
KV pool.
Measured on the Zig engine at TP=1 with --vision (warm, three reps): one image (1,217 tokens) 1.0 s to first token,
10 images (3,035 tokens) 2.3 s. The first use of a new size is slower (a
5,107-token image took 35 s). The Python helper those runs measured stayed at 0.84 GiB for the tower and peaked around 1–1.7 GiB. Text replies
with vision on matched the text-only engine. Those timings are from that engine build; this recipe's own vision boot
has not been taken while the text server is in use.
- Setup:
scripts/prepare.shwhen the image or the checkpoint is not the one these settings name. - Checks: the arguments (tensorfold-native's own parser, in a throwaway container), the port, and free memory.
A typo leaves a running server alone.
./start.sh restartstops only after those checks pass. - Launch:
tensorfold-native servewith the settings fromscripts/config.sh. - Loading: the log, and a stop if
MemAvailablefalls belowMEM_FLOOR_GIB(9 GiB, the memory reserve). - Smoke test, then the LIVE message.
FOREGROUND=1 ./start.sh stays attached and exits with the container's exit code. Extra arguments go to
tensorfold-native serve after the defaults (./start.sh restart --context 131072). DRY_RUN=1 ./start.sh prints
the docker command and changes nothing.
scripts/prepare.sh:
- Preflight: Docker, disk.
- The image
tensorfold-qwen38:v1.2.7-93a2e93: TensorFold v1.2.7 (TF_REF) with everypatches/*.patchapplied, Zig 0.17.0, libjpeg-turbo and libwebp's decoder (built from checksummed sources), FFmpeg 9.0.2 andlibtfvideo.so(zig build video, off the paths the server probes) and the wheel'slibpdfium.so, onnvcr.io/nvidia/pytorch:26.07-py3; the build runsfatbins native video.libtfgrammar.sois copied out of TensorFold's v1.2.7 release archive (SHA-256 pinned inconfig.sh, the same as the release's own.sha256). It tries a matching prebuilt image from GitHub Container Registry first (PULL=0builds locally). No image of the v1.2.7 patch set is published yet, so the first run builds it; the v1.1.4 image (v1.1.4-eab8582-4baf16137ecd) stays in the registry. - The checkpoint, at the pinned revision.
- A check that it is a
qwen4_expModelOpt NVFP4 checkpoint and every shard present. - With
ABLIT=1only: the overlay's sidecar from Hugging Face, and the checkpoint folder with it grafted in (ABLIT).
scripts/prepare.sh
scripts/prepare.sh --rebuild
PREPARE=1 ./start.sh restartscripts/harden.sh (new) cuts the parts of NVIDIA's NGC base this recipe never runs, as a layer of its own: linux-libc-dev
(the container shares the host's kernel), the Nsight profilers, and Debian's python3-pip/python3-setuptools with their
vendored urllib3 and msgpack copies, then reinstalls python3-yaml, which apt-get autoremove otherwise takes and which
the container-side checkpoint download imports. It never touches $IMAGE: it tags
tensorfold-qwen38:<tag>-hardened-<hash> beside it, and you serve that one with
IMAGE=tensorfold-qwen38:<tag>-hardened-<hash> ./start.sh restart. Nothing in prepare.sh or start.sh runs it, so the
default image and its published tag are unchanged.
Two knobs, both off by default because both trade reproducibility for CVE counts: APT_UPGRADE=1 (an apt-get upgrade, so
distro fixes the scanner wants) and PIP_UPGRADE="urllib3==2.8.0 pillow==13.0.0" (pip versions by name; nothing is pinned or
upgraded unless you name it). PIP_UNINSTALL="wandb jupyterlab notebook nbconvert jupyter_server flash_attn" covers a base
that still carries them — the pinned 26.07-py3 does not, so it is empty here.
The script calls no scanner (nothing here is installed to run one) and promises no CVE count: issue #77
reports 28 CRITICAL and 628 HIGH falling to 0 and 0, measured on the older zig-db28187 image, and no scan has been run
against this one. What it does promise is a gate you can trust without a scanner: the new tag is kept only if
tensorfold-native --help and tensorfold-native serve --help still run, the decoders are still where the engine looks, and
yaml, requests, filelock, fsspec, packaging, huggingface_hub plus the hf CLI are still there for the download path —
otherwise it removes the tag and leaves $IMAGE alone. Run it and the check yourself:
scripts/harden.sh # ~1 min on a cached base
trivy image --severity CRITICAL,HIGH tensorfold-qwen38:v1.2.7-93a2e93-hardened-<hash> # your scanner, your countsOne expectation to set: the image does not get smaller. The purged files go into a later layer as whiteouts, so the base's layers still hold their bytes; what changes is the filesystem the server — and a scanner that reads the merged rootfs — sees.
KV is FP8 by default (KV_DTYPE=fp8). It is lossy: about 98.8% top-1 agreement with a bf16 cache, so a free-running
reply can differ from the bf16 one. KV_DTYPE=bf16 is the exact cache. FP8 works together with image input.
The format is adapted from MiaAI-Lab's GLM recipe patch 0038-glm-kv-fp8.
One token's cache at TP=1, 13 layers (12 attention plus the MTP head):
| bytes a token | one 262,144-token sequence | |
|---|---|---|
| bf16 | 30,784 | 7.52 GiB |
| fp8 | 17,888 | 4.37 GiB |
FP8 stores keys with both scales and values as codes. The indexer key (256 bytes) and pooled blocks (64 bytes) stay bf16. For scale, a 1,048,576-token sequence would take 17.46 GiB of fp8 cache and 30.06 GiB of bf16; the window this build serves stops at 262,144 (below).
Total available KV cache with the default checkpoint (NVIDIA FP4): about 27 to 29 GiB, roughly 1.4 to 1.6 million fp8 tokens. That is the pool the engine
reports at start (the server log line "N streams at once, 4.78 GiB each ... of 29.0 GiB left after a 9.0 GiB reserve"), measured on a Spark with vision on and
PARALLEL=5: 28.0, 29.0 and 27.3 GiB on three starts. The engine counts 4.78 GiB for each stream at a 262,144-token window. Loading the weights takes about
81 GiB of memory (the 26.8 GiB NVFP4 n-gram table is read from disk by the host through the page cache, not held on the GPU). The pool is MemAvailable after
the weights load, minus TENSORFOLD_MEMORY_RESERVE_GIB (9 GiB), and with VISION=1 minus 2 GiB kept for the vision path (TENSORFOLD_VISION_WORKSPACE_MIB; the tower
peaks around 0.9-1.7 GiB). It follows the free memory at start (other containers on the machine shrink it), and each GiB less reserve adds a GiB to it.
VISION=0 returns the 2 GiB helper workspace to the pool.
Every stream gets a full window when the server starts. Five windows take 23.9 GiB, and what is left of the pool is the prompt cache (3.4 to 5.1 GiB
on the starts above). A PARALLEL whose windows do not all fit is refused at start: PARALLEL=8 at 262,144 tokens needs 38.27 GiB and the server answered
"the CUDA memory budget leaves 27.22 GiB". Within the pool, a request is admitted when its prompt plus its reply budget (max_tokens) fits beside the others;
one that does not fit is refused, not queued.
The prompt cache is a cap, not a reservation. On CUDA the prompt cache takes at most what the weights and the streams leave, so --prompt-cache-gib (pass it after the defaults:
./start.sh restart --prompt-cache-gib 12) can only lower the 3.4 to 5.1 GiB above, never raise it: at 5 streams a larger value changes nothing, and it binds only when the leftover is bigger
(a smaller PARALLEL or --context). --prompt-cache-over-cap is refused on CUDA (it lifts a Mac's 70% cap). A larger cache for long multi-turn prompts costs streams or
window length: PARALLEL=4 leaves one window's 4.78 GiB more for the cache than five do (#81).
PARALLEL=6 at 262,144 tokens (28.7 GiB) fits only with a smaller reserve. We tried TENSORFOLD_MEMORY_RESERVE_GIB=7: it started ("28.9 GiB left after a 7.0 GiB
reserve"), tools/exact.py, toolcheck.py and visioncheck.py passed and decode speed was unchanged, but the prompt cache fell to 0.2 GiB and
tools/prompt_reuse.py 30000 failed (a 32k-token follow-up resumed 4.7% of its prompt and prefilled again, 13.8 s). Multi-turn use then re-reads its history on
every turn, so we left the default at 5. Each GiB the reserve gives up is a GiB of page cache the n-gram table loses, so it is not free. For more streams, lower CONTEXT instead: eight streams at 163,840 tokens need about 24 GiB (calculated from the sizes above, not run).
262,144 is the maximum window on this build. The Flash Next CUDA engine of TensorFold v1.2.7 has no YaRN
extension: the family refuses a scaled rope (families/flashnext/cuda_config.zig), so the 1,048,576-token window the
older recipes offered is not reachable here, and start.sh stops any larger setting. Restoring it needs engine
support and a re-measurement (#89).
prepare.sh and start.sh refuse to run when MemAvailable is under 9 GiB (MEM_FLOOR_GIB). Keep at least 9 GiB
free under load. On this machine, exhausting unified memory freezes it.
Under a long mixed load the stock 1.0.0 engine could log NV_ERR_NO_MEMORY ... _memdescAllocInternal in the kernel log while MemAvailable stayed above 30 GiB, with no
failed request. The cause traced to the cuMemCreate calls that grow a kept prompt state, and to 64 KiB system-memory pages that must be physically contiguous
(NVIDIA's driver retries eligible allocations with 4 KiB pages). The opt-in mitigation patch of the 1.0.0 recipe (TF_FLASHNEXT_SYSTEM_CACHE, TF_FLASHNEXT_RING_CACHE) is not
part of the v1.1.4 patch series, and those settings do not exist in this build. We have not re-run the reproduction load on v1.1.4, so we do not know whether the messages still appear.
The driver-side workaround is independent of the engine: the nvidia module option NVreg_RegistryDwords="RmEnableLargePageSizeSysmemDefault=0" (reboot) makes default
system-memory allocations start at 4 KiB. In one 45-minute run on kernel 6.17.0-1031-nvidia with the 1.0.0 engine it gave 0 messages against 139, at 58.6 instead of 62.8 tok/s.
Every setting lives in scripts/config.sh. Override it from the environment
(PARALLEL=2 ./start.sh; the memory a PARALLEL needs is explained under KV and memory) or from .env next to start.sh (KEY=value; the environment wins).
| Variable | Default | Meaning |
|---|---|---|
PARALLEL |
5 |
requests decoded together. One that would not fit (prompt plus max_tokens) is refused |
CONTEXT |
262144 |
prompt + reply window; 262,144 is the maximum (this engine has no YaRN extension) |
DRAFTS |
1 |
MTP drafts; 0 passes --no-drafts |
TEMPERATURE / TOP_P / TOP_K |
1.0 / 0.95 / 20 |
default sampling; a request's own values win |
THINKING |
1 |
think before answering; 0 passes --no-thinking |
MAX_TOKENS |
32768 |
the reply budget when a request sets none |
VISION / VISION_URLS |
1 / 0 |
images (--vision); VISION_URLS=1 also accepts public https:// URLs |
PDF |
0 |
1 passes --vision-pdf: PDF document parts rendered by the engine's PDFium (32 MiB, 16 pages, needs VISION=1) |
VIDEO |
0 |
1 takes video_url parts: puts the image's libtfvideo.so (FFmpeg 9.0.2) on the loader's path and passes --vision-video-tokens (needs VISION=1) |
TENSORFOLD_MAX_IMAGES / TENSORFOLD_IMAGE_TOKENS |
50 / 16384 |
image groups a request may carry, and the rows they share (4,096 at most an image); a video's frame groups count among them |
MAX_VIDEOS |
4 |
videos a request (--vision-max-videos, 1 to 16), with VIDEO=1 |
TENSORFOLD_VIDEO_TOKENS |
16384 |
the rows a request's videos share (--vision-video-tokens, 64 to 262,144), with VIDEO=1 |
TENSORFOLD_VISION_WORKSPACE_MIB |
2048 |
kept out of the KV budget for the vision path (the tower and its scratch) |
SERVED_NAME |
Qwen3.8-Flash-Next |
the model id in /v1/models |
PORT / HOST |
8888 / 0.0.0.0 |
where the API listens |
KV_DTYPE |
fp8 |
lossy (~98.8% top-1 agreement with bf16, about 1.8x the pool). bf16 is exact. Works with VISION=1. Adapted from MiaAI-Lab's GLM recipe patch 0038-glm-kv-fp8 |
TENSORFOLD_MEMORY_RESERVE_GIB |
9 |
kept free when the engine sizes the pool (9 since the v1.1.4 build's patch 0014; five full windows need 23.9 GiB). prepare.sh and start.sh refuse a Spark below this |
TF_FLASHNEXT_DRAFTS |
6 |
drafts a round at most |
TF_FLASHNEXT_CONFIDENCE / TF_FLASHNEXT_SHARED_DRAFTS |
-0.4 / 0 |
the draft chain keeps draft j while the running product of the draft probabilities is at least 0.4 (v1.2.7's default, the rule the v1.1.4 build's patch 0017 restored). SHARED_DRAFTS=0 keeps that rule beside other open streams too, where v1.2.7 would switch greedy chains to 0.6 a draft. Only the number of drafts changes, never a reply |
TF_FLASHNEXT_CHUNK |
3072 |
prompt rows a pass (v1.2.7's default 1,536; the v1.1.4 build used 3,072). About 4% faster prefill for 0.8 GiB of the prompt cache; a stream decoding beside a prompt waits up to one pass |
TF_FLASHNEXT_DRAFT_HEAD |
affine4 |
the MTP draft head's rows in 4 bits (a fourth of the bytes a chained draft reads); v1.2.7's default is bf16. Drafts are only proposals, so replies do not change |
TF_FLASHNEXT_PROMPT_EXPERT_TILE |
2 |
NVFP4 prompt experts on shared-memory K32 tiles, gate/up and down (1 gate/up only, 0 off): upstream's opt-in adaptation of the v1.1.4 build's patch 0004/0014 tile |
TF_FLASHNEXT_PROMPT_MX128 |
1024 |
prompt passes put MXFP8 projections this many columns wide or more on patch 0004's tile (+7-9% prefill; prompt rows within the exact kernels' rounding bound, not their bits). 0 keeps the exact kernels |
TF_FLASHNEXT_HC_UPMIX |
1 |
patch 0006: the hyper-connection up-projection mixes its own rows in its epilogue. Same bits; 0 restores the old path |
TF_FLASHNEXT_HEAD_TWOSTAGE |
1 |
patch 0007: the verify pass's lm_head in two exact stages. Same bits; 0 restores the old path |
TF_FLASHNEXT_ATTN_RAW |
1 |
patch 0009: prompt attention stages raw fp8 KV codes (needs KV_DTYPE=fp8). Same bits; 0 restores the old path |
TF_FLASHNEXT_PROMPT_FP4_TC |
0 |
patch 0008: 1 runs the prompt passes' routed MoE gate_up on block-scaled FP4 mma (about +12-15% prefill). Changes the numbers |
TF_FLASHNEXT_QSA_TC |
0 |
patch 0010: 1 scores the QSA indexer of prompt passes on bf16 tensor cores (about +3% prefill at 64k, +1% at 16k). Changes the top-512 near-ties, so replies can differ |
TF_FLASHNEXT_GDN_WY |
0 |
patch 0011: 1 runs the DeltaNet recurrence of prompt passes (128 rows or more, no prompt-cache mark inside) chunkwise on bf16 tensor cores: the kernel is 2.2-2.5x faster, about +3% to +7% prefill at 16k and 64k tokens. Not bit-exact (another order of sums), so replies can differ in wording |
TF_FLASHNEXT_WARM_ASYNC |
1 |
patch 0012: the n-gram file hints of the next prompt chunk run on a helper thread joined before the pass returns (+6% prefill at 16k tokens on fresh prompts). Same bits; 0 restores the synchronous hints |
TF_FLASHNEXT_TABLE_WARM |
1 |
the 26.8 GiB n-gram table is read into the page cache after load (about 40 s in the background, reclaimable): text the server has not seen reads RAM, not the NVMe (+4% decode at one stream and +2% prefill on fresh text). Same bits; 0 leaves it to the page cache's own pace |
TF_FLASHNEXT_CHUNK_SOLO |
unset | rows of a prompt pass while no other stream decodes; 8192 is +4.5% prefill at 16k tokens and exact, but takes 2.6 GiB of the 4.4 GiB prompt cache and makes a request that arrives during a lone prefill wait up to one 8,192-row pass |
TF_FLASHNEXT_MOE_B16 |
0 |
patch 0013: 1 stores the MoE slots (each expert's output row) in bf16 in passes of 256 rows or more and rounds them to bf16 when smaller passes read them: about +4% prefill (+3.7% at 16k, +4.3% at 64k tokens). Changes the numbers, so replies differ in wording from the exact path |
TF_FLASHNEXT_WARM_AHEAD |
1 |
the next prompt chunk's n-gram rows are hinted to the page cache during the current one (upstream opt-in) |
TF_FLASHNEXT_SAMPLED_HEADS / TF_FLASHNEXT_KEEP_LATE / TF_FLASHNEXT_SHARED_SIDE / TF_FLASHNEXT_GDN_LANES |
1 |
v1.2.7's defaults, listed so a .env can turn them off: sampled requests in the batched draft pass, pending DeltaNet rows instead of a replay, the shared expert on a side stream, a shared round's DeltaNet steps in one launch (the v1.1.4 build's patches 0007, 0012 and 0016) |
TF_FLASHNEXT_HEAD_KV |
unset | fp8 keeps the MTP head's own cache in fp8 under KV_DTYPE=fp8; unset, it stays bf16 while the stream fits its charge (patch 0003) |
CHECKPOINT |
nvfp4 |
nvfp4 serves nvidia/Qwen3.8-Flash-Next-FP4-Local. int4 is not supported on this branch. MODEL_ID / MODEL_REVISION override the model |
MODEL_REVISION |
b9ce18a6… |
the checkpoint commit this recipe serves |
ABLIT |
0 |
1 serves the checkpoint with drowzeys's Keys house-qsa abliteration overlay (above); gated, needs HF_TOKEN. Only with CHECKPOINT=nvfp4 at the pinned revision |
KV is fp8 (or bf16). The NVIDIA checkpoint's NVFP4 n-gram table (26.8 GiB) is read from disk by the host
(TF_FLASHNEXT_GATHER_READ=pread by default, with read-ahead of the next prompt chunk; TF_FLASHNEXT_WARM_AHEAD=0 turns that off).
By default the model thinks first. Per request, temperature, top_p, top_k and seed override the defaults
(temperature: 0 is greedy). "chat_template_kwargs": {"enable_thinking": false} answers without thinking, and
"chat_template_kwargs": {"reasoning_effort": "low"} (or "medium", "xhigh") sets reasoning effort. The reasoning
comes back in reasoning_content, the answer in content. A small max_tokens can return empty content because
the model was still thinking.
- A reply that spends its whole
max_tokensthinking:thinking_budget(a request field;--thinking-budget Nas a server default, for example./start.sh restart --thinking-budget 4096) closes the think block after that many reply tokens and lets the answer start (think_budgetinzig/src/core/lanes/stream.zig; the closing is done in the engine's lanes, so drafted and serial replies cut at the same token).reasoning_effort: lowandenable_thinking: falseare the other levers. - Without a
seed, a sampled request draws a fresh one (TensorFold's default since v1.1.4, as OpenAI's API does); an explicitseedstill wins. For reproducible replies send aseed, or start the server with--prompt-seed(the engine then derives the seed from the prompt's token ids, so the same prompt gives the same sampled reply, and"draft": falsecomparisons are reproducible;tools/exact.pyand the sampled-exactness checks run that way).TENSORFOLD_SEED_SALT=<integer>changes every derived seed at once. - A nonzero
presence_penaltyorfrequency_penaltyis refused with HTTP 400 ("not supported by backend 'cuda': send 0 or leave them out"): TensorFold v1.2.7 applies them only for other CUDA families and refuses them for Flash Next, where v1.1.4 accepted and ignored them. Clients that send the model card'spresence_penalty: 1.5must drop it.repetition_penaltyis still accepted and has no effect, and out-of-range sampling values such astemperature: -1are not rejected. Usetop_p,top_k,min_pandtemperatureto steer repetition. - A control token in the reasoning ends the turn. The engine stops on the checkpoint's end tokens (
<|endoftext|>248044 and<|im_end|>248046 in itseos_token_id; the report saw<|im_start|>248045 stop a reply too). If the model writes one while it is still thinking, for example when it quotes it in its analysis, the reply stops right there withfinish_reason: "stop", emptycontentand a cutreasoning_content(#76). A client can treat astopwith emptycontentas a failed turn and retry withenable_thinking: false. tool_choice: "required", a named function and structured output are enforced by the engine's grammar library,libtfgrammar.so(xgrammar), which the image takes prebuilt from TensorFold's v1.2.7 release archive. With thinking off,requiredstill gives the model no room to reason before the call: the grammar forces a call from the first token, and the function is then picked from that start. With many tools the pick can be less relevant than underauto. Keep thinking on, useautowith an instruction to call a tool, or name the function intool_choice.
- Endpoints:
/v1/chat/completions,/v1/completions,/v1/responses,/v1/messages(Anthropic) and/v1/messages/count_tokens,/v1/models,/tokenizeand/detokenize(also under/v1/),/healthand Prometheus/metrics(stage timers, time per output token, prefix-cache and speculative-decoding counters). - Refused with HTTP 400:
logprobs: true/top_logprobs(no token probabilities) andnother than 1. "draft": falseserves the request without drafts, the serial reference.- Tool calls work, including
tool_choice: "required", a named function and Anthropic's{"type": "any"}: the reply then always opens a tool call. - A conversation's next turn resumes from the kept state of its earlier turns, with images too (built into TensorFold since v1.1.4: a changed image resumes only up to its first row).
- Structured outputs (
response_formatwith a JSON schema, theguided_*fields) are enforced withlibtfgrammar.so; a reply follows the schema. Without the library (a hand-runtensorfold-nativethat lacks it) the server answers HTTP 400. - When the KV pool is full, a new request is refused. Admission reserves the prompt plus
max_tokens; the request is not queued. Kept prompt states share that pool: admission frees them first (built into TensorFold since v1.1.4), so a request is refused only when it would not fit with every freeable state gone. A request whose prompt plusmax_tokensequals--contextis admitted: the draft rows sit past that window (checked withtools/context_boundary.py; a streamed request over the limit is refused with an error inside the stream). That admission change was authored by 321sssrt-bit (issue #1, PR #2).
patches/*.patch are this recipe's changes to TensorFold v1.2.7 (commit 93a2e93e), applied with git apply in the checkout root by scripts/prepare.sh.
Drafted replies are still checked: a drafted reply matches "draft": false.
| Patch | What it does |
|---|---|
0001, 0002 |
the vision helper loads NVIDIA's quantized vision tower (MXFP8 attention, NVFP4 MLP and merger decoded to bf16 at load); image budget 16,384 tokens |
0003 |
--kv-cache fp8 for Flash Next (one rank, contiguous caches): five full 262,144-token windows fit where bf16 fits three. The fp8 attention reader keeps the next tile in registers, and the MTP head's own cache stays bf16 while the stream fits its charge (the v1.1.4 build's 0003 and 0005, rebased onto v1.2.7's paged and lane-batched attention) |
0004 |
prompt passes run the MXFP8 projections 1,024 columns or wider on a 128 x 128 tile (64 x 64 for calls of 128 rows or fewer) that folds the block scales into the weights: one fp32 sum over K, 1.4-1.65x the exact kernels, prefill +7-9%. Prompt rows leave the exact kernels' bits (within their rounding bound; a row's bytes never depend on its chunk, so replies stay exact across drafting and batching); TF_FLASHNEXT_PROMPT_MX128=0 turns it off (the v1.1.4 build's 0006 and 0015) |
0005 |
video parts on the CUDA engine: Flash Next offers the template's <|video_pad|> groups to the server (the sampler and patchifier are TensorFold's core/qwen_vl/video.zig, the same the Triton host runs) and the shared media plan reads a group of video rows beside image rows. Nothing decodes a video until VIDEO=1 puts libtfvideo.so on the loader's path (chai-md's #90, re-based onto v1.2.7 by MiaAI-Lab) |
0006 |
prompt passes: the hyper-connection up-projection mixes its own rows in its epilogue (fn_hc_up_mix_k32, so the [M, 10240] up rows never reach memory) and the MXFP8 shared expert's down writes its slot directly. Same bits; TF_FLASHNEXT_HC_UPMIX=0 restores the old path |
0007 |
the verify pass's lm_head in two exact stages (a provable bound with an exact BF16 fallback) and one synchronize for a group's draws, 5.38 to 1.97 ms. Same bits; TF_FLASHNEXT_HEAD_TWOSTAGE=0 restores the old path |
0008 |
opt-in W4A4: routed MoE gate_up of prompt passes on Blackwell's block-scaled FP4 mma (sm_121a mxf4nvf4), about +12-15% prefill. Changes the numbers (tools/exact.py hashes differ): TF_FLASHNEXT_PROMPT_FP4_TC=1 turns it on, default 0 |
0009 |
prompt attention over the fp8 KV cache stages the raw codes and converts in registers (fn_attn_fused_kv8_raw, 4 CTAs an SM), about 25% faster attention. Same bits; TF_FLASHNEXT_ATTN_RAW=0 restores the old path |
0010 |
opt-in: the QSA indexer's block scores of prompt passes on bf16 tensor cores (fn_qsa_scores_tc, about 3x the SIMT kernel), +2.8% prefill at 64k tokens, +0.8% at 16k. Changes the top-512 near-ties: TF_FLASHNEXT_QSA_TC=1 turns it on, default 0 |
0011 |
opt-in: the DeltaNet (GDN) recurrence of prompt passes chunkwise in the WY form (fn_gdn_wy: 16-row chunks, bf16 tensor cores with fp32 accumulation and hi/lo operands, the triangular solve and the decays in fp32, producer and consumer warps), 2.2-2.5x the sequential kernel, about +3% to +7% prefill at 16k and 64k tokens. Not bit-exact (the layer's outputs differ from the sequential kernel by bf16 rounding flips): TF_FLASHNEXT_GDN_WY=1 turns it on, default 0 |
0012 |
the next prompt chunk's n-gram file hints (TF_FLASHNEXT_WARM_AHEAD) run on a helper thread that the chunk's step joins when its pass is done, instead of a 120-160 ms host gap before every full chunk, +6% prefill at 16k tokens on fresh prompts. Same bits; TF_FLASHNEXT_WARM_ASYNC=0 restores the synchronous hints |
0013 |
opt-in: the MoE slots in bf16 (tf_nvfp4_tile_down_b16, the MXFP8 shared down's bf16 launches and fn_hc_writeback_*_b16 halve the bytes the down kernels write and the write-back reads; passes under 256 rows keep fp32 and round on read, so a row's bits do not depend on its pass). About +4% prefill. Changes the numbers: TF_FLASHNEXT_MOE_B16=1 turns it on, default 0 |
The v1.1.4 build carried seventeen patches. v1.2.7 has most of the rest itself, and the recipe sets its switches for them in scripts/config.sh:
| v1.1.4 patch | In v1.2.7 |
|---|---|
0004 prompt expert tile |
upstream's opt-in K32 staging, adapted from it (TF_FLASHNEXT_PROMPT_EXPERT_TILE=2) |
0006, 0014, 0015 prefill kernels |
the MXFP8 prompt tile is patch 0004 here; the rest is upstream's own prompt work (hyper-connection writeback and normalize in one launch, 256-column normalize, the shared expert's down projection straight into its slot, 128 x 128 BF16 prompt tiles). The fused HC2 read-out, the drain-free chunks and the larger head pieces are not ported (about 1% between them) |
0007 sampled streams in the batched head |
upstream, on by default (TF_FLASHNEXT_SAMPLED_HEADS) |
0008, 0011 GPU top-k candidates, host draws |
upstream's fn_row_topk candidates, on by default (TF_FLASHNEXT_GPU_TOPK); the host draw threads are not ported |
0009 round cost model |
dropped (it was off) |
0010 n-gram rows of all lanes at once |
upstream: a shared pass gathers every lane's rows on a thread |
0012 DeltaNet rows kept pending |
upstream, on by default (TF_FLASHNEXT_KEEP_LATE) |
0013 pread n-gram reader, read-ahead, chunk tail |
upstream's positional reader is the Linux default (TF_FLASHNEXT_PLE_IO) and TF_FLASHNEXT_WARM_AHEAD its read-ahead; the draft-token read-ahead and the tail rule are not ported |
0016 shared expert side stream, lane-batched DeltaNet |
upstream, on by default (TF_FLASHNEXT_SHARED_SIDE, TF_FLASHNEXT_GDN_LANES) |
0017 running-product stop rule |
upstream's default TF_FLASHNEXT_CONFIDENCE=-0.4; TF_FLASHNEXT_SHARED_DRAFTS=0 keeps it beside other streams |
Whether the pieces that were not ported still matter is a measurement of the v1.2.7 build, not yet made.
tools/ talks to the running server (API_URL, default http://127.0.0.1:8888, or PORT):
| Script | What it does |
|---|---|
tools/exact.py |
greedy replies: drafted, "draft": false, and concurrent, must match |
tools/toolcheck.py |
a tool call whose array argument comes back as a JSON array |
tools/needle.py |
a passphrase in a ~200,000-token prompt |
tools/prompt_reuse.py |
a resumed prompt matches a fresh one |
tools/bench.py |
prefill at 8k-128k and a short decode |
tools/bench_streams.py |
decode at 1 to 5 concurrent requests (prose and code, with TTFT) and prefill 4k to 128k, median of 3 |
tools/context_boundary.py --context N |
a prompt plus reply that fills --context succeeds; one token over is refused (HTTP 400, or an error in the stream). Authored by 321sssrt-bit |
start.sh set up (first run) and start the server
stop.sh stop it
scripts/ prepare.sh, config.sh, harden.sh, publish-image.sh, banner.sh, ablit_view.py
patches/ this recipe's changes, applied onto TensorFold v1.2.7 at TF_REF
tools/ checks
.github/ issue and pull request templates, GitHub Sponsors
CREDITS.md who and what this builds on
CHANGELOG.md upgrade notes
NOTICE third-party notices
MIT, see LICENSE. The model weights, downloaded from Hugging Face and not part of this repository, are
under the checkpoint's own license (the ABLIT=1 overlay inherits NVIDIA's and the Qwen license, and has its own Responsible Use Agreement): the default NVIDIA FP4 checkpoint under the
NVIDIA Open Model Agreement (its base model, Qwen3.8 Flash Next, is under the
Qwen Community License 1.0), and the INT4 checkpoint (db281878 recipe only) under the Qwen Community License 1.0 per its model card.
Third-party software in the image. The image scripts/prepare.sh builds is based on NVIDIA's PyTorch container
nvcr.io/nvidia/pytorch:26.07-py3, redistributed as a value-added runtime image. The NVIDIA software in it is
governed by the NVIDIA Software License Agreement
and the Product-Specific Terms for NVIDIA AI Products,
which the container prints at every start. By pulling or running the image you accept them. The MIT license above
covers this repository's scripts only.
- Engine: TensorFold and its Zig engine (
tensorfold-native, release v1.2.7) by Ash Hart (ashhart) and the TensorFold contributors. The Flash Next CUDA engine this recipe builds on is TensorFold's own, written by Ash Hart and the TensorFold contributors. - Zig CUDA serving path and CUDA family registry: Jürgen Schmied (jschmied), in
TensorFold PR #443
(commit
59e77e8). - The patches in
patches/(0001 to 0004, 0006 to 0013): written by MiaAI-Lab (Mia's AI Lab), MIT License. They modify TensorFold's own Flash Next CUDA engine (code by Ash Hart and the TensorFold contributors, under TensorFold's licenses). The list, with where each idea comes from, is inCREDITS.md: the vision tower (0001, 0002), fp8 KV (0003; the format adapted from MiaAI-Lab's GLM recipe patch 0038) and the MXFP8 prompt tile (0004). - Patch 0005 (video parts): by chai-md in
#90, re-based onto TensorFold v1.2.7 by MiaAI-Lab and
MIT License like the rest of
patches/. Several of the v1.1.4 build's patches (0004 to 0017) are now part of TensorFold v1.2.7 in upstream's own form; upstream credits MiaAI-Lab for the K32 expert staging it adapted from patch 0014. - Earlier db281878 series (on
main): free after drain and admission reclaim (patch 0029) and image prompts in the prompt cache (patch 0030) by tempeste, now built into TensorFold v1.1.4; sliced fills one at a time (patch 0021) by BadAd84 (PR #53). - Model: Qwen3.8 Flash Next by the Qwen team (Alibaba).
- Default checkpoint: NVIDIA's FP4 QAD export (Model Optimizer).
- INT4 checkpoint (served by the db281878 recipe on
main, not by this branch): azampatti'sazampatti/Qwen3.8-Flash-Next-125B-A5B-INT4-AutoRound(the top-5 expert cut, the shared-expert healing and the checkpoint), with its AutoRound int4 quantization by Intel and its hybrid checkpoint and FP8 n-gram table by Saren-Arterius (Saren/Qwen3.8-Flash-Next-ple-table-fp8). - Previous checkpoint (before the Zig engine):
Vontra/Qwen3.8-Flash-Next-MLX-4bit-MTPby Vontra. - Image and video input: adapted from MiaAI-Lab's single-Spark patches 0008 and 0009 and from TensorFold's vision code by Ash Hart and the TensorFold contributors. The helper uses Hugging Face transformers (Apache 2.0) for the tower modules and the image processor, PyAV and FFmpeg for video decoding, and Pillow for image decoding.
- FP8 KV format (
KV_DTYPE=fp8): adapted from MiaAI-Lab's GLM recipe patch0038-glm-kv-fp8in GLM-5.3-Flash-EXL3-2x-DGX-Sparks-TensorFold. - Full-window admission fix and
tools/context_boundary.py: 321sssrt-bit (issue #1, PR #2): a request whose prompt plusmax_tokensequals the window is admitted, because the engine already keeps the draft rows beyond that window. - Prompt-chunk change on the earlier Python engine: MovieMaker93 (TensorFold #40).
- Language draft vocabularies of the earlier Python recipe: Javier (jvr0x) (#84); that draft-language image is not built anymore.
- RoCE all-gather: the one-shot all-gather in the engine implements the RoCEnante protocol of b12x by local-inference-lab; this recipe leaves it off.
- Grammar runtime: xgrammar by the MLC-AI team (Apache-2.0), shipped as
libtfgrammar.soin TensorFold's release archive. - Zig by the Zig Software Foundation and the Zig contributors; the image is based on NVIDIA's PyTorch container.
- Benchmarks: the performance numbers were measured with sparkDash by MiaAI-Lab.
The full list is in CREDITS.md.