Conversation
Adds examples/route-trace, a measurement-only tool that dumps the per-position MoE expert selection of every routed layer in colibri's ROUTE_TRACE format. It reuses the existing backend eval callback and the graph's "ffn_moe_topk-<il>" tensor name, so no core changes are needed. Measured with colibri's route_coupling_report.py on greedy decode traces: Qwen3.8-Flash-Next (qwen4exp, 48 layers, 512 experts): L->L+1 coupled prefetch recall 37.2% at budget 8/layer (+8.3pp over marginal), lift vs independence median 2.77x / p99 101.7x. Qwopus3.6-35B-A3B (40 layers, 256 experts): 41.3% (+16.3pp), lift median 2.17x / p99 58.5x. Assisted-by: opencode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
examples/route-trace, a measurement-only tool that dumps the per-position MoE expert selection of every routed layer in colibri'sROUTE_TRACEformat:It reuses the existing
ggml_backend_schedeval callback and the graph's existingffn_moe_topk-<il>tensor name (llama_context::graph_get_cb), so no core code changes are required. Enabled withLLAMA_ROUTE_TRACE=<path>.Why
We want to decide whether a cross-layer expert prefetch ("next-token-layers") is worth introducing into the MoE expert cache. Colibri's offline calculators turn a routing trace into a concrete answer:
c/tools/route_coupling_report.py— cross-layer co-activation lift + simulated prefetch recall at a fixed experts-per-layer budget.c/tools/route_pairs.py— builds a.coli_pairscoupling table.How the trace is captured
ffn_moe_topk-<il>, so the eval callback can read it back withggml_backend_tensor_get.Results (2026-09-13, RTX 5060 Ti + RTX 3060, greedy decode, top-K = 8)
Qwen3.8-Flash-Next apex (qwen4exp, 48 layers, 512 experts, 437 positions, 305/132 train/test):
L->L+1 lift vs independence: median 2.77x, p90 16.94x, p99 101.67x.
Qwopus3.6-35B-A3B (40 layers, 256 experts, 837 positions, 585/252):
L->L+1 lift vs independence: median 2.17x, p90 10.83x, p99 58.50x.
L->L+2 is close behind on both models (36.4% / 40.6% at budget 8).
Interpretation
PILOT(71.6-75.8% recall on GLM-5.2), which needs the L+1 router run early.PREFETCH=1at -2.5% on fully resident decode for exactly this reason. The win case is a genuine cold-miss workload (CPU/disk experts), which is the deep-context qwen4exp configuration.feat/763-*lineage already carries an experimental, env-gatedGGML_CUDA_MOE_EARLY_ROUTERcross-layer lookahead inggml-cuda/moe-cache.cu. This tool provides the model-specific recall numbers that feature was missing.Related finding (recorded, no code)
ivanfioravanti/Qwen3.8-Flash-Next-DS4-IQ2(44.8 GB DS4-targeted GGUF) ships an MTP block (token-level speculation) plus metadata/results. It contains no coupling table, hotlist, or any expert-routing prediction asset, and it is a DS4-format GGUF that colibri cannot read.Testing
cmake --build build --target llama-route-trace(CUDA 13.2, arch 86;120).Notes
LLAMA_ROUTE_TRACEis set.-n 0traces the prompt only.1); the offline consumers only use expert ids.