Spaces:
Running
Correct Gemma 4 KV geometry in 28 audited profiles
Summary
Cross-checking KV geometry across quantizations of the same base architecture surfaced two systematic errors from early audit conventions. Later audits of the same architectures already used the corrected representation; this PR back-ports it to the profiles audited before the convention improved.
Gemma 4 31B: global attention head_dim undercharged 2x (12 profiles)
The full-attention KV component recorded head_dim: 256 (the sliding-window head dim). Ground truth says 512:
- config:
global_head_dim = 512,num_global_key_value_heads = 4 - safetensors: the full-attention layer's
k_projis[2048, 5376]= 4 heads x 512, with nov_proj(K=V path) - GGUF metadata:
gemma4.attention.key_length = 512for non-sliding layers (verified by range-reading headers on the unsloth and douyamv GGUFs)
Global KV allocation and read traffic were undercharged by half, which overstated session capacity and loosened the bounds in the optimistic direction. Affected: both Google base profiles, qat-w4a16-ct, the NVIDIA/RedHatAI/LilaRest NVFP4s, RedHatAI FP8s, cyankiwi/QuantTrio AWQs, unsloth GGUF, and the douyamv fine-tune GGUF.
Gemma 4 E4B/E2B: missing shared-KV allocation overrides (16 profiles)
These models share K/V across the final 18 (E4B) / 20 (E2B) decoder layers, so only the non-shared layers allocate cache (E4B: 4 of 7 full + 20 of 35 sliding; E2B: 3 of 7 + 12 of 28). Fifteen E4B profiles and one E2B profile charged allocation on all layers, overcharging per-session KV roughly 1.75x. The corrected profiles now match the convention already used by google--gemma-4-e2b-it, the QAT GGUF/w4a16-ct audits, and the rest of the family.
Mechanics
- Each corrected profile: version bump, dated correction note on the affected components, updated review entry.
- Golden test values for the affected repos regenerated from the corrected profiles (133 expectations updated).
- Everything else from the scrutiny pass checked out: MLA-family divergences (GLM-4.7-Flash, DeepSeek R1 NVFP4, Kimi) are deliberate per-serving-stack modeling, and max_context differences within families match each repo's own shipped config.
Test plan
npm run checkpasses (format, lint, typecheck, vitest, legacy engine tests, profile + model-data validation, build).- All 638 profiles validate, including the saturation check added in the previous PR.
refs/pr/3 ref