Dataset Viewer
Auto-converted to Parquet Duplicate
index
int64
0
2.75k
domain
stringclasses
28 values
dataset
stringclasses
50 values
layers
dict
0
cs_hellaswag
hellaswag_eval.json
{"0":{"hits":[4,3,9,19,18,2,0,7,1,5,40,0,8,0,2,2,13,0,2,26,0,13,0,11,5,1,0,0,13,0,3,7,10,0,15,0,16,1(...TRUNCATED)
1
multilingual
aya_multilingual
{"0":{"hits":[1,2,10,0,6,5,0,1,1,3,3,1,9,0,0,0,0,2,0,7,0,1,0,1,5,7,55,0,3,0,1,3,4,2,3,0,4,1,0,0,0,0,(...TRUNCATED)
2
code_doc
code_x_glue
{"0":{"hits":[10,16,8,1,5,15,0,6,1,4,9,4,1,0,0,7,3,16,4,12,4,2,0,7,8,2,0,41,0,0,10,11,3,2,3,19,3,12,(...TRUNCATED)
3
code_gen
data-evol_instruct-decontaminated.jsonl
{"0":{"hits":[19,4,3,12,14,2,0,11,1,13,23,0,7,9,1,1,6,10,10,17,16,13,3,5,10,6,0,19,0,0,1,2,27,1,6,6,(...TRUNCATED)
4
multilingual
aya_multilingual
{"0":{"hits":[1,0,17,0,11,5,0,1,5,3,3,2,11,0,1,0,1,0,0,7,0,2,0,3,4,54,75,0,4,0,8,0,3,1,2,0,2,1,0,0,0(...TRUNCATED)
5
multilingual
aya_multilingual
{"0":{"hits":[1,0,26,0,8,2,0,1,9,4,3,12,5,0,7,0,1,0,1,7,1,4,0,6,7,4,0,0,0,0,11,1,3,0,7,1,11,1,0,6,0,(...TRUNCATED)
6
books_long
pg19_books
{"0":{"hits":[22,41,360,870,594,216,0,126,295,212,410,91,228,74,520,1045,217,168,41,678,473,918,10,4(...TRUNCATED)
7
knowledge
test.jsonl
{"0":{"hits":[1,1,6,0,5,2,0,2,3,4,3,0,0,0,0,2,1,0,2,11,1,10,0,5,4,1,0,0,11,0,2,3,3,0,7,0,5,2,0,2,0,1(...TRUNCATED)
8
prose_wiki
wiki.test.raw
{"0":{"hits":[1,5,23,30,12,9,0,9,5,16,29,17,19,0,60,47,31,19,4,50,9,48,0,43,27,3,28,0,12,2,51,55,46,(...TRUNCATED)
9
prose_long
wiki.test.raw
{"0":{"hits":[8,6,98,113,27,20,0,130,81,68,191,4,68,0,165,191,80,66,6,160,226,176,0,87,70,29,94,0,39(...TRUNCATED)
End of preview. Expand in Data Studio

Qwen3.8-Flash-Next Expert Activation Map

Per-(layer, expert) routing and output-importance statistics for Qwen3.8-Flash-Next (Qwen4Exp architecture, 48 MoE layers x 512 routed experts, top-k 10), measured on the unquantized bf16 checkpoint over a 2751-prompt, 28-domain calibration corpus.

The purpose is to answer, per layer, which experts carry the model's routed output so that expert-level decisions (bf16 protection under quantization, offload residency, pruning, warm-start ordering) can be made from measured activation importance rather than routing frequency alone.

Files

file contents
expert_map_sequences.jsonl.gz one gzip-compressed JSON row per calibration prompt: per-layer per-expert hits and importance (see schema)
heatmap_2751.png two-panel heatmap of expert importance relative to uniform, by expert id and rank-sorted within each layer

No prompt text is included. Each row carries only the prompt's domain tag, dataset label, and the routing statistics it produced.

How it was captured

The capture runs the model through vLLM (the tcclaviger/vllm ROCm fork, image 28.04.11) and reads, at every MoE layer on every forward, the fused kernel's per-slot gate-weighted expert output tensor (ic3, shape [tokens, top_k, hidden]) immediately before it is summed into the layer output. That tensor is the model's own kernel output for each routed (token, expert) pair, so the measurement is exact for the served model and independent of the expert kernel in use.

From ic3 and the kernel's topk_ids / topk_weights, per expert:

  • hits — number of (token, slot) routings to the expert
  • importance — sum(||ic3[t, j, :]||_2) over routings, i.e. the summed L2 norm of the expert's gate-weighted output. This is the weighted_ean_sum metric of REAP (Cerebras), the total contribution an expert makes to the layer's routed output magnitude.

Statistics are accumulated per prompt (the prompt boundary is the generate() call), so every row is attributable to one prompt and one domain. Tensor-parallel partial sums are all-reduced across ranks before the norms are taken. The fused shared-expert slot the serving stack appends to topk_ids is captured and dropped; only the 512 routed experts are reported.

Engine configuration for the capture:

setting value
checkpoint Qwen3.8-Flash-Next, bf16
tensor parallel 4 x gfx1201 (AMD Radeon AI PRO R9700, 32 GB)
expert offload 36 of 48 expert layers host-resident (170 GiB), 6 GiB VRAM slot pool per GPU
PLE NVMe-offloaded table, 8 GiB cache
prefill chunked, 2048 tokens per forward, one sequence per forward
KV cache fp8
eager mode on (no CUDA graph replay, so every layer forward runs the capture)
prefix caching off (every token is forwarded and counted)

Calibration corpus

2751 prompts across 28 domains, interleaved in random order so that any prefix of the run is a representative mix. Per-prompt token caps: 512, 1024 (default), 2048, 4096, 16384, and 32768 depending on the source. Domains:

books_long, books_xlong, code_breadth, code_doc, code_files, code_gen, code_long, code_proj, cot, creative, cs_arc, cs_hellaswag, cs_winogrande, dialogue, instruct, knowledge, literary, math_comp, math_grade, ml_knowledge, multilingual, prose_long, prose_wiki, safety, science_hard, summarize, tools, vision (image rows go through the vision tower).

Roughly 3.9 million tokens and 1.86 billion routing decisions in total.

Schema of expert_map_sequences.jsonl.gz

One JSON object per line, one line per prompt, in run order:

{
  "index": 0,
  "domain": "code_gen",
  "dataset": "magicoder",
  "layers": {
    "0":  {"hits": [512 ints], "importance": [512 floats]},
    "1":  {"hits": [...],      "importance": [...]},
    ...
    "47": {"hits": [...],      "importance": [...]}
  }
}
  • layers keys are real decoder-layer indices, "0" to "47".
  • Arrays are indexed by routed expert id, 0 to 511.
  • hits[e] is an integer count; importance[e] is a float32 sum, kept to five significant figures.
  • A layer the prompt never routed through is omitted from that row (does not occur on this corpus).

Each line is its own gzip member, so the file can be read incrementally and any prefix of it is a valid file.

Reading it

import gzip, json
import numpy as np

L, E = 48, 512
hits = np.zeros((L, E)); imp = np.zeros((L, E))
with gzip.open("expert_map_sequences.jsonl.gz", "rt") as fh:
    for line in fh:
        row = json.loads(line)
        for lid, v in row["layers"].items():
            hits[int(lid)] += v["hits"]
            imp[int(lid)] += v["importance"]

share = imp / imp.sum(1, keepdims=True)      # per-layer importance share
rel = share * E                              # 1.0 = uniform (1/512)
top = np.argsort(share, axis=1)[:, ::-1]     # per-layer ranking

Because every row is domain-tagged, per-domain maps (sum only rows of one domain) and domain-balanced rankings (normalize each domain's importance to per-token, then average domains equally) are one filter away.

What it shows

  • Routed importance is strongly non-uniform. Gini of per-expert importance averages 0.55 across layers; the top 32 experts of a layer carry 25 to 53 percent of that layer's routed output magnitude.
  • Concentration rises with depth. Layers 0 to 33 sit near gini 0.50; layers 37 and 44 to 47 reach 0.65 to 0.73, with the single top expert of layer 47 carrying 12 percent of the layer.
  • Routing frequency and importance agree at Spearman 0.96 on average, but a small set of experts carry several times their hit share in output magnitude (for example layer 47 expert 143: 12 percent of importance on 1.2 percent of routings). Frequency-only profiles cannot see these.
  • Long-form prose rows carry a large share of total tokens, so the token-weighted global ranking leans toward the experts those rows use. Code, math, and tool-use domains rank a substantially different set. Use the per-domain rows to weight for your own serving mix.

Caveats

  • Importance is a token-weighted sum. Prompts with more tokens contribute more. Reweight by domain if your target mix differs from the corpus.
  • Values are for the bf16 checkpoint. Quantized checkpoints of the same model route nearly identically but are not what was measured here.
  • The fused shared expert is excluded by design; it is routed on every token and carries no ranking information.

License

The statistics derive from Qwen3.8-Flash-Next and are published under the same Qwen Community License 1.0 terms as the model. The capture tooling lives in the tcclaviger/vllm fork under Apache-2.0.

Downloads last month
80