An existing experts.bin was kept whenever its size matched the layout. A different checkpoint with the same geometry
(a re-quantization or a fine-tune packed into the same folder) has the same size, so the engine silently served the
old experts with the new model's dense weights.
Before keeping the file, the first and last blobs of the first, middle and last layers are now compared with the
GGUF; a mismatch rewrites it. The check reads six blobs, so an unchanged pack is still reused at once.
Test: test_experts_bin_is_kept_only_with_this_ggufs_blobs packs two GGUFs of the same geometry into one folder (it
fails on the previous code).
Rebased onto 0.1.31 (Niko1221): 0.1.31 already refuses an experts.bin whose sidecar (experts.bin.src.json: shard
names and sizes, the hash of native_experts.txt) does not match, so the six-blob comparison runs only when the
sidecar says "reuse" - it catches the case the sidecar cannot (a re-quantized or fine-tuned checkpoint under the same
file names and sizes). It reads each of the six expert blobs on its own instead of concatenating the whole layer.
The test packs the second model under the first one's file name, so it reaches the new check.
- FORM (eddoursul/Strata's list of which tensor the engine reads as BF16, F16 or F32) decides the
pack form; the conversion itself is upstream's bf16_bytes (gguf-py, finite check, round-to-nearest-
even). By default only lossless conversions happen: F32 whose values are exactly BF16 (low 16 bits
zero; before, only the routers) and F16/BF16 widened to F32. Rounding (inexact F32, Q8_0 hyper-
connection / PLE value / output_hc, F16 -> BF16) still needs --compat-bf16. NaN/Inf are refused
even where the low bits are zero.
- A Q8_0 PLE key stays native (served from the GGUF, like Q2_0); other quantized keys take the BF16
path as before. (The engine's native PLE key learns Q8_0 in the formats change.)
- blk.1.ple_conv1d stored F32 (Q8_0 / UD-Q4_K_XL files) goes into dense.bin as index kind 3 and the
loader narrows it to F16 (#255, gopinath87607), with or without --compat-bf16; a value beyond
F16's range is refused. generate refuses a pack whose conv1d is not F16 (#255's check, which also
accepts the canonical Q2_0 pack's verbatim-F16 kind 0 - #255 as written refuses that pack).
- conversions.json (schema 1): the source shards' names and sizes, and per converted tensor its
shard, source/destination type, method, exact flag, largest absolute error and source sha256.
compat-bf16.json is written as before. Refusals happen before anything is published.
- Byte identity: index.txt, native_experts.txt and dense.bin of Q2_0, IQ3_XXS, IQ3_S, Coder IQ1_M and
Swift IQ2_XS are identical to main's packer (Swift's 96 exact F32 routers are now listed in
conversions.json).
- Tests: exact F32->BF16 by default, inexact only with --compat-bf16 (error bound), NaN/+-Inf
refused with and without the flag (previous pack untouched), conv1d kind 3 (bytes, record, F16
kept, overflow refused), Q8_0 projections need the flag and are recorded, Q8_0 key native.
- Each expert role is resolved in the shard that holds it and its offset is absolute in THAT shard
(the first role's data_start was used for all three; #255, gopinath87607). A layer whose roles
are in different shards gets the per-role column `gate,up,down` and the file becomes v4; every
other pack keeps the v3 header and bytes (checked on Q2_0, IQ3_XXS, IQ3_S, Coder IQ1_M, Swift
IQ2_XS: index.txt, native_experts.txt and dense.bin identical to main's packer).
- The split keys are checked as the engine does (shard 1 has the metadata; split.count / split.no /
split.tensors.count consistent). The expert table is computed and checked before any file of
the pack changes.
- experts.bin is written under a temporary name and gets experts.bin.src.json (the shards' names
and sizes, the sha256 of native_experts.txt); it is reused only when that matches, never by size.
An experts.bin of another source is refused without --experts-bin (the engine would read it).
- dense.bin and index.txt are published together after the old completion marker
(native_experts.txt) is removed, so a stop part-way never mixes files of two runs.
- .absolute() stays (not .resolve()): symlinked HF snapshot names keep the split naming.
- Tests: a synthetic 4-shard GGUF (shard 1 metadata only, layer 1 split per role; offsets per
shard, experts.bin byte for byte), v3 kept when nothing is split, missing shard, duplicate tensor,
a shard of another split, truncated shard, wrong type (pack untouched), interrupted pack (experts
and index), stale same-size experts.bin. Idea of per-role names also in #247 (jagsan-cyber).
Bring in 45 upstream commits through f32577e. Update the split-GGUF test fixture with router geometry required by upstream's dynamic expert counts. Preserve the Orca BF16 conversion and native PLE compatibility paths.
Validation: Release CUDA build for sm_120; 8 packing tests; 23 server tests; sampler, gated residual, and KV streaming GPU parity checks.
- iq_pack.py: derive n_expert from the router tensor shape (was hardcoded 512)
- expert_layout.cpp: parse the pack header's recorded n_expert instead of the
caller's compile-time canonical geometry; use it for the contiguity stride
- gguf_reader.hpp: Qwen4ExpGuard expert-count checks become presence-only
- generate.cpp: read qwen4exp.expert_count/expert_used_count from the model
file into the runtime geometry; MTP drafter keeps canonical geometry (the
draft is the original 512-expert head); serve gate allows profile-less
caches; K from metadata
- layer.cpp: native fused router stays 512x10-only, generic top-k fallback
- prefill: expert count taken from the geometry everywhere; route_kernel
templatized (512->16, 256->8 registers/lane, else generic router_top10)
The setup now asks which model first: Qwen3.8-Flash-Next (the original) or Swift 1.5. The engine reads models
whose GGUF shards split the layers; the ready-made engine v0.1.1 is on the Releases page.
Inference engine, OpenAI/Anthropic API on localhost, optional image input, one-file setup
(START-HERE.bat / setup.sh). Model files are downloaded from Hugging Face by the setup.