[GH-ISSUE #5366] [Engine] Opt-in reduced expert Top-k with Top-10 normalization and idle switching #3198

Open
opened 2026-11-07 14:38:49 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @LinneRELLa on GitHub (Nov 6, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5366

User problem

On a Ryzen 7 5700X / 64 GB DDR4 / RX 9070 XT 16 GB Windows PC, I have been trying an explicit speed/quality tradeoff for native Flash-Next IQ3_S: evaluate fewer routed experts during generation, while leaving checkpoint files and the shared expert unchanged. Restarting and reloading the model to compare full Top-10 and reduced Top-6 is inconvenient.

Would an opt-in experimental reduced expert width, initially HIP-only, be in scope? I have working prototype code and local measurements. I am asking about scope before opening a feature PR, as CONTRIBUTING.md requests.

Proposed behavior

  • Full checkpoint Top-10 stays the default. A user must explicitly opt into approximate inference.
  • Select the original Top-10 probabilities, evaluate the first six experts, and retain the original Top-10 denominator. The missing four contributions are dropped. This changes model output; it is not lossless, a new quantization, or a smaller checkpoint.
  • Initially leave batched prefill at Top-10; reduce decode, verifier and MTP expert execution width. The CPU/GPU work lists actually shrink rather than merely assigning zero weights to four experts.
  • Optionally switch 10 <-> 6 between requests, retaining loaded weights and expert caches. Allocate buffers at Top-10 capacity, rebuild width-dependent execution graphs and clear sequence state when changing mode. A subsequent request must prefill again.
  • Mode-aware snapshot identity must reject cross-mode restore. The service must serialize switching with inference and reject a switch while busy. No multi-model concurrent serving is proposed.

A startup-only option could be a smaller first PR, with idle switching in a follow-up. Public option/API names are not settled.

Prototype and evidence

Code: https://github.com/LinneRELLa/Strata/tree/proposal/flash-next-runtime-topk

Design, reproduction details and limits: https://github.com/LinneRELLa/Strata/blob/proposal/flash-next-runtime-topk/docs/experiments/FLASH_NEXT_RUNTIME_TOPK.md

Saved measurement projections and router results: https://github.com/LinneRELLa/Strata/tree/proposal/flash-next-runtime-topk/bench/results/2026-11-05-rx9070xt-topk-prototype

The prototype is based on c62d5e3a15b40ea51c96aae9e8d36928965f53ab (engine 0.1.55), not current main. It is provided for discussion, not as a ready-to-merge patch. The local Python HTTP/controller integration used for the tests is outside this branch; the engine-side switch and arithmetic changes are included. An upstream service interface would need a separate, general implementation.

Local validation

Environment: Windows, Ryzen 7 5700X, 64 GB DDR4, RX 9070 XT 16 GB (gfx1201), HIP Release build, native ISTA-DASLab original GSQ-RCO IQ3_S, ROCm SDK clang 22 with the MSVC toolchain.

Passed, on the recorded local build:

  • Seven K/reference router combinations matched an independent CPU oracle, including ties, extreme finite logits and compact-stride guards. Default Top-10 matched the portable router in the recorded parity test. A standalone rerun of topk_reference 10 10 and topk_reference 6 10 on 2026-11-06 returned zero failures and zero maximum absolute error; this rerun used the existing binary, not a new build.
  • Five rounds 10 -> 6 -> 10 -> 6 -> 10, same engine PID, four checks per round: arithmetic, same-mode prefix reuse, structured tool call and execution of generated Python. Twenty checks completed.
  • Engine control times for the four switches: 44.228 / 40.854 / 43.728 / 50.189 ms. These exclude state saving, controller overhead, next-use graph recapture and subsequent prefill.
  • The local controller returned HTTP 409 for a switch during generation. Cross-mode snapshot restore returned 400; a same-mode snapshot restored 446 tokens.
  • An earlier separately loaded/warmed width sweep measured 24.37 tok/s Top-10/ref10 vs 36.71 tok/s Top-6/ref10. Each mode produced four 384-token outputs (two code, two Chinese). Fixed 32 GiB expert RAM, 2,975 GPU slots / 5.70 GiB, PCIe fraction 0.40, spec=4, spec-min-p=0.5, STRATA_SPEC_COST=1, STRATA_ROUTE_TAIL_SKIP=0, temperature 0, seed 8167, reasoning off. Aggregate = output tokens / decode seconds, excluding prefill and loading. Different outputs and MTP acceptance make this a small behavioral throughput comparison, not a fixed-trajectory benchmark or a general 50% speedup claim.

Failed during development / quality limitations:

  • The first hot-switch attempt failed after switching to Top-6 because plan-field offsets incorrectly followed active width. Keeping offsets tied to allocated sink_.cap fixed that observed failure before the successful five-round test.
  • The 12-item smoke set scored 9/12 for both Top-10/ref10 and Top-6/ref10. Top-6/ref6 and Top-5/ref10 scored 8/12. This tiny set does not establish equivalent quality. Informal longer agent use showed inconsistent behavior without a controlled A/B. No unchanged reasoning, coding or agent quality is claimed.

Not run: current-main build or model execution; CUDA, SYCL or Metal builds; a complete default-off byte-identity comparison of this patch; teacher-forced KL/PPL, large quality evaluations or a controlled long-context agent benchmark. HIP router parity does not establish these checks. No backend compatibility beyond the recorded Windows HIP path is claimed.

Scope and tradeoffs

The prototype is single-GPU, native IQ3_S, single-slot only. It rejects batch/pipeline/peer/multi-GPU combinations. It contains local experiment plumbing and a Windows HIP diagnostics lookup workaround that should be removed or split before any feature PR. The older startup sweep also permits reference=K, but its snapshot fingerprint is not general enough for that mode; a first upstream version could expose only reference=10.

I searched open and closed issues/PRs for Top-k, reduced activated experts, reference normalization and expert pruning. #4445 is related but asks for per-workload expert exclusion and a lower host-memory footprint. This proposal keeps every expert available and changes active compute width, so it has a different interface and goal.

Is a clearly labelled experimental mode acceptable in principle? If so, would you prefer a startup-only option first, or include idle switching and state invalidation in the initial scope? If this is intentionally outside Strata's routing contract even when explicitly enabled, I can keep the experiment in the fork.

AI assistance was used for the local implementation and this write-up. The reported observations are from saved local runs; this proposal does not claim unperformed validation or maintainer acceptance.

Originally created by @LinneRELLa on GitHub (Nov 6, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5366 ## User problem On a Ryzen 7 5700X / 64 GB DDR4 / RX 9070 XT 16 GB Windows PC, I have been trying an explicit speed/quality tradeoff for native Flash-Next IQ3_S: evaluate fewer routed experts during generation, while leaving checkpoint files and the shared expert unchanged. Restarting and reloading the model to compare full Top-10 and reduced Top-6 is inconvenient. Would an **opt-in experimental reduced expert width**, initially HIP-only, be in scope? I have working prototype code and local measurements. I am asking about scope before opening a feature PR, as CONTRIBUTING.md requests. ## Proposed behavior - Full checkpoint Top-10 stays the default. A user must explicitly opt into approximate inference. - Select the original Top-10 probabilities, evaluate the first six experts, and retain the original Top-10 denominator. The missing four contributions are dropped. This changes model output; it is not lossless, a new quantization, or a smaller checkpoint. - Initially leave batched prefill at Top-10; reduce decode, verifier and MTP expert execution width. The CPU/GPU work lists actually shrink rather than merely assigning zero weights to four experts. - Optionally switch `10 <-> 6` **between requests**, retaining loaded weights and expert caches. Allocate buffers at Top-10 capacity, rebuild width-dependent execution graphs and clear sequence state when changing mode. A subsequent request must prefill again. - Mode-aware snapshot identity must reject cross-mode restore. The service must serialize switching with inference and reject a switch while busy. No multi-model concurrent serving is proposed. A startup-only option could be a smaller first PR, with idle switching in a follow-up. Public option/API names are not settled. ## Prototype and evidence Code: https://github.com/LinneRELLa/Strata/tree/proposal/flash-next-runtime-topk Design, reproduction details and limits: https://github.com/LinneRELLa/Strata/blob/proposal/flash-next-runtime-topk/docs/experiments/FLASH_NEXT_RUNTIME_TOPK.md Saved measurement projections and router results: https://github.com/LinneRELLa/Strata/tree/proposal/flash-next-runtime-topk/bench/results/2026-11-05-rx9070xt-topk-prototype The prototype is based on `c62d5e3a15b40ea51c96aae9e8d36928965f53ab` (engine 0.1.55), **not current main**. It is provided for discussion, not as a ready-to-merge patch. The local Python HTTP/controller integration used for the tests is outside this branch; the engine-side switch and arithmetic changes are included. An upstream service interface would need a separate, general implementation. ## Local validation Environment: Windows, Ryzen 7 5700X, 64 GB DDR4, RX 9070 XT 16 GB (`gfx1201`), HIP Release build, native ISTA-DASLab original GSQ-RCO IQ3_S, ROCm SDK clang 22 with the MSVC toolchain. **Passed, on the recorded local build:** - Seven K/reference router combinations matched an independent CPU oracle, including ties, extreme finite logits and compact-stride guards. Default Top-10 matched the portable router in the recorded parity test. A standalone rerun of `topk_reference 10 10` and `topk_reference 6 10` on 2026-11-06 returned zero failures and zero maximum absolute error; this rerun used the existing binary, not a new build. - Five rounds `10 -> 6 -> 10 -> 6 -> 10`, same engine PID, four checks per round: arithmetic, same-mode prefix reuse, structured tool call and execution of generated Python. Twenty checks completed. - Engine control times for the four switches: **44.228 / 40.854 / 43.728 / 50.189 ms**. These exclude state saving, controller overhead, next-use graph recapture and subsequent prefill. - The local controller returned HTTP 409 for a switch during generation. Cross-mode snapshot restore returned 400; a same-mode snapshot restored 446 tokens. - An earlier separately loaded/warmed width sweep measured **24.37 tok/s Top-10/ref10 vs 36.71 tok/s Top-6/ref10**. Each mode produced four 384-token outputs (two code, two Chinese). Fixed 32 GiB expert RAM, 2,975 GPU slots / 5.70 GiB, PCIe fraction 0.40, spec=4, spec-min-p=0.5, `STRATA_SPEC_COST=1`, `STRATA_ROUTE_TAIL_SKIP=0`, temperature 0, seed 8167, reasoning off. Aggregate = output tokens / decode seconds, excluding prefill and loading. Different outputs and MTP acceptance make this a small behavioral throughput comparison, not a fixed-trajectory benchmark or a general 50% speedup claim. **Failed during development / quality limitations:** - The first hot-switch attempt failed after switching to Top-6 because plan-field offsets incorrectly followed active width. Keeping offsets tied to allocated `sink_.cap` fixed that observed failure before the successful five-round test. - The 12-item smoke set scored 9/12 for both Top-10/ref10 and Top-6/ref10. Top-6/ref6 and Top-5/ref10 scored 8/12. This tiny set does not establish equivalent quality. Informal longer agent use showed inconsistent behavior without a controlled A/B. No unchanged reasoning, coding or agent quality is claimed. **Not run:** current-main build or model execution; CUDA, SYCL or Metal builds; a complete default-off byte-identity comparison of this patch; teacher-forced KL/PPL, large quality evaluations or a controlled long-context agent benchmark. HIP router parity does not establish these checks. No backend compatibility beyond the recorded Windows HIP path is claimed. ## Scope and tradeoffs The prototype is single-GPU, native IQ3_S, single-slot only. It rejects batch/pipeline/peer/multi-GPU combinations. It contains local experiment plumbing and a Windows HIP diagnostics lookup workaround that should be removed or split before any feature PR. The older startup sweep also permits reference=K, but its snapshot fingerprint is not general enough for that mode; a first upstream version could expose only reference=10. I searched open and closed issues/PRs for Top-k, reduced activated experts, reference normalization and expert pruning. #4445 is related but asks for per-workload expert exclusion and a lower host-memory footprint. This proposal keeps every expert available and changes active compute width, so it has a different interface and goal. Is a clearly labelled experimental mode acceptable in principle? If so, would you prefer a startup-only option first, or include idle switching and state invalidation in the initial scope? If this is intentionally outside Strata's routing contract even when explicitly enabled, I can keep the experiment in the fork. AI assistance was used for the local implementation and this write-up. The reported observations are from saved local runs; this proposal does not claim unperformed validation or maintainer acceptance.
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#3198
No description provided.