[GH-ISSUE #4812] [Engine] opt-in per-expert router bias from a routing profile (a graded, fixed STRATA_ROUTE_PRIOR) #2206

Open
opened 2026-11-04 01:57:30 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @oisee on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4812

Area

[Engine] (speed, kernels, models, the server and API)

What do you want to do?

Run Qwen3.8-Flash-Next for one kind of work (in our case a coding agent) and hold the router to the experts that work
actually uses, by a fixed amount per expert taken from an offline profile of that work.

Today the only routing knob that steers towards a set of experts is STRATA_ROUTE_PRIOR: one flat bonus for whatever
is resident at the moment. That set moves with the adaptive tier, and the bonus is the same for an expert the workload
uses a lot and one it never uses.

The proposal: STRATA_ROUTE_BIAS=<file.strb>, a table with one bias per (layer, expert), built offline from the
routing of the user's own workload (--dump-routing traces, as tools/collect_profile_traces.py already makes them).
Each layer picks its top-10 by logit + bias; the weights stay the router's, as with the prior. Kept experts get 0;
cold experts get a graded negative bias by how far below the keep line they are, down to a cap. Opt-in, off by
default; unset, no kernel runs and the output is unchanged. CUDA (HIP compiles the same code); the Mac and SYCL engines
refuse the variable.

Measured on current main (c62d5e3a + the patch, 2 x RTX 4060 Ti 16 GB, IQ3_S), with tools/quant_quality.py and
tools/ab_engine.py:

  • Unset, the forced-window log-probabilities are byte-identical to main's.
  • KL against the unchanged model: 0.086 at cap -0.5 and 0.132 at cap -1. The prior at 0.5 / 0.7 / 1.5: 0.075 / 0.094 /
    0.225.
  • Speed: decode on three short chats +3% / +6% (two cards) and +2% / +5% (one card), but on a 6K-prompt answer -0% / -6%
    and -9% / -1%; with different texts per arm and a few percent run-to-run spread we claim no speed change. At the
    same KL the prior is faster
    on one card (0.5: +26%, 0.7: +25%). So this is not a speed feature: what it offers is a
    fixed per-expert selection from a workload profile, independent of the adaptive tier and of the VRAM size.
  • Agent tasks (on our fork, engine 0.1.53, the same kernels): ABAP repository tasks with Claude Code, cap -0.5 against
    cap -1 interleaved, 8 of 8 solved; no unbiased arm was run there.

It is related to #4445 (runtime expert exclusion with masks): a hard mask is the -inf case of this table. This change
does not touch placement or memory; it only moves the picks.

A draft PR is ready (code, tools/make_route_bias.py, tests, docs, measurements). Is this in scope, given that the
prior is faster at equal KL? If not, we keep it in our fork.

What do you do today instead?

A fork with the patch, or STRATA_ROUTE_PRIOR.

🤖 Generated with Claude Code

Originally created by @oisee on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4812 ### Area [Engine] (speed, kernels, models, the server and API) ### What do you want to do? Run Qwen3.8-Flash-Next for one kind of work (in our case a coding agent) and hold the router to the experts that work actually uses, by a fixed amount per expert taken from an offline profile of that work. Today the only routing knob that steers towards a set of experts is `STRATA_ROUTE_PRIOR`: one flat bonus for whatever is resident at the moment. That set moves with the adaptive tier, and the bonus is the same for an expert the workload uses a lot and one it never uses. The proposal: `STRATA_ROUTE_BIAS=<file.strb>`, a table with one bias per (layer, expert), built offline from the routing of the user's own workload (`--dump-routing` traces, as `tools/collect_profile_traces.py` already makes them). Each layer picks its top-10 by `logit + bias`; the weights stay the router's, as with the prior. Kept experts get 0; cold experts get a graded negative bias by how far below the keep line they are, down to a cap. Opt-in, off by default; unset, no kernel runs and the output is unchanged. CUDA (HIP compiles the same code); the Mac and SYCL engines refuse the variable. Measured on current main (`c62d5e3a` + the patch, 2 x RTX 4060 Ti 16 GB, IQ3_S), with `tools/quant_quality.py` and `tools/ab_engine.py`: - Unset, the forced-window log-probabilities are byte-identical to main's. - KL against the unchanged model: 0.086 at cap -0.5 and 0.132 at cap -1. The prior at 0.5 / 0.7 / 1.5: 0.075 / 0.094 / 0.225. - Speed: decode on three short chats +3% / +6% (two cards) and +2% / +5% (one card), but on a 6K-prompt answer -0% / -6% and -9% / -1%; with different texts per arm and a few percent run-to-run spread we claim no speed change. **At the same KL the prior is faster** on one card (0.5: +26%, 0.7: +25%). So this is not a speed feature: what it offers is a fixed per-expert selection from a workload profile, independent of the adaptive tier and of the VRAM size. - Agent tasks (on our fork, engine 0.1.53, the same kernels): ABAP repository tasks with Claude Code, cap -0.5 against cap -1 interleaved, 8 of 8 solved; no unbiased arm was run there. It is related to #4445 (runtime expert exclusion with masks): a hard mask is the `-inf` case of this table. This change does not touch placement or memory; it only moves the picks. A draft PR is ready (code, `tools/make_route_bias.py`, tests, docs, measurements). Is this in scope, given that the prior is faster at equal KL? If not, we keep it in our fork. ### What do you do today instead? A fork with the patch, or `STRATA_ROUTE_PRIOR`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2206
No description provided.