* feat(moe): softcapped SwiGLU expert activation
* feat(moe): serve resident experts of several formats
* feat(inkling2): serve Inkling 2 Mini text generation
* feat(server): inkling2 reasoning and tool-call parsers
* perf(inkling2): fuse the attention residuals, message gates and conv epilogues
* feat(inkling2): serve image input
* fix(engine): load offload experts per visit for models that revisit MoE layers
* test(server): add inkling2 to the streaming model matrix
* test(inkling2): kernels, expert reader and image cells against the reference
* perf(inkling2): skip bias and masks on far key blocks and retile extend attention
* docs(models): add inkling 2 mini
* fix(kernel): claim inkling 2 mini in the aot model table
* test(kvcache): give the pool factory fakes a kv layer count
* feat(kvcache): window radix cache with recurrent-state snapshots at its reuse points
* feat(inkling2): serve prefix reuse through the window snapshot radix
* refactor(kvcache): snapshot the window radix only at prompt ends, finishes and tool-call anchors
* fix(kvcache): count a prefix hit's locked restore snapshot in the snapshot radix working set
* feat(engine): fit Inkling 2 to small GPUs instead of failing at startup
* docs(models): inkling 2 state slots, small-gpu fit, nvfp4 requant and what speculative decoding needs
* feat(server): stream inkling 2 tool-call arguments as they decode
* docs(models): note that inkling 2 still reasons at effort none
* test(scheduler): restore the global context after the snapshot admission test
* test(server): cover an inkling 2 call and trailing text in one chunk
* fix(engine): resize the snapshot radix window pool with its state slots on a rebuild
* fix(server): send text after an inkling 2 tool call after the call
* fix(engine): floor the expert cache at the slots that stage a layer in every bank
* docs(models): drop the inkling 2 requant switch and give the 8 gb context with host embeddings
* refactor(kvcache): keep inkling 2 convolution inputs as a second window of the swa radix
- swa_radix nodes carry a level, one per window tier (the window KV, then each model window
state); single-window trees behave as before
- Inkling 2 declares its convolution inputs as a 3-token WindowStateSpec: a prefill chunk gives
rows only to its tail, and a resume point keeps 19 rows beside its 1040 window tokens
- drops swa_snapshot_radix, its state slots and snapshot planning
* feat(inkling2): size the window pool at a tenth of the full-attention kv
A model may declare its own swa_full_tokens_ratio; EngineConfig's default is now None,
resolved to the model's ratio or 0.2. Inkling 2 keeps window KV only in front of resume
points, so 0.1 still holds about 120 of them on a 96 GiB GPU and leaves the full-attention
KV 1.32M tokens instead of 946K.
* perf(moe): stage offload prefill experts in the model's moe call order
A looped model runs some MoE layers more than once per forward, so the overlap prefill staged the
wrong layer after a loop's last visit and the engine turned the overlap off. A model now declares
its MoE call order (moe_layer_order) and the double buffer alternates by call, staging the next
call's layer. Inkling 2 Mini offload prefill: 1.3x at 2K tokens, 1.7x at 32K, identical logits.
* refactor(engine): drop the model-declared prefill bytes per token and its chunk cap
* perf(moe): reuse the gate_up buffer for the nvfp4 prefill down output
- fused_experts_nvfp4 allocates one M*top_k*max(2I, H) buffer: the gate_up output is a view of it, and the down output takes the same storage once the activation has run
- the routed sum is written into hidden_states and returned, as the bf16 fused_experts_impl does; the MoE layer contract already lets the expert kernel overwrite its input
- the prefill tests pass a copy of the input where they read it again after the call
* perf(inkling2): shorten the lifetimes of prefill activations
- loop-pass prefill chunks of 2048+ tokens mix each message row when its gate reads it and run each attention gate end to end on its own rows; decode and shorter chunks keep the batched path
- drop the gated q/k/v inputs once attention has run, and the prelude output and the previous pass's sources before the coda
- build the relative-bias table 2048 rows at a time and free each before the next
* perf(inkling2): run the message-gate up projection as a bf16 gemm with fp32 output
- the checkpoint stores the gates' forget / gain weights in bf16; keep them bf16 instead of upcasting at load
- torch.bmm with out_dtype=float32 replaces the z.float() cast and the fp32 SIMT bmm; measured against fp64 on a real 8192-token prefill, the error is the same as the fp32 bmm's
* feat(inkling2): serve the mxfp8 experts on the mxfp8 expert kernel
- layers 20-23 load as e4m3 rows with their ue8m0 codes instead of bf16 dequantized at load, and run on the W8A16 mxfp8 MoE method
- the AOT table lists the mxfp8 expert bank rows for this model
* fix(inkling2): blend transparent image pixels onto the checkerboard
- transparent and half-transparent pixels show the 8-pixel 204 / 153 checkerboard behind them, as the reference processor does, instead of their dropped-alpha color
* fix(server): keep inkling 2 non-streaming text as streamed
- the non-streaming parse no longer strips the reasoning and content, so it returns what the stream sends
* fix(engine): refuse a quantized kv cache for inkling 2 at startup
- ModelConfig.bf16_kv_only marks a model whose own attention kernels read bf16 KV; --kv-cache-dtype fp8 / int8 now fails at startup instead of at the first forward
* test(models): read a family's own quantization file in the stored-tensor scan
- the scan builds the QuantConfig as the loader does, from the file a family's spec names when config.json holds only a stub, and reads stacked w13_ / w2_ expert tensors; Inkling 2 Mini's 164 modules now agree
* refactor(moe): plan the minimum expert cache in pool_policy
- method_rows and min_cache_bytes replace the engine's _min_expert_cache_bytes for the small-GPU fit; layer_bank_bytes reads the same per-bank rows off the loaded banks for the auto plan's floor and for layer_slot_bytes
* perf(inkling2): run the router as a bf16 gemm with fp32 output
- the checkpoint stores the router weight in bf16; keep it bf16 and compute the logits with torch.mm(out_dtype=float32), as SGLang does for this hidden size, instead of x.float() and an fp32 SIMT GEMM
- against fp64 on a real 8192-token prefill the logit error grows from 1.7e-6 to 2.0e-5 at most; no row's top-8 expert set changes
* test(inkling2): hold a decoded-prefix hit to its first logits, not its greedy tokens
- a hit that resumes past decoded KV is bounded by the largest difference of its first logits; the 24 greedy tokens are no longer compared, since a near tie anywhere in them flips the check without a cache fault
* docs(models): update the inkling 2 notes for its native mxfp8 experts
- the MXFP8 layers run as W8A16 and the model takes about 18 GiB resident; note the prefill activation peak per token and that a quantized --kv-cache-dtype is refused at startup
- the 96 GiB example now holds 1.40M full-attention tokens, 140K window tokens and 2.7K rows
* refactor(quant): read inkling 2's hf_quant_config.json where the hf config loads
- a hf_quant_config.json that names its own quant_method replaces config.json's quantization_config, which Inkling 2 ships only as a ModelOpt stub; an old ModelOpt sidecar still only fills a missing one
- ModelSpec.quantization_config, QuantConfig.from_hf's quantization_config argument and Inkling 2's own reader of the file go away; the stored-tensor scan folds the sidecar the loader's way
* refactor(engine): drop the startup fit for small gpus
- a model with window states no longer lowers --max-running-requests on its own when the plan does not fit; like every other model it fails at the first allocation that does not fit
- method_rows and min_cache_bytes go with it; the offload cache's stage floor stays
* docs(models): keep the inkling 2 note to what serving it needs
- drop the cache internals, pool sizing, the 96 GiB example and the speculative-decoding plan from the note; keep resume points, memory, the MoE strategy advice, reasoning effort and what is refused
* refactor(engine): drop the bf16-only kv check for inkling 2
* refactor(scheduler): flip the gdn ping-pong index between its two slots
* refactor(inkling2): drop the unused expert suffix list
* fix(kvcache): count the window-state rows in the swa unit bytes
* refactor(inkling2): drop the comments on its spec and payload field
---------
Co-authored-by: andy-yang-1 <andy_yang@berkeley.edu>
* feat(kvcache): add fp8_ds_mla and nvfp4_ds_mla kv formats for deepseek-v4 / v4.1
Window and compressed KV are stored as fp8_ds_mla rows (584 B instead of
1024 B) and indexer keys as MXFP4, holding the same values as the
reference's quant round-trip. DeepSeek-V4.1's packed layout is named
nvfp4_ds_mla and shares the row-format code.
* refactor(engine): drop the model field from the dsv4 kv formats
* fix(scheduler): return the sliding-window slots when a verify step rolls back
* feat(gemma4): add the assistant draft model and its loader
* feat(spec): serve sliding-window targets with a draft that keeps no KV
* fix(spec): budget verify rows in the swa pool and drop the post-verify sync
* feat(kvcache): add fp8 and int8 per-token-head KV cache formats
* fix(kernel): keep the bf16 m3 sparse k/v loads inline
* fix(attention): refuse a backend that cannot read the kv format
- filter the m3 page-size fallback by kv format
- release the scale buffer when a qsa or bsa rebuild fails
- keep the bf16 qsa and m3 attend code identical to main
- drop docstrings that claimed no register spills
- drop guard tests
* fix(kernel): widen dsa latent row offsets past int32
* feat(spec): store the mtp draft kv in the target's format
* refactor: add engine and scheduler seams for multi-row decode steps
* refactor: rename the graph steps argument to rows_per_req
* refactor: drop VerifyInfo and require rows_per_req on verify batches
* refactor: fix stale seam comments and read decode_rows_per_req directly
* refactor: reword two GraphRunner comments for multi-row graphs
* fix(engine): scale the GPU-decode MoE pool limits by decode_rows_per_req
* refactor: drop the unread Context.moe_offload_cache field
* test: trim the multi-row seam tests
* 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): 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
* feat(moe): split the offload expert cache into slot pools
* perf(moe): stop recompiling the hybrid ensure kernel for each slot pool size
* fix(engine): turn off prefill overlap when --moe-cache-mem leaves under two layers of slots
* fix(engine): load the --moe-cache-split profile before the expert banks
* feat(moe): serve NVFP4 and MXFP4 experts fused through the expert banks
Resident experts skip the state dict and load through the offload expert-bank loader (HF pieces or FTW banks) into per-layer GPU banks, so fused serves bf16, fp8_block, NVFP4 and MXFP4 alike. Unified-memory GPUs auto-select fused for these formats and ignore offload-only flags with a warning.
BREAKING CHANGE: ft checkpoint always writes MoE experts as banks; an FTW converted with --moe-backend fused or triton (dense experts) no longer loads and must be reconverted.
* docs(moe): name only GB10 / DGX Spark for unified memory
* feat(rotary): size the rope table for YaRN and add --hf-overrides
* fix(rotary): guard mrope's table width and copy --hf-overrides values
- MRotaryEmbedding asserts its cos/sin table is rotary_dim wide. A proportional
rope's table spans the head, and the mrope kernel indexes the rotary_dim // 2
section table with the table's width.
- _with_overrides deep-copies every value it stores: transformers fills rope
defaults into the rope_parameters it is handed, which was the caller's dict.
- The rope-table tests the engine test covers fold into it, the two shared-table
tests are one, and the --hf-overrides test moves to tests/utils/test_hf.py,
where it loads the override against the same values written into config.json,
for a model type transformers knows and one it does not.
- docs/cli.md lists --hf-overrides.
* fix(server): give --hf-overrides a fresh dict per parse
argparse hands its default object to every parse that omits the flag, so
default={} put one shared dict in every ServerArgs. The flag defaults to None and
becomes a new dict where the arguments are assembled, as --mm-processor-kwargs
does.
* docs(rotary): an indexer's heads differ in width from the attention's, not wider
* feat(mm): serve image input on the Qwen VL families
- frontend: OpenAI image_url, Anthropic image blocks and Responses
input_image (http(s), base64, gated file://) become MMItems in the
tokenizer workers; image spans carry content pseudo ids so the radix
cache keys them by content; mrope positions are precomputed per request
- registry: EncoderSpec per family (Qwen3-VL, Qwen3.6, Qwen3.8-Flash-Next
register a vision encoder serving image) and ModelSpec.mm_processor;
EngineConfig.active_encoders decides what a process builds,
served_modalities what it accepts; --text-model-only, --mm-disable,
--mm-encoder-weights, --mm-embed-cache-device, --mm-max-pixels
- engine and scheduler: per-request encoder-cache row ownership, chunk
planning on the batch (jobs, gather rows, scatter rows), items encoded
right before the LM forward and gathered into batch.mm_embeds
- models: the Qwen VL vision tower on the text tower's TP layers with
DeepStack, block weights streamed from pinned host banks by default,
merger outputs parked on the host between blocks; SupportsMultimodal
(encode, place_encoder_weights) and a shared embed_input_ids
- server: image inputs rejected with a client-facing reason when no
vision encoder is served; GET /v1/stats reports model.input_modalities
* feat(mm): replace the pixel cap with a token budget and processor kwargs
- --image-min-tokens / --image-max-tokens replace --mm-max-pixels; MMProcessor.get_mm_processor_kwargs turns the MultimodalConfig into the processor call's arguments, the default passes mm.processor_kwargs through and Qwen VL converts the budget to pixel areas in size.shortest_edge / longest_edge
- --mm-processor-kwargs hands a JSON object to the checkpoint's image processor call, applied after the token budget
- MMProcessor is an ABC that owns the model path, the config and the lazily loaded image processor; get_mm_processor returns None when --mm-disable leaves no encoder to serve
- the frontend tokenizer, the tokenizer worker and the offline LLM build one processor each and hand it to TokenizeManager, so the tokenize message carries no per-request pixel cap
* refactor(quant): config, scheme and method layers for checkpoint quantization
QuantConfig parses the checkpoint's quantization_config into a QuantScheme per
projection; every Linear*, ParallelLMHead and MoE layer takes quant_config and a
prefix, declares its tensors through a QuantMethod and selects its kernel at
construction. MoE kernels own the expert bank layout, pack and apply, so the
offload cache, the FTW converter and the CPU executor follow one layout.
- --quant-backend layer[.kind]=name selects kernels (--nvfp4-backend forwards to it)
- --moe-strategy replaces --moe-backend; the old spelling stays as an alias
- --moe-cpu-layers auto for Windows/WSL pin budgets; --moe-cache-auto respects the kernel's slot limit
- removes the per-family quantized layer classes, bank providers, format env switches and GLM runtime fp8
Hybrid 45-layer model (34 KDA + 11 DSA) with NVFP4 MoE (288 experts):
- KDA linear-attention kernels and op, hybrid-linear pool dispatch
generalized to any paged family
- NoPE-MLA attention with a kpool DSA indexer backend: 64-token pages,
1/ratio shadow index slab, per-request tail rings, CUDA-graph-safe
decode, prefix-cache snapshot contract
- mHC (x4 residual streams) layer with a fused split-K triton kernel;
torch reference kept as the semantic pin
- clamped-SwiGLU activation across the MoE stack
- weight loading for NVFP4 exports in the multimodal-wrapper layout:
ModelOpt and compressed-tensors (RedHatAI) tensor kinds;
Co-authored-by: Shuo Yang <73746844+andy-yang-1@users.noreply.github.com>
Serve Qwen3.8-Flash-Next (HF model_type qwen4_exp) text-only: 36 GDN +
12 QSA compressed-sparse attention layers on 4 hyper-connection residual
streams, a PLE n-gram embedding layer backed by a 47.7 GiB pinned-host
table with UVA gather, and 512 NVFP4 / block-fp8 routed experts (top-10)
plus a gated shared expert.
- attention: qsa_sparse backend (AttnType.QSA) over QSAKVCache -- paged
GQA K/V, a 1/ratio compressed index-key slab shadowing the KV pages,
and a per-request pending ring sized from index_ratio
- kvcache: declarative slot-sibling states (ModelConfig.slot_states) on
LinearStatePool carry the PLE conv history and n-gram context through
the hybrid-radix snapshot/COW lifecycle
- scheduler: hybrid prefill chunks align to the page size so snapshots
land on donatable boundaries
- kernels: triton kernels adapted from vLLM/SGLang (hc, qsa, ple gather,
moe router / shared gate) plus an original radix block top-k; int64
row addressing throughout
- moe: non-power-of-2 top-k router, deep-K marlin decode config, one
fp8 scale-bank padding rule shared with the AOT row table
- engine: the PLE table load reserves its pinned bytes from the pin
budget before the expert banks plan their residency