# Gemma 4 tiny fixture configuration decision ## Status The text-only reduced configuration is generated under `artifacts/gemma4-v0/gemma4-random-model` as a BF16 Hugging Face package and a mixed K-quant GGUF requested through llama.cpp's `Q4_K` alias. The current Hugging Face implementation is Transformers 5.15.0 `Gemma4ForCausalLM` with `Gemma4TextConfig`. Its constructed trainable parameter count is 6,036,608. The local source file identifies itself as `general.architecture = gemma4`. Repository and revision provenance are not inferable from the local directory and remain intentionally unset. ## Source observations The 12B GGUF v3 header uses alignment 32 and contains 667 tensors. Its core geometry is: - 48 layers arranged as eight repetitions of five sliding-window layers followed by one global layer. - Hidden width 3840 and FFN width 15360. - 16 query heads. - Local layers: 8 KV heads and head width 256. - Global layers: 1 KV head and head width 512. - Global layers omit a separate `attn_v.weight`; this is part of the schema and must not be filled in by a generic Llama tensor template. - Sliding window 1024, context 262144. - Global/local RoPE bases 1000000/10000. - Global/local RoPE dimensions 512/256. - Final logit softcap 30 and RMS epsilon 1e-6. - Tied token/output embedding; the official tensor inventory has no independent `output.weight`. The separate projector file identifies itself as `general.architecture = clip` and `general.type = mmproj`. It is not included in the first text-only fixture. ## Tiny geometry The selected geometry is defined in `configs/gemma4-random-q4k-v1.json`: - 6 layers: one complete five-local/one-global schedule. - Hidden width 256 and FFN width 1024. - 4 query heads. - Local layers: 2 KV heads, head width 64. - Global layer: 1 KV head, head width 128, no independent V projection. - Context 128 and sliding window 64. - Vocabulary 128 with PAD/EOS/BOS/UNK/MASK IDs 0/1/2/3/4. This is a constrained scale-down rather than independently selected fields. It preserves the official layer schedule, the 2:1 global/local head-width ratio, the 2:1 query/local-KV head ratio, the single global KV head, FFN ratio 4, separate RoPE regimes, softcap, tied embeddings, and global shared-KV tensor inventory. All matrix quantization axes are multiples of 256. This allows actual Q4_K/Q6_K tensors rather than Q4_0 or K-quant fallback caused by undersized dimensions. ## Expected GGUF tensor dimensions GGUF dimensions are listed in reader order. | Role | Local layers 0-4 | Global layer 5 | |---|---:|---:| | `attn_q.weight` | `[256, 256]` | `[256, 512]` | | `attn_k.weight` | `[256, 128]` | `[256, 128]` | | `attn_v.weight` | `[256, 128]` | absent | | `attn_output.weight` | `[256, 256]` | `[512, 256]` | | `attn_q_norm.weight` | `[64]` | `[128]` | | `attn_k_norm.weight` | `[64]` | `[128]` | Every layer also has FFN gate/up `[256, 1024]`, FFN down `[1024, 256]`, hidden-width norms, and one scalar layer-output scale. ## Generation gates Fixture generation is accepted only when: - the direct writer emits `general.architecture = gemma4` and the exact tensor role schedule above; - a second generation is byte-identical; - the F32 GGUF loads in the pinned llama.cpp revision; - direct-token prefill and cached decode are finite and reproducible; - the mixed Q4_K/Q6_K conversion retains the same geometry and loads successfully; - F32 outputs are compared with an independently generated matched reference.