135 Commits
Author SHA1 Message Date
Chen Cheng 4378f744aa feat(inkling2): run verify batches with a row per draft position (#971)
* feat(inkling2): decode up to eight causal rows per request in the attention kernel

* feat(inkling2): run verify batches with a row per draft position

* test(spec): hold a tiny inkling2 target to the verify contract

* feat(inkling2): attend verify rows with the multi-row decode kernel

* test(spec): count the slots and rows a free returns, tap inkling2 in bf16

* test(inkling2): say what the verify conv test guards beyond the chunk test

* test(spec): judge a penalized request's ties on the logits the sampler ranks
2026-12-02 15:59:05 -08:00
Jianhao Wang e4fce0d044 perf(moe): vectorize the hybrid expert ensure kernel (#907)
- vectorize the phase-3 route rewrite and remove the per-route barrier
- build the active mask with tl.histogram
- compute the fetch-priority score only when num_fetch > 0

Tests: pytest tests/moe -q -m "not slow" (235 passed, 24 skipped, 23 deselected)

Assisted-by: Claude Code
2026-12-02 15:44:33 -08:00
Chen Cheng 81c162be35 feat(moe): serve inkling 2 mini under --moe-strategy hybrid and cpu (#963)
* feat(moe): serve inkling 2 mini under --moe-strategy hybrid and cpu

* refactor(moe): check the softcap activation once per gated_rows call
2026-11-28 20:36:30 -08:00
Xiaoze Fan 90f44fa727 feat(inkling2): read fp8 / int8 per-token-head KV in the attention kernels (#962)
* feat(inkling2): read fp8 / int8 per-token-head KV in the attention kernels

- prefill reads this chunk's K/V from k_extend / v_extend and the prefix from the cache, with the 3 q heads of a KV head packed into one 128-row tile; bf16 uses the same kernel
- decode picks its split count per request at run time instead of a static count per batch
- drop the quantized-KV refusal and the cache-only extend kernel

* fix(inkling2): clamp masked prefix keys to a valid slot

Masked prefix tiles read slot 0 for keys past the prefix without a mask, so a NaN in that slot turned whole output rows into NaN.

- fill pool rows outside the slot list, row 0 among them, with NaN in the kernel tests
- test several requests in one extend launch and a decode batch wide enough for two rounds of splits
- round the window split cap down to a power of two
- drop the native e4m3 branch the HIP-only path never takes; rename BITS to BIT_DECODE

* fix(inkling2): skip extend tiles of requests that end before row_lo

* test(inkling2): size the wide decode batch from the split caps
2026-11-27 17:49:01 -08:00
ZihaoMu 73150e49ab perf(attention): read fp8 kv as fp16 bit patterns in rdna3 decode (#899)
gfx11 has no fp8 converts and lowers fp32 -> bf16 to integer RNE code, so the
generic E4M3 decode dominates grouped decode, repeated for every dot-operand
replica. On gfx11 the decode stage reads each E4M3 code as the fp16 bit pattern
of value/256 (exact for every finite code), pins it to the load layout, restores
the 256 in kv_row_scale and runs fp16 WMMA. It uses 16-key single-stage tiles,
a minimum split length of 32 and up to eight programs per SM.
2026-11-27 16:14:28 -08:00
Xiaoze Fan 8a5b38ab2c feat(tokenizer): serve every effort gear of a template that rejects unknown names (#960)
* feat(tokenizer): serve every effort gear of a template that rejects unknown names

* fix(tokenizer): render thinking-off as the none gear when the effort is null

- an explicit reasoning_effort null counts as no effort, as the template reads it
- test the render_prompt path with a toggle-less template
- describe the made-up-name case in the EffortProfile validates docstring
2026-11-26 22:36:05 -08:00
Xiaoze Fanandandy-yang-1 42ccacdfe6 feat(inkling2): serve inkling 2 mini (#957)
* 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>
2026-11-26 21:57:17 -08:00
Xiaoze Fan d8190845e3 fix(server): end in-flight generations when the backend worker dies (#958)
* fix(server): end in-flight generations when the backend worker dies

* fix(server): report a backend death as a server error on every route

- OpenAI routes answer backend_failed with 500 / server_error, Anthropic with 500 / api_error; other reply errors stay 400
- /generate streams the error frame before [DONE]
- the failure replies go through the stats tracker, so client-aborted requests stop counting as active
2026-11-26 20:26:36 -08:00
Xiaoze Fan 907e001815 fix(server): name the unsupported anthropic tool type in the 400 instead of a missing input_schema (#959) 2026-11-26 20:26:00 -08:00
Xiaoze Fan a7a8236b02 perf(moe): reuse the gate_up buffer for the nvfp4 prefill down output (#956)
- 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
2026-11-26 19:13:01 -08:00
Xiaoze Fan 3cdcc8037a feat(moe): add mxfp8 expert kernels for gpu and cpu (#954)
MXFP8 experts (e4m3 weights, one e8m0 code per 32 inputs of a row) are served from their quantized banks: the Triton decode and prefill kernels and the CPU executor format dequantize in the K loop, activations stay bf16. No model reader in the tree emits MXFP8 expert pieces yet.
2026-11-25 22:00:31 -08:00
William Xinze Zheng a15ddda44b fix(scheduler): wait for every tp rank's subscription before the firs… (#951)
* fix(scheduler): wait for every tp rank's subscription before the first fan-out

Rank 0 relays each request to the other ranks over ZMQ PUB/SUB, and a PUB socket drops what it sends before a subscription reaches it. A request that arrived in that window was lost on those ranks, and both sides waited until the gloo timeout. Rank 0 now publishes through an XPUB and holds its first send until every rank has subscribed under its name; a rank that never subscribes fails the send after the distributed timeout, naming it.

Assisted-by: Claude Opus 5.5

* fix(scheduler): wait for the tp ranks' subscriptions before reporting ready

Review: the wait on the first send meant a rank that never subscribed surfaced only on the first request, after the server had reported ready. Rank 0 now waits for every rank's subscription at start-up, right after sync_all_ranks (every rank has built its subscriber by then), inside the start-up try: a missing rank fails start-up, naming it, after the distributed timeout. The check on the first send stays as a guard and does nothing once the wait has run.

Assisted-by: Claude Opus 5.5
2026-11-25 21:34:08 -08:00
Chen Cheng 4237991021 perf(gguf): decode deepseek-v4.1's wo_a from its ggml blocks (#915)
* perf(gguf): decode deepseek-v4.1's wo_a from its ggml blocks

* perf(gguf): run deepseek-v4.1's decode wo_a as one batched ggml mul_mat

* fix(gguf): keep deepseek-v4.1's wo_a mmq tail zeroed and fall back where ggml has no kernel

* fix(gguf): keep deepseek-v4.1's gguf prefill on the dequantized wo_a einsum
2026-11-21 23:23:13 -08:00
Chen Cheng c84946b520 perf(cpu-moe): split the cpu executor's work by expert when tokens share one (#916) 2026-11-20 14:25:45 -08:00
Xiaoze Fan 2fb371e318 feat(kvcache): add fp8_ds_mla and nvfp4_ds_mla kv formats for deepseek-v4 / v4.1 (#920)
* 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
2026-11-18 22:04:03 -08:00
Mukkesh Ganesh 1ba3e719c1 feat(dflash): load dflash2 gguf drafts for qwen3.8-flash-next (#914)
* feat(dflash): load dflash2 gguf drafts for qwen3.8-flash-next

* fix(dflash): accept mrope sections and reuse the float qkv buffer

* docs(dflash): scope the dequantized parts to quantized ggufs
2026-11-17 16:53:10 -08:00
Chen Cheng 548f97f51e perf(gemma4): read the source layer's kv slab on kv-shared layers (#898)
* perf(gemma4): read the source layer's kv slab on kv-shared layers

* refactor(gemma4): read kv sharing from kv_shared_layers in the module and the draft view

Gemma4Attention takes its source and shared flags from config.kv_shared_layers,
the list the pool maps, and keys shared_kv by the source layer. The draft's
read-only view routes through the same list. A group whose shared layers have
no earlier layer of their type is refused at parse time.

* test(gemma4): give the tiny shared-layer configs an earlier source layer

* test(gemma4): drop the two tests of branches that already fail at load
2026-11-15 16:08:01 -08:00
Mukkesh Ganesh f2e7f24a0e perf(spec): capture the gemma4 assistant draft in cuda graphs (#903) 2026-11-14 21:53:47 -08:00
coco 4b71d4d928 fix(tokenizer): render the developer role as system for templates without it (#904) 2026-11-13 23:12:14 -08:00
Chen Cheng 27c891fe99 feat(gguf): serve deepseek-v4.1 gguf checkpoints on deepseek_v41 (#890)
* feat(gguf): serve deepseek-v4.1 gguf checkpoints on deepseek_v41

llama.cpp 10-25 added the deepseek41 layout. The reader takes the config from the file, undoes the converter (engram gate stored as the product, one per_layer_token_embd tensor, hash constants as KVs) and streams the Engram rows from the file as the HF path does.

* fix(gguf): refuse deepseek-v4.1 gguf mismatches at config time

Refuse an FTW of the GGUF before the writer creates the output dir and keep
the side-file hook after the dense loop as on main. Check the Engram hash KVs
and the table in parse_gguf_config, refuse a table with a .scale, and share
the clamp and expert_count readers with the deepseek4 GGUF reader.
2026-11-13 17:39:17 -08:00
ZihaoMu 140faab6b5 perf(attention): add packed fp8 kv reads on gfx1201 (#897)
* perf(attention): add packed fp8 kv reads on gfx1201

* refactor(attention): encapsulate packed fp8 kv readers

* fix(attention): isolate packed fp8 kv reads to amd
2026-11-13 16:17:51 -08:00
Xiaoze Fan 76d2094965 perf(attention): run up to 8 query rows per request in the triton decode kernel (#900)
* perf(attention): run up to 8 query rows per request in the triton decode kernel

Speculative verify (MTP, DFlash) and the MTP draft extend sent q_len > 1 to the extend kernel, which streams the whole context per (request, query head) with no KV split: 6.6-60x the single-row decode time at 32K-128K on sm_120.

- the grouped decode packs query rows x GQA heads in the M axis, limits each row to its own position and window, and keeps the KV split
- the triton backend sends batches of at most 8 rows per request without multimodal blocks to it
- a program's query heads divide the GQA group, which also fixes wrong output for groups above 16 that are not a multiple of 16 (e.g. 48/2)

* fix(attention): keep multi-row triton decode free of register spills on sm_80 to sm_120

- pass maxnreg=255 to multi-row stage-1 launches on CUDA: without .maxnreg ptxas holds these tiles at 80-128 registers for occupancy and spills 8-16 B on sm_80 to sm_120
- pick block_n and warps from a launch sweep under maxnreg, among the variants that do not spill on sm_80, 86, 89, 90, 100 and 120; quantized head_dim 512 takes 16 rows x heads again
2026-11-12 23:28:34 -08:00
Mukkesh Ganesh 58b3ad7ba7 feat(gemma4): speculative decoding with the assistant draft (#895)
* 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
2026-11-12 20:34:28 -08:00
Xiaoze Fan 27740fec66 feat(kvcache): add fp8 and int8 per-token-head KV cache formats (#894)
* 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
2026-11-11 15:47:50 -08:00
Xiaoze Fan 56e7f3ae38 feat(quant)!: compress bf16 weights to df11 at load with --online-quant (#891)
* feat(quant)!: compress bf16 weights to df11 at load with --online-quant

GLM-4.7 no longer hardwires DF11 attention and embedding; it serves them
bf16 unless --online-quant df11 is passed, and FTW files converted with the
old DF11 tensors must be reconverted.

* fix(quant): skip layers --online-quant cannot convert instead of failing
2026-11-11 13:24:46 -08:00
Xiaoze Fan 96dbe1dd14 feat(spec): add --speculative-token-map for a smaller mtp draft head (#892)
* feat(spec): add --speculative-token-map for a smaller mtp draft head

* feat(spec): add scripts/make_token_map.py to write a token map

* fix(spec): correct the token map vram note and seed its test
2026-11-11 12:15:09 -08:00
coco 0ad521d1a6 fix(server): send an empty signature when a streamed thinking block starts (#889) 2026-11-10 15:22:14 -08:00
Mukkesh Ganesh f69d50686d feat(server): report timings on every streamed chunk when requested (#887) 2026-11-09 21:44:40 -08:00
mkornreich d9184eb9ce feat(gemma4): serve the E2B and E4B releases (#59)
Serve the HF safetensors and GGUF files. The decoder gains per-layer inputs, KV-shared layers and E2B's double-wide MLP.

- --embed-weights host moves the per-layer table to pinned host RAM, which fits these models on an 8 GB GPU.
- The vision tower does not implement clipped linears, so these checkpoints serve text only.
- Each KV-shared layer still stores its own KV copy.
2026-11-09 20:22:26 -08:00
Xiaoze Fan fff1022a5c fix(quant): accept the modelopt_mixed quant method (#886) 2026-11-09 11:25:16 -08:00
Xiaoze Fan ef6b303304 fix(ggml): cap the MoE route sort's shared memory at the device limit (#878) 2026-11-07 23:30:06 -08:00
Xiaoze Fan 340db81ec0 fix(engine): send graph-capture KV writes to the dummy page (#877)
* fix(engine): send graph-capture KV writes to the dummy page

* test(engine): check graph capture runs on the dummy page
2026-11-07 16:55:58 -08:00
Xiaoze Fan 08cee44468 feat(spec): add DFlash 2 speculative decoding (#857)
* feat(spec): hand the pending token to Proposer.propose and return a SpecProposal

* feat(engine): Sampler.probs and sparse-q rejection

* feat(spec): let a proposer declare slot states riding the GDN slots

* feat(models): export layer outputs to the feature sink in the qwen3_5 and qwen4_exp families

* feat(attention): record the source slot of each tracked request

* feat(kernel): DFlash2 draft kernels

* feat(models): DFlash2 draft family

* feat(spec): DFlashWindow

* feat(spec): DFlashProposer

* docs(cli): add dflash to the speculative decoding section

* refactor(engine): share the sampling backend choice and drop the extra renorm in Sampler.probs

* fix(models): build the DFlash rope table uncached and refuse draft scalings it does not apply

* refactor(spec): share the draft path check between the MTP and DFlash proposers

* test(e2e): compare rebuilt outputs exactly only without hybrid MoE

* refactor(spec): keep proposer slot states on EngineConfig instead of replacing model_config

* perf(spec): compute the verify distribution once for sparse-q rejection

* perf(models): let the feature sink add the residual on the rows it keeps

* perf(models): share the DFlash draft K/V weights with the ring projection

* fix(kernel): keep the dflash selector off zero-probability candidates

* test(spec): drop the DFlash tests that the draft forward and Monte Carlo tests already cover

* fix(spec): default and cap DFlash steps at the draft's block_size - 1

* fix(models): reject DFlash draft configs the draft forward cannot serve

* test(e2e): read the MoE strategy from the rebuild test's extra args

* docs(spec): say that slot-state owners write their own prefill track snapshot

* test(models): move the DFlash draft parity tests under tests/models/dflash

* refactor(spec): drop the no-op verify handler of the DFlash window

* refactor(models): fold the DFlash candidate top-k into propose

* refactor(spec): declare the draft step limits through Proposer.num_steps only

* refactor(kernel): make the DFlash ring attention stateless and keep its workspace on the ring

* refactor(models): name the DFlash draft submodules like the other model families

* refactor(spec): move SpecProposal next to DraftContext in spec/proposer.py

* refactor(spec): hand the verify the draft distribution over the whole vocabulary

* refactor(spec): call the DFlashRing object dflash_ring and its length ring_len

* refactor(models): split the DFlash draft's propose into compute_candidates and sample_path

* refactor(spec): keep the draft distribution on its support in SpecProposal

* fix(spec): drop the step's proposal once the verify has read it

* refactor(spec): name the DFlash feature sinks DFlashPrefillSink and DFlashVerifySink

* refactor(models): read the declared Batch.features directly instead of through getattr

* test(dflash): check the window rebuild inside the block forward test

* test(spec): share the plain run of the verify contract and run the DFlash draft once per family

* test(kvcache): drop the window cases from the pool tests and check a layerless state's bytes

* test(spec): check the verify probs of each row against a torch top-k and top-p reference

* test(e2e): add an accept-len floor and a prefill chunk knob to the AIME gate

* refactor(scheduler): let callers take the speculative counts from the status reporter

* test(spec): keep the shared plain runs of the verify contract in their own temp dirs

* test(models): give the ricursive test's stand-in batch a features field
2026-11-07 12:29:18 -08:00
Chen Cheng 14119b8cbb feat(ricursive): add ripple-65b preview support (#871)
* feat(ricursive): add ripple-65b preview support

* fix(ricursive): read swiglu_clamp as a per-layer gguf array

llama.cpp's Ripple converter (ggml-org/llama.cpp#31692) writes
ricursive.swiglu_clamp with one value per layer, while the first
community GGUFs store a scalar. Accept both and refuse per-layer
values that differ, since the model has a single clamp.

* fix(ricursive): add ripple's own parsers and copy the dense reader
2026-11-06 16:17:21 -08:00
Chen Cheng 5209c8c327 perf(cpu-moe): give only the routes the cpu computes work items in a hybrid step (#866) 2026-11-06 11:36:59 -08:00
Xiaoze Fan 650dd6f6fe perf(ggml): sort MoE MMQ routes with a counting sort (#872)
* perf(ggml): sort MoE MMQ routes with a counting sort

* perf(ggml): fold the MoE MMQ tile map into the route sort
2026-11-05 13:16:03 -08:00
Xiaoze Fan 4503c424ee feat(server): add continuous_usage_stats and count shell tok/s from it (#868)
* feat(server): report running usage on stream chunks with continuous_usage_stats

* fix(shell): count tokens instead of stream chunks in the live tok/s

* refactor(server): build both openai stream usages from GenUsage

* fix(shell): reset the first-delta count per turn and ignore zero running totals
2026-11-04 22:58:51 -08:00
LZ_QAQ 628b88ff79 fix(attention): avoid overflow in triton kv cache offsets (#854)
* fix(attention): avoid overflow in triton kv cache offsets

* fix(attention): simplify kv offset dtype selection
2026-11-04 00:09:40 -08:00
Mukkesh Ganesh 9ee2e5c53f feat(gguf): load mtp drafts for the qwen3.5 family from nextn blocks and mtp-*.gguf sidecars (#856) 2026-11-03 20:27:21 -08:00
Chen Cheng e6e079cd04 fix(scheduler): stop the swa prefill commit from freeing pages the request still reads (#651) 2026-11-03 17:52:09 -08:00
Mukkesh Ganesh 03e5ea0672 feat(server): report per-request prefill and decode timings in api responses (#814)
* feat(server): report per-request prefill and decode timings in api responses

* fix(server): take timings spans from the scheduler and gate them behind --enable-timings-report

* fix(scheduler): count accepted drafts as min(n, emitted) and stamp reqstats with perf_counter
2026-11-03 14:44:25 -08:00
ZihaoMuandLZ-QWQ 9cacd0896c fix(moe): publish rocm cpu expert inputs before notification (#764)
* fix(moe): prevent stale cpu expert inputs in rocm graphs

* fix(moe): publish rocm cpu inputs with graph events

* fix(moe): qualify rocm kernel io with ordered copy fallback

* fix(moe): enable locked hybrid staging on rocm

---------

Co-authored-by: LZ-QWQ <lz1830837889@163.com>
2026-11-02 21:29:42 -08:00
Xiaoze Fan 3d23551c5b perf(cpu-moe): speed up the nvfp4 W4A8 kernels (#851)
The VNNI dots were compute bound per core; with fewer instructions per weight they reach the DRAM read bandwidth.
The W4A8 kernel now follows FREETOKEN_CPU_MOE_ISA.
2026-11-02 15:05:17 -08:00
Xiaoze Fan dacac5f5fa feat(spec): add MTP drafts for the Qwen3.5 family and Qwen3.8-Flash-Next (#844)
* feat(spec): add the MTP proposer for the qwen3_5 family

* test(models): read the qwen3_5 MTP head of bf16 and block-fp8 checkpoints

* feat(spec): verify qwen4_exp targets on qsa_sparse graphs with PLE verify handlers

* feat(spec): add the qwen4_exp MTP draft from the checkpoint or a Strata pack

* docs(cli): document the speculative decoding flags

* fix(spec): refuse MTP draft sources the draft cannot read before the target loads

* docs(qwen4_exp): describe the verify path in the PLE docstrings

* fix(spec): refuse a missing relative MTP draft path before the target loads

* fix(moe): read MTP head experts on the host and require both stacked tensors

* refactor(spec): tell the final prefill chunk from prompt_len instead of the scheduler's ChunkedReq

* refactor(spec): let each MTP draft family check its own weight source

* fix(qwen4_exp): size the disk PLE eager staging for decode and verify rows

* perf(kernel): read the KV-index gather's chunk count from the grid, not a constexpr

* refactor(moe): let each family name its MTP expert tensors

* refactor(spec): force the MTP draft's MoE resident in the proposer and check it after load

* fix(spec): refuse MTP with dummy weights

* refactor(spec): move HiddenRelay under spec/mtp, its only user

* refactor(spec): drop MTPDraft.config, fold its embed hooks into embed_tokens

* refactor(models): note FeatureSink's graph binding, drop its runtime_checkable

* fix(models): read quantized MTP fc projections under the quant config
2026-11-02 11:37:09 -08:00
Mukkesh Ganesh ea2916d31c feat(gguf): serve gpt-oss gguf checkpoints on gpt_oss (#838)
* feat(gguf): serve gpt-oss gguf checkpoints on gpt_oss

* fix(gguf): refuse missing gpt-oss bias tensors, honor swa pattern, scale nvfp4 before bias

* fix(gguf): honor gpt-oss yarn truncate, gate the bf16 float cast, scale nvfp4 before the down bias
2026-11-02 08:58:07 -08:00
A5bhinav ee43b2a113 fix(server): refuse n != 1 on /v1/completions instead of ignoring it (#842) 2026-10-29 17:15:32 -07:00
Chen Cheng ecbbce4577 fix(moe): skip inactive gguf routes in hybrid decode (#823)
* fix(moe): skip inactive gguf routes in hybrid decode

* perf(moe): run the inactive-route memset and zeroing only in hybrid decode

Only hybrid decode hands the GGUF kernel -1 routes, so mul_mat_id takes an inactive flag
and MMQ does the ids_src1 memset and the zeroing pass only when it is set. Prefill and
fused / offload decode go back to the main-branch MMQ calls.

* perf(moe): compare expert ids unsigned in mm_ids_helper

A negative (inactive) id compared unsigned sorts after every expert and equals none, so the
helper needs no remap to INT_MAX; the remap made nvcc unroll its token loop half as far.
2026-10-28 22:28:13 -07:00
Xiaoze Fan c2c3e828e8 feat(spec): verify draft tokens on the target side (#836)
* feat(spec): add the speculative verify infrastructure

* feat(scheduler): run decode steps as speculative verify steps

* chore(engine): mark the speculative decoding config fields with one comment

* feat(server): add short aliases for the speculative decoding flags
2026-10-28 21:18:02 -07:00
Chen Cheng d2977fbc13 feat(kernel): add an iq1_m mmq kernel for moe steps above 8 tokens (#835) 2026-10-28 20:48:55 -07:00
Xiaoze Fan d043fb61f8 refactor(layers): share one GatedDeltaNet op in layers/linear_attn (#841)
* refactor(layers): share one GatedDeltaNet op in layers/linear_attn

* test(layers): restore the global context in the GDN test and fix stale comments
2026-10-28 17:22:50 -07:00