Repository navigation
gemma4: admit the E4B geometry in the family config; each backend refuses it until it computes it - #1400
Closed
Mirrdhyn wants to merge 1 commit into
Closed
gemma4: admit the E4B geometry in the family config; each backend refuses it until it computes it#1400Mirrdhyn wants to merge 1 commit into
Mirrdhyn wants to merge 1 commit into
Conversation
…uses per-layer inputs and shared caches (ashhart#1222)
This was referenced Oct 26, 2026
Owner
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 this changes
Part of #1222, first of three stacked PRs for the E-series family parts (A config, B tensor plan, C host per-layer inputs; the converter is separate).
config.zigreads and checks the E4B geometry:hidden_size_per_layer_input,vocab_size_per_layer_input,num_kv_shared_layers,attention_k_eq_v: false,sliding_window. New constante4b, andcacheOwner(): the layer whose cache a shared layer reads (the last sliding or global owner before the shared run, 22 and 23 on E4B).Config.requireDense(), called by Metal (model.zig) and CUDA (cuda_weights.zig), before a weight is read or the device touched. A backend lifts it when it lands the E-series with its receipts.cuda_config.zigstays the twin ofconfig.zig(the existing test checks they differ only in their first lines).fixtures/config_e4b.json(text config of the public E4B checkpoint).Error names change for malformed configs: a 31B or 12B config carrying a per-layer input, shared layers or separate values used to fail with
GemmaPerLayerInputsNotServed/GemmaSharedKvNotServed/GemmaKeysNotValues; it now fails withUnsupportedGemmaGeometry(orBadGemmaConfigwhen the values contradict each other). A real E4B checkpoint still fails withGemmaPerLayerInputsNotServed, now from the backend.Receipt
google/gemma-4-12B-it707f0a3b, drafter-assistant46d4c6f1, greedy,--parallel 4):token_shaidentical before and after on 6 prompts (short to 25,287 tokens), drafted equal to"draft": falseon all 6;bench_concurrent.py --alone --serialat 1, 2 and 4 streams, code and chat: 0 unequal, 0 failed, before and after. Resumed equals fresh (--prompt-cache-gib 8): a chat's second turn over a 12,152-token prompt, asked cold (0 cached), then resumed (12,145 cached) twice, with"draft": false, and 4 at once: one token digest across all, before and after.bench_openai.py, median tok/s, before / after): code 30.6 / 31.9, chat 66.6 / 67.8; 4 streams aggregate: code 116.3 / 116.2, chat 236.3 / 234.5.SUMMARY 340 kernels: 340 pass gates 1-4, 0 fail, 5 known findings; 94 controls: 94 red as planted, 0 missed; 150 limit problems(exit 1 from the 150 limit problems, identical on main).test,test-kernel-contract,test-golden,fuzz-cortheon,test-cuda-host,test-gemma4-config, the seventest-gemma4-*-hoststeps,check-native-cuda-host,compile-config-server,test-checkpoint-config: all exit 0 before and after;tf-cuda-testcases of the final gate pluswindow,window-rows,window-bench gemma: all exit 0.zig fmt --check0;lean_check.py433 problems before and after.zig build test0;zig build test test-golden0, "0 unexpected differences";test-gemma4-config0 (59/59 with the stack).requireDense()call before the device opens, covered by the config tests.tf-cuda-test gemma4-states(needs the 31B and its drafter). The full CUDA gate ran on c0c7bd2; after rebasing on eea9dc9 (no Gemma 4 file touched upstream) the host suites above were rerun, all 0.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.SUMMARYline is above.