{ "model": "gemma3_1b_it_q4gsw", "upstream": { "model": "google/gemma-3-1b-it", "revision": "dcc83ea841ab6100d6b47a070329e1ba4cf78752", "official": true, "license": "Gemma Terms of Use + Gemma Prohibited Use Policy (see legal/)", "files": { "model.safetensors": { "lfs": "3d4ef8d71c14db7e448a09ebe891cfb6bf32c57a9b44499ae0d1c098e48516b6", "sha256": "3d4ef8d71c14db7e448a09ebe891cfb6bf32c57a9b44499ae0d1c098e48516b6" }, "tokenizer.json": { "lfs": "4667f2089529e8e7657cfb6d1c19910ae71ff5f28aa7ab2ff2763330affad795", "sha256": "4667f2089529e8e7657cfb6d1c19910ae71ff5f28aa7ab2ff2763330affad795" }, "tokenizer.model": { "lfs": "1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c", "sha256": "1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c" }, "config.json": { "blob": "06ab0678bc32d4f1474f31b35914512b1f9edaf7", "git_blob_sha1": "06ab0678bc32d4f1474f31b35914512b1f9edaf7" }, "generation_config.json": { "blob": "37a4c871d263a349f50e4a313db3e72164950702", "git_blob_sha1": "37a4c871d263a349f50e4a313db3e72164950702" }, "tokenizer_config.json": { "blob": "7bdd14f0eaec30c8d2c56bc9d543587676e19c0f", "git_blob_sha1": "7bdd14f0eaec30c8d2c56bc9d543587676e19c0f" }, "special_tokens_map.json": { "blob": "1a6193244714d3d78be48666cb02cdbfac62ad86", "git_blob_sha1": "1a6193244714d3d78be48666cb02cdbfac62ad86" }, "added_tokens.json": { "blob": "e17bde03d42feda32d1abfca6d3b598b9a020df7", "git_blob_sha1": "e17bde03d42feda32d1abfca6d3b598b9a020df7" }, "README.md": { "blob": "fb18818cebf048987fca3dd2978bc92621695c75", "git_blob_sha1": "fb18818cebf048987fca3dd2978bc92621695c75" } }, "hub_revision_checked": "dcc83ea841ab6100d6b47a070329e1ba4cf78752", "downloaded_from": { "repo": "google/gemma-3-1b-it", "revision": "dcc83ea841ab6100d6b47a070329e1ba4cf78752", "note": "official repo; every file verified against the hashes above" }, "checkpoint_parameters": 999885952 }, "versions": { "python": "3.12.15+meta", "torch": "2.14.1+cpu", "torchao": "0.18.0+cpu", "executorch": "1.5.1+cpu", "executorch_git": "3b60683923245cf472b7323426920e15623ba361", "transformers": "5.19.0", "huggingface_hub": "2.2.0" }, "export": { "api": "recipes/_gemma3.py Gemma3Text -> export_llm's quantization transforms -> LLMEdgeManager.export() -> run_canonical_optimizations() -> export_to_edge() -> to_backend([WebGPUPartitioner]) -> to_executorch()", "why_not_export_llm": "executorch 1.5.1 export_llm has no Gemma 3 model class; its llama_transformer lacks post-attention/post-FFN norms, embedding scaling, GELU MLP, per-layer RoPE base and sliding-window layers", "partitioner": "executorch.backends.webgpu.partitioner.WebGPUPartitioner(compile_options={'require_dynamic_shapes': True, 'force_fp16': False}) (the options export_llm passes to VulkanPartitioner; delegate id VulkanBackend)", "config": { "architectures": [ "Gemma3ForCausalLM" ], "attention_bias": false, "attention_dropout": 0.0, "attn_logit_softcapping": null, "bos_token_id": 2, "cache_implementation": "hybrid", "eos_token_id": [ 1, 106 ], "final_logit_softcapping": null, "head_dim": 256, "hidden_activation": "gelu_pytorch_tanh", "hidden_size": 1152, "initializer_range": 0.02, "intermediate_size": 6912, "max_position_embeddings": 32768, "model_type": "gemma3_text", "num_attention_heads": 4, "num_hidden_layers": 26, "num_key_value_heads": 1, "pad_token_id": 0, "query_pre_attn_scalar": 256, "rms_norm_eps": 1e-06, "rope_local_base_freq": 10000, "rope_scaling": null, "rope_theta": 1000000, "sliding_window": 512, "sliding_window_pattern": 6, "torch_dtype": "bfloat16", "transformers_version": "4.50.0.dev0", "use_cache": true, "vocab_size": 262144 }, "layer_types": [ "sliding_attention", "sliding_attention", "sliding_attention", "sliding_attention", "sliding_attention", "full_attention", "sliding_attention", "sliding_attention", "sliding_attention", "sliding_attention", "sliding_attention", "full_attention", "sliding_attention", "sliding_attention", "sliding_attention", "sliding_attention", "sliding_attention", "full_attention", "sliding_attention", "sliding_attention", "sliding_attention", "sliding_attention", "sliding_attention", "full_attention", "sliding_attention", "sliding_attention" ], "attention": { "global_layers": "llama.sdpa_with_kv_cache, causal over [0, pos + S), cache [1, max_context, 1, 256]", "sliding_layers": "exact window 512: cache [1, max_context + 1022, 1, 256] (position x at row x + 1022) written by llama.sdpa_with_kv_cache(k, k, v, cache, pos + 1022) with the output unused; attention over the 1023 rows ending at the chunk's last token with bmm + additive mask + softmax + bmm", "scale": "query_pre_attn_scalar ** -0.5 = 1/16", "softcapping": "none (config: attn_logit_softcapping = final_logit_softcapping = null)" }, "lowering_fix": { "what": "_gemma3.live_kv_cache_reads(): after the Vulkan backend's insert_prepack_nodes, the et_vk.prepack copies of the sliding-window KV caches are removed so their slice_copy readers bind the same GPU buffer sdpa_with_kv_cache writes (without it the window reads a load-time copy of the zero-initialized cache)", "rewired_buffers": [ "layers.0.k_cache", "layers.0.v_cache", "layers.1.k_cache", "layers.1.v_cache", "layers.10.k_cache", "layers.10.v_cache", "layers.12.k_cache", "layers.12.v_cache", "layers.13.k_cache", "layers.13.v_cache", "layers.14.k_cache", "layers.14.v_cache", "layers.15.k_cache", "layers.15.v_cache", "layers.16.k_cache", "layers.16.v_cache", "layers.18.k_cache", "layers.18.v_cache", "layers.19.k_cache", "layers.19.v_cache", "layers.2.k_cache", "layers.2.v_cache", "layers.20.k_cache", "layers.20.v_cache", "layers.21.k_cache", "layers.21.v_cache", "layers.22.k_cache", "layers.22.v_cache", "layers.24.k_cache", "layers.24.v_cache", "layers.25.k_cache", "layers.25.v_cache", "layers.3.k_cache", "layers.3.v_cache", "layers.4.k_cache", "layers.4.v_cache", "layers.6.k_cache", "layers.6.v_cache", "layers.7.k_cache", "layers.7.v_cache", "layers.8.k_cache", "layers.8.v_cache", "layers.9.k_cache", "layers.9.v_cache" ] }, "embedding": "token embedding * float32(sqrt(1152)); output head tied to the embedding (quantized identically, stored once)", "rope": "per layer type, tables from transformers' Gemma3RotaryEmbedding: global base 1e6, sliding base 1e4, no scaling", "norm": "RMSNorm with weight (1 + w) precomputed in fp32 (transformers computes the same sum at runtime)", "mlp": "down(gelu_tanh(gate(x)) * up(x))", "inputs": [ { "name": "tokens", "shape": [ 1, "1..512" ], "dtype": "int64" }, { "name": "input_pos", "shape": [ 1 ], "dtype": "int64" } ], "outputs": [ { "name": "logits", "shape": [ 1, 262144 ], "dtype": "float32", "note": "last position only" } ], "prefill_max": 512, "max_seq_len_metadata": 513, "max_context_length": 8960, "dtype": "float32 activations", "quantization": "export_llm transforms: embedding '4,64' then qmode=4w group 64 (torchao IntxWeightOnlyConfig int4, HQQ scale-only), on the checkpoint's bf16 weights, then cast to fp32; output head quantized too", "kv_cache": "fp32 buffers in the program" }, "files": { "gemma3_1b_it_q4gsw.pte": { "bytes": 640305924, "sha256": "6056492708430182103f2b28cac2cc5d4d43a66a95236f070de3312542f11c25" }, "tokenizer/tokenizer.json": { "sha256": "4667f2089529e8e7657cfb6d1c19910ae71ff5f28aa7ab2ff2763330affad795" }, "tokenizer/tokenizer_config.json": { "sha256": "bfe25c2735e395407beb78456ea9a6984a1f00d8c16fa04a8b75f2a614cf53e1" }, "tokenizer/special_tokens_map.json": { "sha256": "2f7b0adf4fb469770bb1490e3e35df87b1dc578246c5e7e6fc76ecf33213a397" }, "tokenizer/config.json": { "sha256": "19cb5d28c97778271ba2b3c3df47bf76bdd6706724777a2318b3522230afe91e" }, "tokenizer/generation_config.json": { "sha256": "fd9324becc53c4be610db39e13a613006f09fd6ef71a95fb6320dc33157490a3" } }, "graph": { "non_delegated_kernels": {}, "delegates": [ { "id": "VulkanBackend", "ops": { "et_vk.prepack.default": 29, "sym_size.int": 1, "et_vk.select_as_symint.default": 1, "add": 3, "et_vk.embedding_q4gsw.default": 1, "aten.mul.Tensor": 49, "sub": 2, "aten.slice_copy.Tensor": 46, "aten.add.Tensor": 75, "aten.view_copy.default": 275, "et_vk.rms_norm.default": 157, "et_vk.linear_q4gsw.default": 183, "et_vk.apply_rotary_emb_hf.default": 26, "sdpa_with_kv_cache.default": 26, "mul": 1, "aten.squeeze_copy.dims": 44, "aten.permute_copy.default": 22, "aten.bmm.default": 44, "aten.clone.default": 1, "aten._softmax.default": 22, "aten.gelu.default": 26, "aten.select_copy.int": 1 }, "inputs": 2, "outputs": 1 } ] }, "command": "python recipes/gemma-3-1b-it.py --out out/gemma-3-1b-it" }