mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4445] [Engine] RAZOR #1983
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1983
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ladno64 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4445
[Engine] Runtime expert exclusion with per-workload masks
Problem
Strata currently keeps every expert resident somewhere — all 24,576 experts are pinned in RAM (or in the low-RAM mirror), and the expert cache only decides which subset also sits in VRAM. This is the right default for a general-purpose inference engine, but it creates a hard floor on host memory and on SSD traffic that many workloads do not actually need.
For domain-specific deployments (code-only, chat-only, a single-language assistant, an embedded appliance), a large fraction of experts are never routed on the target distribution. Yet Strata still allocates RAM for them, still includes them in the placement plan, and still carries them in the checkpoint footprint. The only way to shed that cost today is to prune the checkpoint offline with a method like RAZOR — which is irreversible, degrades quality globally, and requires a separate checkpoint per domain.
A second, smaller problem: even the "faster answers on 12 GB cards" change, where the router prefers experts already on the card, still assumes every expert is reachable in RAM. It reduces page-ins, not the resident set.
Proposal
Add an opt-in runtime expert exclusion mode. The user supplies a per-layer mask of excluded experts. Excluded experts are:
· not loaded into VRAM,
· not pinned in RAM (or included in the low-RAM mirror),
· not read from SSD during decode.
The checkpoint is not modified. The router applies the mask before top-k: logits of excluded experts are set to -inf, and a configurable fallback restores a valid top-k. Because the mask is external and reversible, the same checkpoint can serve different profiles (code, chat, medical, edge) by switching the mask file.
This is deliberately not a silent change. It is off by default, it is explicit in configuration, and it is reported in the placement plan and at startup. That keeps it consistent with Strata's stated invariants — "precision, routing, expert count and top-k come from the checkpoint and never change silently" — because the exclusion is user-declared, not inferred.
Mechanism
· renormalize — renormalize the surviving selected experts;
· refill — promote the next candidate by rank and renormalize (the same semantics RAZOR models during saliency);
· shared — route the token to the shared expert;
· skip — skip the expert contribution (not recommended; provided only for controlled experiments).
Configuration
CLI equivalent (naming to be aligned with docs/cli.md):
Why this belongs in Strata rather than a fork
· It composes with the existing tiers. The expert cache, the low-RAM mode and the CPU pool already treat (layer, expert) as the unit of placement. Exclusion is the natural fourth state: resident, cached, streamed, excluded.
· It preserves the checkpoint contract. Strata already refuses to silently cut experts or top-k. A user-supplied mask is explicit and auditable, which is the opposite of silent degradation.
· It is reversible. A fork that prunes weights cannot A/B the same checkpoint across domains; a mask can.
· It targets the RAM floor, not just VRAM. The expert cache already addresses VRAM pressure. Exclusion addresses the host-memory floor and SSD read volume, which the cache does not.
Tradeoffs and risks
· Quality. If the mask excludes an expert that the target distribution actually needs, quality drops. This is the same loss as pruning those experts offline, because the fallback computes what the pruned model would compute. The difference is that the loss is scoped to a profile and reversible.
· Fallback correctness. refill and renormalize must match the semantics used during calibration, or the measured quality will not transfer. This should be documented and covered by tests.
· Shared experts. The shared expert should probably be excluded from masking by default, but the decision needs to be explicit.
· Low-RAM mode interaction. In low-RAM mode only the non-VRAM experts are pinned; exclusion must compose cleanly with that set arithmetic.
· Quantization and MTP. Exclusion should be orthogonal to weight quantization and to the MTP draft layer, but this needs verification on at least one quantized checkpoint.
Calibration (optional, but expected in practice)
A small tool that runs a corpus through the existing saliency-style forward pass and emits a mask file:
This does not need to be part of the first PR; a hand-written mask plus documentation is enough to prove the mechanism.
Suggested implementation plan
Alternatives considered
· Offline pruning (RAZOR-style). Rejected for the default path: irreversible, global, one checkpoint per domain. Still valid as an external preprocessing step for users who want the smaller checkpoint.
· Router bias only (prefer on-card experts). Already present for 12 GB cards; it reduces page-ins but keeps every expert resident in RAM. It does not address the RAM floor.
· Rely on --stream-experts or SSD streaming alone. These keep the full expert set reachable; they trade RAM for latency but do not let a workload fit on a machine that cannot hold the full set at all.
Open questions for maintainers
@github-actions[bot] commented on GitHub (Oct 28, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@github-actions[bot] commented on GitHub (Oct 28, 2026):
Thanks, this follows the format now.
@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.