Datasets:
format string | family string | display_name string | source string | seeded_utc timestamp[s] | decoder dict | kda_linear_attention dict | sparse_mla_attention dict | moe dict | hyper_connections dict | mtp dict | vision_tower dict | quant_r1 dict | serving_reference dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
spectrascope-profile/1 | glm5_next | GLM-5.3-Flash | HF checkpoint config.json (LibertAIDAI NVFP4, R1 mixed-precision requant) | 2026-08-28T00:00:00 | {
"num_layers": 45,
"hidden_size": 4096,
"vocab_size": 154880,
"max_position_embeddings": 1048576,
"layer_types": [
"linear_attention",
"linear_attention",
"linear_attention",
"deepseek_sparse_attention",
"linear_attention",
"linear_attention",
"linear_attention",
"deepseek_spa... | {
"layers": [
0,
1,
2,
4,
5,
6,
8,
9,
10,
12,
13,
14,
16,
17,
18,
20,
21,
22,
24,
25,
26,
28,
29,
30,
32,
33,
34,
36,
37,
38,
40,
41,
42,
44
],
"count": 34,
"num_heads": 64,
... | {
"layers": [
3,
7,
11,
15,
19,
23,
27,
31,
35,
39,
43
],
"count": 11,
"num_heads": 64,
"q_lora_rank": 1536,
"kv_lora_rank": 512,
"qk_head_dim": 256,
"qk_nope_head_dim": 256,
"qk_rope_head_dim": 0,
"v_head_dim": 256,
"nope": true,
"indexer": {
"n_h... | {
"sparse_layers": 42,
"dense_layers": 3,
"n_routed_experts": 288,
"n_shared_experts": 1,
"experts_per_tok": 8,
"moe_intermediate_size": 2048,
"dense_intermediate_size": 12288,
"scoring_func": "sigmoid",
"topk_method": "noaux_tc",
"routed_scaling_factor": 2.5,
"router_dtype": "float32",
"norm_to... | {
"enabled": true,
"mult": 4,
"sinkhorn_iters": 20,
"eps": 0.000001,
"note": "residual stream is hc_mult-way; per-layer mixing via sinkhorn-normalized weights"
} | {
"num_nextn_predict_layers": 1,
"draft_layer_index": 45,
"indexer_shared": true
} | {
"depth": 24,
"hidden_size": 1024,
"num_heads": 16,
"patch_size": 14,
"spatial_merge_size": 2,
"out_hidden_size": 4096,
"quant": "BF16 untouched (all quants)"
} | {
"method": "modelopt MIXED_PRECISION",
"routed_experts": "NVFP4 (untouched from base quant)",
"fp8_per_channel_per_token": "138 modules: shared-expert MLPs + dense-layer MLPs (incl. draft-namespace duplicates for layer 45)",
"bf16": "all attention (KDA + MLA), embeddings, lm_head, vision, MTP-connective",
"s... | {
"rig": "2x DGX Spark (GB10, sm_121) TP=2, vLLM PR#53906 build",
"context_served": 262144,
"decode_tok_s_mtp5": "~30-31 mean",
"footprint": "~110G / ~108G per node (graphs boot)"
} |
- ⚠️ Precision context — read before using any number
- Anatomy (from the checkpoint — facts, not guesses)
- Open questions this profile exists to answer
- Findings
- First live captures (2026-08-28, companion 0.1.0)
- Battery 1 — domain & regime separation (2026-08-28)
- Battery 2 — context ladder 4k–100k + unique-text controls (2026-08-28)
- Battery 3 — monitored memory rerun (2026-08-28)
- Battery 4 — to the serving ceiling (2026-08-28)
- Battery 5 — the sink hunt: first per-layer captures (2026-08-28)
- Battery 6 — first selection maps (2026-08-28)
- First live captures (2026-08-28, companion 0.1.0)
- Known limits & open items
- Provenance & citation
GLM-5.3-Flash Internals — a measured profile
A measured characterization of the internals of
zai-org/GLM-5.3-Flash
(glm5_next) at real serving scale: activation landscapes, attention-sink
anatomy, FP8 working margins to 260k context, sparse-indexer selection maps,
and the memory behavior of a two-node vLLM serve. Every finding cites its
capture and states its conditions. profile.json beside this card is the
machine-readable anatomy.
Produced with Claude Code and Spectra Scope, a model-anatomy inspector that hooks a serving model's modules and records what actually flows through them.
Companion dataset: glm53-flash-harvest — 117.4M on-policy tokens generated by the same model, for drafter/speculator training.
⚠️ Precision context — read before using any number
Every measurement here was taken on a mixed-precision quant, not the BF16 release. The checkpoint under test ("R1", 179.85 GiB, built with ModelOpt MIXED_PRECISION on top of the LibertAIDAI NVFP4 weight-only release):
- routed experts: NVFP4 (E2M1, FP8-E4M3 per-16 block scales)
- 138 modules FP8 per-channel-per-token: shared-expert MLPs and dense-layer MLPs (including the draft-namespace duplicates for the MTP layer)
- BF16: all attention (KDA + MLA + indexer), embeddings,
lm_head, the vision tower, MTP-connective tensors, all norms
Consequences for reading the findings: attention-side amplitudes are unquantized truth; MLP-side sites are read at the FP8/FP4 boundary, so QuantFP8-site figures are what the quant op actually ingests. A BF16 serve may behave differently, particularly on MLP-side amplitudes and anywhere quant boundaries clip or rescale; the structural findings (sink anatomy, family temperaments, selection behavior) are expected to transfer, but treat absolute magnitudes as quant-specific until reproduced on other precisions.
Serve rig for all captures: 2× NVIDIA DGX Spark (GB10, sm_121),
vLLM built from PR #53906,
TP=2 over a 200G rail, --enforce-eager (CUDA graphs and compile swallow
forward hooks; production serving uses graphs and is faster — eager is the
capture condition), text-only, MTP k=5 speculative decoding ON, max context
262,144, KV byte-capped, Marlin MoE backend.
Instrument: spectrascope-companion (0.1.0 → 0.2.2 across the batteries)
— torch global forward hooks, per-module input aggregates (amax / absmean /
element count) accumulated on-device while armed, drained per TP worker.
Limits at capture time are stated inline per battery.
Anatomy (from the checkpoint — facts, not guesses)
Decoder: 45 layers, hidden 4096, vocab 154,880, native context 1,048,576 (served here at 262,144). Two interleaved attention families:
- 34 KDA linear-attention layers (indices 0–2, then 3-of-4 up to 44): 64 heads × 128, short-conv kernel 4, learned decay gates (lower bound −5.0). Recurrent constant-size state per layer — no KV growth. These layers are why host memory stays flat and the long-context tax is small.
- 11 DeepSeek-sparse-attention (MLA) layers (3, 7, 11, … 43 — every
4th): 64 heads, q_lora 1536 / kv_lora 512, qk_head 256, v_head 256,
all-NoPE (
qk_rope_head_dim = 0— no rotary anywhere). Each carries a sparse indexer: 32 index heads × 128 select top-2048 tokens per query from a 4-deep compressed key pool, tail always selected, and the indexer is shared with the MTP iteration.
MoE: first 3 layers dense (intermediate 12,288), the other 42 sparse:
288 routed experts + 1 shared expert, 8 active per token, expert
intermediate 2048, sigmoid scoring with noaux_tc top-k, routed scaling
2.5, router computed in fp32.
mHC hyper-connections (mhc: true, mult 4): the residual stream is
4-way multiplexed with per-layer mixing weights normalized by 20
sinkhorn iterations. "The residual stream" is plural in this model — any
residual-based analysis must account for 4 streams and their mixing.
MTP: one in-checkpoint next-token-prediction layer (index 45) — a speculative drafter. The draft shares the sparse indexer.
Vision tower: 24-layer ViT (1024 hidden, patch 14, merge 2 → 4096 out), BF16 untouched by every quant. Text-only serves keep it unexercised.
Open questions this profile exists to answer
- Where does position live? With zero rotary, position information must ride the KDA recurrences and conv kernels.
- What does the sparse indexer actually select? Top-2048 of 262k is <1% — locality vs. semantic retrieval, tail behavior, per-head specialization, per-depth shifts.
- Expert routing shape at 288/8 with sigmoid-noaux: load balance, per-domain specialization, shared-expert load vs. routed.
- How do the 4 hyper-connection streams divide labor?
- Activation magnitude landscape per family: KDA in-projections vs MLA projections vs expert inputs vs MTP.
- MTP acceptance anatomy: where the drafter fails (acceptance ~3.9–4.1 of 5 at temp 0.7/greedy).
Findings
Append-only; each battery names its captures. Amplitudes are input amax unless stated. "TP0/TP1" are the two tensor-parallel workers.
First live captures (2026-08-28, companion 0.1.0)
Captures bridge-20260828-063027 (120-token prompt), wild-aurora
(400-token prompt). 102 modules captured across a ~180G two-node serve.
- Massive activations confirmed on this family: RMSNorm inputs peak at
amax ~6016 on both ranks — the same massive-activation channel class
documented on other model families, now on
glm5_next. - mHC is hook-visible:
mhc_post_opfires as a module boundary (amax ~900) — the hyper-connection lane is capturable without engine surgery. - Site magnitude hierarchy (51 named sites/rank): RMSNorm ~6016 ≫ mhc_post_op ~900 ≫ decoder-layer input ~466 ≫ shared_experts.down_proj 68.5/41.5 (sharded; ranks diverge) ≫ QuantFP8 op 46.5 ≫ MLA attention core 22.4 ≫ KDA gate_proj 13.9 ≫ router 7.1 ≫ dense mlp.down_proj 0.6. Norm-dominated: the classic massive-activation signature.
- Replicated vs sharded tensors identified by rank symmetry (matching amax = replicated; diverging = sharded) — measured, not inferred from code.
- Instrument limit at this stage: decoder names collapsed across layers (site-level truth only; fixed by battery 5).
Battery 1 — domain & regime separation (2026-08-28)
Captures recall-baseline, math-reasoning, code-gen, long-context
(~7k needle doc), prefill-only (same doc, 1 token out), decode-heavy.
- RMSNorm peak sits at ~6000 (5984–6016) in every run with real decode, constant across domains — a structural attractor, not input-driven. A 7,000-token prefill with 1 generated token peaked at just 69. [Superseded by battery 2, finding 1: the split is position-anchored, not decode-anchored — the low prefill peak was a prefix-cache artifact.]
- FP8 trunk working range: QuantFP8-site input amax grows with task/context: 30 (recall) → 50 (math) → 52 (code) → 68 (7k ctx). FP8-E4M3 saturates ~448 → ~6.6× headroom at 7k.
- Family temperament: KDA sites hold a tight band in every condition (g_b_proj 13.4±0.5) — constant-state temperament. MLA core input scales with context (10.8 → 21.3) — reach-driven.
- MTP always-on (hypothesis falsified honestly): all 23 MTP site entries fire even in prefill-only — the drafter engages from the first generated token, just cooler (eh_proj 2.31 vs ~3.15).
- Rank-symmetry catalog: 39 sites identical on both ranks in every condition (replicated: norms, routers, in-projs, indexer, mHC); 12 diverge (sharded: down_proj, o_proj, o_norm, act_fn, MLA core, QuantFP8) — a measured TP ownership map.
- Sparse retrieval works: a 7k needle answered correctly through the top-2048 indexer.
Battery 2 — context ladder 4k–100k + unique-text controls (2026-08-28)
Captures ladder-4k/16k/32k/64k/100k (needle at ~55% depth), controls
ctl-4k / ctl-32k (fully unique text, no shared prefix).
Ladder amax (TP0): RMSNorm 5984 / 5984 / 79 / 95 / 97.5; mhc_post_op 940 / 940 / 117 / 130 / 156; decoder-layer 440 / 440 / 19.5 / 18.1 / 17.8; QuantFP8 67.5 / 65.5 / 59.8 / 55.5 / 59.8; MLA core ~20.8 at every rung; KDA gates 11.8–13.9 flat. Unique-text ctl-32k restored RMSNorm 5984 / mhc 940 / layer-in 440 with 7.5× the element count.
- The massive activation is POSITION-anchored (correction to battery 1): the ~6000 attractor belongs to the early-sequence positions (BOS/sequence-start neighborhood). Any run computing the sequence start fresh shows it at any size or domain; any run whose opening positions come from prefix cache does not. Late-position forwards peak ~18–100. Classic attention-sink / massive-activation anatomy, measured at serving scale, constant at ~5984–6016 regardless of content.
- Prefix caching is live on this serve branch (contrary to early ecosystem notes). Protocol consequence: activation-capture prompts must be prefix-unique (or the cache flushed), or early-position physics silently drop out of the landscape.
- FP8 margin: safe through 100k. QuantFP8 amax never exceeded ~68 on the ladder (fresh controls 46–54.5); no climb toward the 448 ceiling.
- MLA amplitude saturates by design: the battery-1 rise flattens at ~20.8 for 16k–100k — the top-2048 selection cap bounds what attention ingests once context ≫ topk. The sparse design shows up in the physics.
- Retrieval: 5/5 needles correct 4k→100k plus a unique-doc control.
- KDA gates, router, indexer input: flat at all depths.
Battery 3 — monitored memory rerun (2026-08-28)
Captures ladder2-4k…100k, all prefix-unique; host and per-process RSS
sampled through the run with a settle window.
- No leak — a bounded one-time commit. Head-node memory 110.03G → peak 110.88G → settled 110.52G: a full ladder including a fresh 100k prefill added zero net retained memory. The earlier ~1.5G rise across batteries 1–2 was first-touch page commit of the pre-granted KV/prefix pool and eager workspaces — bounded by the KV grant, not open-ended.
- Attribution clean: capture engine RSS flat (0.58G), serve tree host RSS flat (4.14G head / 1.90G worker) throughout — the transient lived in the CUDA/unified-memory pool, not in any process heap.
- Fresh-100k control: RMSNorm 5984 / mhc 940 (attractor holds at depth, fully unique text); QuantFP8 58.5; MLA 18.5.
- Honest fresh-prefill timing (eager capture rig, end-to-end with ~200-token answers): 4k 9s / 16k 23s / 32k 35s / 64k 63s / 100k 96s — ~1.2–1.3k tok/s aggregate prefill. (Battery 2's faster big-rung timings were prefix-cache-flattered.)
- Retrieval: 5/5 unique-doc needles.
Battery 4 — to the serving ceiling (2026-08-28)
Captures ladder2-160k, ladder2-250k-b (= 260,408 tokens exact, counted
by the serve's own token counter), retention-260k-repeat, rim-test-0..3.
- Physics hold at the ceiling: attractor 5984 / mhc 940 at 160k and 260k fresh; QuantFP8 54.75–59.5 — final FP8 verdict: ≥8× margin at maximum servable context, the quantized trunk never approaches the E4M3 ceiling at any depth; MLA saturated ~19.4–19.6; KDA flat.
- Retrieval at the ceiling: correct. Cumulative 8/8 fresh-text needles 4k→260k through the top-2048 selector.
- Memory model validated both directions: 160k retained nothing; the first-ever 260k run retained +0.74G/+0.94G (head/worker) — sized like the KV footprint of the newly-touched depth. The falsifiable prediction (a repeat 260k retains ~zero) was then confirmed: −0.00G / −0.02G, and the repeat ran in 13s vs 207s (prefix cache served the identical document wholesale).
- Rim test — leak hypothesis rejected: four fresh unique documents (~160k new tokens) forced wholesale KV-block eviction through a fully cycled pool (cumulative unique tokens ~636k > pool capacity ~592k): head −0.45G, worker +0.13G, all needles correct through the churn. The observed "staircase" was the pre-granted KV pool committing physical pages on first touch until full — a rim, not a leak. Freed blocks return to the pool's free list; a living allocation's pages return only at serve restart. Standing signal: steady-state usage marching meaningfully past the rim would indicate a real leak.
- Timing: 160k end-to-end 153s; 260k 207s — ~1.3k tok/s aggregate eager prefill, remarkably flat across the whole ladder.
- Operational note: prompts over
max_model_lenare rejected (word-count estimates drifted ~13% low on this text; the serve's count endpoint is the honest sizing tool but errors above the limit itself).
Battery 5 — the sink hunt: first per-layer captures (2026-08-28)
Captures shakedown-020, sink-hunt (4k fresh), selection-map (32k
fresh); companion 0.2.0 with per-layer naming and worker ranks — 1,476
modules per capture (738 per TP worker).
- The massive activation localized: final-norm / stream-collapse
anatomy, not any decoder layer. Inside all 45 layers the hottest
submodule stays ≤ ~100. The chain that builds the ~6000: per-layer
residual (hyper-connection stream bundle) runs spiky up to ~456 (hot
layers #18 456, #22 448, #34 376, #43–44 378–440 — non-monotonic:
different layers read different-magnitude stream mixes) → the model's
only explicit
mhc_post_opsits at layer 44 and collapses the 4 streams (input 940) → the final model RMSNorm ingests 5984. Combined with battery 2: the sequence-start token's residual grows through depth and crystallizes at stream-collapse + final norm — textbook attention-sink anatomy, measured module-by-module at serving scale. - mHC architecture note (measured): stream expansion/mixing is implicit per layer; a single explicit post-op at layer 44 performs the collapse. The mHC figure earlier batteries tracked was layer 44's collapse point all along.
- Per-layer temperaments: KDA gate inputs grow gently with depth (5 → 15); shared-expert down_proj is the within-layer hot spot, spiking at layers 3 and 7 (exactly 100.0 — a suspiciously round ceiling, possibly activation-clamp-related; open question) and running 40–75 in late MoE layers.
- Instrument: the selection lane came up empty this boot — root-caused
live (on this vLLM branch the indexer's
topk_indices_bufferattr isNone; indices ride the module's integer return, which a float-only output tap skipped). Fixed in companion 0.2.1.
Battery 6 — first selection maps (2026-08-28)
Captures selection-map-c (32k), selection-deep-c (100k); companion
0.2.2 (three real serving-stack traps found and fixed against the living
serve: None buffer attr → integer-return fallback → −1-padding rows;
each fix regression-tested).
- First indexer selection maps at serving scale. 128-bucket position histograms of what the top-2048 selector actually read: at 32k, a structured non-uniform coverage profile across the whole document; at 100k, selection mass shifts strongly toward later regions with a bright final bucket and a distinct mid-document band near the needle's 55% position. The MTP indexer's map differs from the main layers' (sparser, tail-heavier) — the drafter reads the sequence differently than the verifier.
- Instrument discovery — the layers alias one buffer: all 11 DSA layers reported bit-identical maps; the indexer op writes a shared model-level indices tensor, so per-module references collapse to last-writer-wins. Per-layer selection differentiation needs clone-on-stash (bounded copy at forward time) — planned; until then each capture carries one authoritative main-path map (last writing layer, last chunk) plus the MTP map.
- Calibration notes: counts (~4.19M = 2048 queries × 2048 selections) show the stash holds the final prefill chunk's selection rather than the last decode step — decode-path stashing to be verified after the de-alias fix. Tail-share reads near zero at 32k despite the always-select-tail law — the compressed-pool tail may ride a separate mechanism; open question, not overclaimed.
Known limits & open items
- Per-layer selection maps blocked by the shared-buffer aliasing (fix planned); decode-path selection stashing unverified.
- Vision tower unexercised (text-only serves); multimodal behavior of the quant untested.
- Outputs, sequences, and attention probabilities not recorded by the instrument at these versions — input aggregates only.
- Expert-routing statistics (open question 3) and hyper-connection stream labor division (question 4) not yet captured.
- All timings are from the eager capture rig; production (CUDA-graphs) serving is materially faster.
Provenance & citation
Measurements taken 2026-08-28 with Spectra Scope and Claude Code against a vLLM PR-#53906 serve of the R1 mixed-precision requant described above. Base model: zai-org/GLM-5.3-Flash (MIT).
@misc{glm53flashinternals2026,
title = {GLM-5.3-Flash Internals: a measured profile},
author = {Zek-Takai},
year = {2026},
url = {https://huggingface.co/datasets/Zek-Takai/glm53-flash-internals}
}
- Downloads last month
- 3