* feat(gguf): serve image input on deepseek4 ggufs from a deepseek4v mmproj
* fix(gguf): skip an unusable deepseek4v mmproj instead of refusing the trunk
* fix(ple): add rocm disk wait-sync support
* fix(kernel): validate hip wait-sync support before enabling it
* refactor(ple): share decode fills and sync flag allocation
* fix(kernel): convert fp32 to e4m3 in one rounding on sm_89
* fix(kernel): avoid nvidia fp8 cast asm on hip
---------
Co-authored-by: zihaomu <zihaomu@outlook.com>
* feat(server): add /v1/cache/flush to drop the prefix cache when idle
* refactor(scheduler): run every cache flush at the idle safe point
* test: cover cache flush on the overlap loop and on a live server
* perf(moe): fuse sigmoid + selection-bias routing into a triton kernel
BREAKING CHANGE: glm_moe_dsa keeps its router selection bias in fp32. An FTW converted by an older build stores it as bf16 and still loads, but routes with the rounded bias; restore it with `scripts/ftw_hotfix.py --repo nvidia/GLM-5.2-NVFP4` or reconvert.
* fix(hotfix): scope the bias restore to GLM-5.2 and drop new router comments
* feat(gguf): load the vision tower from a llama.cpp mmproj
Qwen3.5 / Qwen3.6 / Qwen3.8 (qwen3vl_merger) and Gemma-4 26B-A4B / 31B (gemma4v) / 12B (gemma4uv) take image input from a separate mmproj file: --mmproj, else one in the model's own folder. The tower runs in bf16 (quantized mmproj files are dequantized) and its config comes from the GGUF metadata plus per-arch defaults.
* docs(gguf): describe mmproj image input without a model list
* test(gguf): drop the mmproj tests
* fix(gguf): escape the model folder when globbing for mmproj files
* fix(gguf): skip auto-discovered mmproj files the text model cannot use
* fix(gguf): serve text from a GGUF that carries vision tensors itself
* feat(gguf): serve DeepSeek-V4-Flash GGUF checkpoints on deepseek4
* fix(gguf): refuse reap-style per-layer expert prunes in deepseek4 ggufs
* fix(gguf): apply the deepseek4 review fixes
- route the offload experts through swiglu_clamp so the GGUF MoE path applies the limit
- map model.embed -> embed on the HF row so the bf16 exemption matches
- default a wholly missing rope.scaling block to the family yarn values with a warning;
refuse a partly present one
* fix(kernel): order the batch-memcpy probe against the current stream
Adapt the stream dependency and busy-stream regression from #414
(https://github.com/FlashML-org/FreeToken/pull/414). Warm the JIT
before queuing the backlog so compilation cannot mask the race.
* fix(moe): enable prefill hit-d2d on rocm
* feat(moe): fetch locked-layer experts through pinned staging and probe the pin limit
Under hybrid, layers whose banks the pin quota could not take keep GPU slots of their own pools and fetch part of their misses through pinned staging that CPU threads fill (--moe-locked-fetch, --moe-locked-max-fetch). --moe-cpu-layers auto without FREETOKEN_PIN_BUDGET_GB now loads the banks unpinned, pins the staging, then pins layers middle-out until CUDA refuses one and OS-locks the rest.
* fix(moe): resize the locked fetch on cache rebuild and gather staging by device address
* feat(moe): log decode moe stats per layer group with --moe-collect-stats
* perf(moe): default the locked fetch to max(2, min(4, logical cpus / 4)) copy threads
* feat(moe): take the locked fetch share from the ft bench bw profile by default
* fix(moe): fuse the locked fetch into publish and gather kernels and address review findings
* refactor(moe): gather the locked staging with fast_index_copy_multi
* refactor(moe): move the locked fetch setup out of the engine and address review findings
* fix(moe): fail the boot when the locked staging cannot be pinned and keep locked layers out of the hybrid share log
* feat(gguf): serve GLM-5.3-Flash GGUF checkpoints on glm5-next
Adds the llama.cpp glm5-next GGUF reader (unsloth GLM-5.3-Flash-GGUF, both
the glm5-next and the older glm5next arch spellings) on the GGUF quant
kind from #690:
- parse_gguf_config derives the text config from the GGUF KV metadata,
with per-block attention.head_count_kv laying out the KDA/DSA hybrid,
the trailing MTP block dropped like the HF loader drops it, and the
MLA head widths from the *_length_mla keys.
- iter_gguf_weights maps every tensor to the glm5_next state dict and
undoes the converter transforms: A_log stored as -exp(A_log) is
inverted, the per-head attn_k_b/attn_v_b pair (k transposed) fuses
into the dense kv_b_proj layout the MLA absorption reads, and the
q|k|v conv kernels concatenate on the channel axis. The mixed-type
fused KDA in_proj (Q8_0 q|k|v + BF16 b|f_a|g_a) rides #702 segments;
the routed experts load as GGUF expert banks at their shipped types
(unsloth dynamic quants: IQ3_S gate/up + IQ4_XS down, Q8_0 outlier
layers pass through natively).
- passes quant_config to embed_tokens so the Q8_0 token_embd serves
packed; registers Glm5NextGGUFForCausalLM and claims it in the AOT
table.
Verified end to end against unsloth GLM-5.3-Flash-UD-IQ4_XS (5 split
shards): the full engine on a 32GB GPU serves coherent output with the
experts off host banks. Text-only, TP=1.
Part of #671.
* fix(gguf): refuse unread scale tensors in glm5-next ggufs
check_scales at config parse like the llama, qwen3 and gemma4 loaders
(review on #721): a .scale / .input_scale outside an NVFP4 weight now
fails with a clear error instead of loading silently unread.
* fix(gguf): serve the quantized tensors of unsloth dynamic glm5-next quants
unsloth's UD quants quantize tensors the AesSedAI-style files keep float:
the MLA kv_b halves (Q8_0), the mHC mixers and the indexer's wk /
weights_proj / compressor gate. kv_b_proj joins the registry's
unquantized_modules (glm_moe_dsa keeps its kv_b dense for the MLA
absorption for the same reason) and the reader dequantizes through the
vendored gguf-py reference on every float-expecting read; wq_b keeps
serving its checkpoint quant packed (attention.py keeps wk and
weights_proj dense). Regression test stores the kv_b halves Q8_0.
* fix(gguf): treat the glm5 pre-tokenizer spelling like glm4
llama-vocab.cpp maps both spellings to CHATGLM4 with ignore_merges;
unsloth writes glm4 and AesSedAI's writer glm5 for the same vocabulary.
Without the mapping a glm5 file loads but silently mis-tokenizes
(tok_compare: 22,840/153,725 vocab words differ from the HF reference;
0 everywhere with it).
* fix(gguf): size the mmq tail padding by ggml type and k
pad_rows added one zero row of k columns, which covers the bytes MMQ
reads past the last row only when k is at least half a padding unit
(512); glm5-next's KDA f_b / g_b (k = linear head dim 128, Q8_0 in
dynamic quants) are the first packed tensors below that and died at the
first mul_mat. pad_rows now takes the ggml type and returns enough whole
rows to cover mmq_tail_bytes for any (type, k), consistently in the
reader's fused(), the gguf linear and embedding params and the expert
host banks. Found serving the real unsloth UD-IQ4_XS: the dry load
never runs a forward.
* fix(gguf): take the older glm5-next writer variants in stride
Two long-tail writer variants the full check sweep found (the GSQ-RCO
lineage alone is ~57k downloads/month):
- the conv kernels with a trailing unit dim: llama.cpp's glm5-next
loader tries that 4-D shape before the 3-D one, so trailing unit dims
in ne are dropped on float reads (they carry no elements).
- attention.head_count_kv as the generic scalar (all blocks): wrong for
the hybrid -- llama.cpp broadcasts it and then fails tensor creation
-- so only the list is trusted and a scalar falls to the tensor-name
census like the pre-list writer.
* fix(gguf): glm5-next review cleanups
- refuse instead of guessing metadata the model cannot express: the
scalar attention.head_count_kv spelling (llama.cpp broadcasts it and
then fails tensor creation; every public file carries the list),
missing *_length_mla keys through need(), non-uniform
swiglu_clamp_exp / swiglu_clamp_shexp, indexer.types with non-full
layers, expert_gating_func other than sigmoid, and rope dims as a
NotImplementedError instead of an assert.
- call check_scales directly; aot_models comment on its own line.
- drop the GGUF test files; coverage will be handled across families.
Resolve the parsed URI path without prepending localhost, while
rejecting non-local authorities and retaining the media root check.
Add regression cases for localhost authority spellings and remote hosts.
Refs FlashML-org/FreeToken#757
- split index_qk_proj into the indexer's q and k GGUF tensors for the quant lookup
- refuse an MTP-only draft GGUF with a clear error instead of a KeyError
BREAKING CHANGE: an FTW of Qwen3.5 / Qwen3.6 / Qwen3.8-27B converted by an older build
stores the norms with the 1 added and gives wrong output; reconvert it with `ft checkpoint`.
* fix(qwen4_exp): read weights under the checkpoint's quant config
- route each dense Linear tensor by its scheme's stored names, so per-channel fp8 scales (llm-compressor) load and fused parts concatenate per role
- name the routed NVFP4 experts by the checkpoint's dialect, so compressed-tensors weight_packed / weight_global_scale load
- accept a bf16 PLE table without a scale in the pinned and disk backends
* fix(quant): accept weight_scale as the modelopt mxfp8 scale name
ModelOpt exports store the same e8m0 codes as weight_scale_inv (MiniMax-M3) or weight_scale (Qwen3.8-Flash-Next-FP4-Local); Stored gains aliases and the scheme-driven readers match any of them.
NVFP4 weight global scales (amax / 2688, 2e-5 to 4e-4 in the served checkpoints) sit at fp16's
normal minimum; stored as fp16, up to 97% of a checkpoint's expert globals were subnormal, with
up to 1.7e-3 relative error per row.
BREAKING CHANGE: an FTW checkpoint that stores NVFP4 global scales as fp16 is refused at load;
reconvert it with `ft checkpoint`.
* perf(linear): run nvfp4 linears on nvfp4 activations on sm_120
* fix(linear): guard the b12x nvfp4 linear against inputs it mishandles
* fix(linear): use the largest per-part global in the w4a4 nvfp4 linears
The NVFP4 release quantizes the attention gate with a different weight global scale than q/k/v, so
one fused weight cannot carry a single global for all four parts.
BREAKING CHANGE: an FTW checkpoint converted with the fused qkvg_proj no longer loads; reconvert it
with `ft checkpoint`.
The pointer path of the Triton prefill GEMM loads the e4m3 scales one byte per thread, too small for cp.async, so every K step waits on that load and a CTA barrier. Read them as int32 words (4 scales each) on GeForce sm_86 / sm_89 so they join the pipeline.
- SCALE_WORDS constexpr in `_prefill_nvfp4_moe_kernel` (off by default)
- Triton prefill tuning as one record per (GPU class, cc); GeForce sm_86 / sm_89 turn scale words on, with 8 warps when K >= 2048, and sm_86 moves to BLOCK_SIZE_M 64 from 100 tokens per expert
* feat(moe): bench hybrid fetch fractions per moe layer kind
The ft bench bw profile (version 6) holds only layer_kinds rows, keyed by CPU format, options, expert shape, top_k and CPU worker threads; older profiles are ignored. ft bench bw --model also takes checkpoint paths and benches each of their layer kinds. Hybrid decode reads each layer's own row for its fetch fraction, else keeps a fixed cap of 1. --moe-strategy auto no longer upgrades to hybrid from the profile.
* fix(bench): fill gguf mxfp4 scales, scope act_block to ds_fp4 and skip cpu-less rows
* perf(moe): speed up the nvfp4 moe prefill gemm on rtx gpus
* perf(moe): keep the byte e2m1 decode at every tile size on h100
---------
Co-authored-by: andy-yang-1 <andy_yang@berkeley.edu>
* perf(kernel): split triton decode attention by context length and sm count
* perf(kernel): merge triton decode splits a tile at a time
- stage 2 loads SPLIT_TILE splits per step and merges them with one
online-softmax update instead of one split per iteration
- SPLIT_TILE is the launch's split cap rounded up to a power of two,
at most 8192 fp32 elements and 64 splits; num_warps scales with it
* feat(cpu-moe): serve GGUF experts on the cpu and hybrid backends through ggml-cpu
* feat(cpu-moe): run float GGUF expert rows on the cpu through ggml-cpu's vec_dot
* feat(cpu-moe): build ggml-cpu for each llama.cpp x86 variant and run the best one the CPU supports
* perf(kernel): rewrite the triton nvfp4 moe prefill gemm
* perf(moe): tune nvfp4 prefill tiles per gpu class
GeForce runs fp32-accumulate tensor MMA at half rate, so RTX parts want smaller BLOCK_SIZE_M than H100 and their own BLOCK_N / BLOCK_KB / stages.
Tables come from tile sweeps on RTX PRO 6000, RTX 5090, RTX 4090 and RTX 3080 Ti; H100-class GPUs and AMD keep the previous tuning.
* feat(moe): serve experts of several formats through per-format slot pools
* refactor(cpu-moe): pass each layer's cpu format with its options
* fix(moe): read only each format's layers when loading experts of several formats
---------
Co-authored-by: andy-yang-1 <andy_yang@berkeley.edu>
* feat(gguf): run experts whose gate_up and down mix float and quantized types
* fix(kernel): map an fp32 compute type to tl.float32 in fused_moe_kernel_triton
* fix(gguf): write float expert GEMM output in the activation dtype