[GH-ISSUE #587] tools/make_profile.py --base cannot reorder a complete base (shipped profile reports 0 from the traces) #276

Closed
opened 2026-11-04 01:41:33 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @yannickloth on GitHub (Oct 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/587

tools/make_profile.py is documented to rank "the base profile's ranking, then the pairs your routing traces used, most frequent first" so a --dump-routing trace of your workload seeds the cache with the experts it actually routes. But the base is only ever appended to, and the shipped data/expert-profile.bin already ranks all 24,576 (layer, expert) pairs — so with it the trace cannot change anything:

$ python tools/make_profile.py coding-trace.bin --base data/expert-profile.bin --out /tmp/prof.bin
wrote /tmp/prof.bin: 24576 ranked pairs (24576 from the base, 0 from the traces, 0 filled in)

/tmp/prof.bin is byte-identical to data/expert-profile.bin. The only way to let a trace order the top is --no-base, which throws the shipped ranking away entirely.

In rank_profile/main, take(read_profile(base)) fills all 24,576 slots before the trace pairs are considered, and take() skips anything already seen. This matters because --expert-cache auto fills the VRAM tier from the profile in order; a workload-specific profile therefore never gets to put its most-routed experts in the slots that fit. (Measured on an RTX A3000 12 GB / Swift 1.5 IQ3_XXS: the shipped base is 2,107 resident slots; a workload-ranked profile raised the fresh-conversation hit rate 0.468 → 0.528, but only via --no-base.)

Proposed fix

Add --reorder: rank the trace's pairs first (most frequent first), then let the base fill the rest, then the fill — so a trace orders the top while the base still covers everything the trace did not see. Default behaviour is unchanged. PR: #589.

Originally created by @yannickloth on GitHub (Oct 3, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/587 `tools/make_profile.py` is documented to rank "the base profile's ranking, then the pairs your routing traces used, most frequent first" so a `--dump-routing` trace of your workload seeds the cache with the experts it actually routes. But the base is only ever *appended to*, and the shipped `data/expert-profile.bin` already ranks all 24,576 `(layer, expert)` pairs — so with it the trace cannot change anything: ``` $ python tools/make_profile.py coding-trace.bin --base data/expert-profile.bin --out /tmp/prof.bin wrote /tmp/prof.bin: 24576 ranked pairs (24576 from the base, 0 from the traces, 0 filled in) ``` `/tmp/prof.bin` is byte-identical to `data/expert-profile.bin`. The only way to let a trace order the top is `--no-base`, which throws the shipped ranking away entirely. In `rank_profile`/`main`, `take(read_profile(base))` fills all 24,576 slots before the trace pairs are considered, and `take()` skips anything already seen. This matters because `--expert-cache auto` fills the VRAM tier from the profile *in order*; a workload-specific profile therefore never gets to put its most-routed experts in the slots that fit. (Measured on an RTX A3000 12 GB / Swift 1.5 IQ3_XXS: the shipped base is 2,107 resident slots; a workload-ranked profile raised the fresh-conversation hit rate 0.468 → 0.528, but only via `--no-base`.) ### Proposed fix Add `--reorder`: rank the trace's pairs first (most frequent first), then let the base fill the rest, then the fill — so a trace orders the top while the base still covers everything the trace did not see. Default behaviour is unchanged. PR: #589.
Author
Owner

@Niko1221 commented on GitHub (Oct 4, 2026):

Fixed in 0.1.39 by #589: tools/make_profile.py --reorder ranks your --dump-routing trace's pairs first, then the base's, then the rest. Without the flag the output is unchanged.

<!-- gh-comment-id:5979965428 --> @Niko1221 commented on GitHub (Oct 4, 2026): Fixed in 0.1.39 by #589: `tools/make_profile.py --reorder` ranks your `--dump-routing` trace's pairs first, then the base's, then the rest. Without the flag the output is unchanged.
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#276
No description provided.