Pull requests / #2774

#2774 Short prompt chunks: router push + decode grouped kernel for resident experts

open · @apatassini · 0 Kommentare · Auf GitHub

BenchmarksNVIDIA / CUDAModels & quants

Beschreibung

Agent workloads read many short prompt chunks (tool results, file excerpts): in a 5-hour coding-agent session on an RTX 5070 Ti
(Qwen3.8-Flash-Next GSQ-RCO Q2_0, 256K) 74% of the reads were under 1,000 tokens and took 57% of the read time, at 200-750 tok/s.

With `STRATA_PREFILL_TIMING=1`, a 170-token chunk spends ~40% in what the timer calls "dequant": on a canonical (non-native)
pack, below `stream_all_min` MMQ converts every expert blob into GGUF blocks with one `gather_strata_q2` launch per expert
(~14,000 launches for 170 tokens); the copies from RAM are only ~3%.

The branch adds, for chunks below `stream_all_min` only:
- `STRATA_PF_ROUTE_PRIOR=lambda` — the decode push (`route_prior_top10`) also in the prefill router (opt-in, changes outputs
  like `STRATA_ROUTE_PRIOR`);
- resident experts used by at most `STRATA_PF_DIRETTO_MAX` rows (default 8) leave MMQ's list — their rows form a block after the
  local ones, as the CPU share does — and run on `moe_grouped_s2` (or `native_expert_grouped` for native packs) straight from the
  compressed blob, in calls of up to 1,024 rows with a small own scratch (9 MiB). `STRATA_PF_DIRETTO=0` turns it off.

Measured (28K cached context, appended chunk, RTX 5070 Ti): 177 tokens 473 → ~315 ms, ~500 668 → ~470 ms, ~900 826 → ~677 ms;
>= 1,024 tokens and decode unchanged. Max rows 16 ≈ 8; 4 is worse; all rows is much worse (the decode kernel re-reads the blob
every 8 rows).

Two pitfalls found on the way: `moe_grouped_s2` handles at most `GMAX = 8` rows per group and silently drops the rest; MMQ closes
its last group at `rows_local` (`bounds_host[n]`), so `rows_local` must exclude the new block.

The read push is opt-in; so far only sanity-checked on outputs, no separate quality run yet (the decode push `STRATA_ROUTE_PRIOR=1.0` was quality-checked on two real tasks, 3+3 runs, no measurable loss).

Full notes and measurements: https://github.com/apatassini/Strata/blob/qwen38-16gb/QWEN38.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Mehr auf der Site

Links zu Install, Modellen, Releases.