Repository navigation
router: measure per-layer expert locality on recent prose and code - #66
Conversation
|
Thanks. I recomputed the all-layer rows from the per-layer rows and they match. The adapter patch applies to tools/ref/router_trace.cpp on main, and the locality self-test passes. We will finish it on our side and merge it. You do not need to change anything. We add a short "Decision" paragraph:
One thing only you have: the commands behind the cross-genre 17.2 / 14.0 % and the in-sample 39.2 / 46.8 % figures. If you paste them here, we add them to Reproduction. |
|
Following up on your request for the commands behind the cross-genre and in-sample figures: I recovered the original trace sets and reran both commands below. Their complete stdout is byte-for-byte identical to the archived From the bloomery checkout ( EVIDENCE=/home/jutai05/bloomery-contributions/issue31-evidence
A="$EVIDENCE/data/router/prose-8192"
B="$EVIDENCE/data/router/code-8192"
# A = prose, B = code; learn each hot-32 list on all 8,192 tokens.
python3 tools/ref/router-coverage.py transfer "$A" "$B" --n 32
# Separate in-sample and held-out tables for each corpus.
python3 tools/ref/router-coverage.py coverage "$A" "$B" --n 32The
Thus A-list on B is prose-trained -> code-evaluated, and B-list on A is code-trained -> prose-evaluated. The separate Provenance checked again:
This is a replay of the original CPU-collected traces, not a fresh model collection or GPU measurement. The source/model/schedule remain those in the merged report. |
What and why
Adds per-layer LRU-64/128 and held-out static top-32 replay to the existing router analyzer, with validation of expert ids and agreement between count files and top-k rows. The report records two repeatable 8,192-token CPU traces on recent prose/code, the text sources and model hashes, and a 512-token scalar-vs-batch check. Mean LRU-64 hits are 67.7%/73.3%, above the issue's 60% criterion; these are locality measurements, not GPU speedups. Closes #31.
Code shape
cargo fmtandcargo clippy: no Rust source changed; validation covers the Python analyzer, report and adapter patch.Existing policy at
tools/ref/router-residency.py:568is a shared cross-layer LRU with copy budgets. This report's fixed-count per-layer replay is a different measurement contract; its start-of-token and context-reset controls are explicit.What I ran
Both full traces were collected twice; every top-k file and count file is byte-identical across the two collections. The mainline API adapter patch was applied to a copy of the original collector and verified to reproduce the compiled source exactly. The first full check had one transient gate-batch fixture failure; a standalone rerun passed 542/542, and the subsequent complete check-recipes run passed without changing the gate code.
Maintainer hardware gates remain for the maintainer. The attached report includes per-layer tables, replay rules, schedule sensitivity, collection commands and provenance. The adapter patch is for reproducing this measurement against the pinned mainline API; it does not replace the existing ik collector or change production execution.
Hardware
Intel i5-12600K, 64 GiB RAM, Linux 7.0.0-38-generic. Routing collection uses CPU only with no KV/operation offload. Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS has 48 routed layers, 512 experts and top-10 routing. Mainline llama.cpp
fb4b2737a808a3fb7c2117a498f43815dc9be53e, local Vulkan-only modifications, CPU backend unchanged; report includes the API adapter and exact model hashes. No NVIDIA timing evidence is claimed.