Gemma 3 1B Instruct for ExecuTorch WebGPU

This repository contains an ExecuTorch conversion of google/gemma-3-1b-it for the ExecuTorch WebGPU backend, so the model runs entirely in a web browser on the visitor's GPU. It powers the corresponding demo in the ExecuTorch WebGPU Playground (launching soon on executorch.ai).

  • Base model: google/gemma-3-1b-it
  • Format: ExecuTorch .pte programs delegated to the WebGPU backend
  • Quantization: 4-bit groupwise weights (q4gsw, group size 64) for all linear layers and the tied token-embedding/output head; fp32 activations and KV cache
  • Total size: 643.6 MB

About the original model

The 1B instruction-tuned, text-only model of the Gemma 3 family.

  • Developed by: Google DeepMind
  • Paper: Gemma 3 Technical Report
  • 1.0B parameters (302M embedding + 698M non-embedding)
  • Trained on 2T tokens of web documents in over 140 languages, code and mathematics
  • Context length 32K tokens
  • 262K-token vocabulary

For training data, evaluation results and full details, see the original model card: google/gemma-3-1b-it.

Intended use and limitations

Text generation, chat and conversational assistants, summarization, and research and education. Use must comply with the Gemma Terms of Use and the Gemma Prohibited Use Policy.

Quality depends on the training data, which can carry biases and gaps. It does better on clearly framed tasks than open-ended or very complex ones, can miss nuance, sarcasm or figurative language, and is not a knowledge base: it can state incorrect or outdated facts. See the Ethical Considerations and Risks section of the upstream card.

What changed in this conversion

  • Exported with a Gemma 3 decoder written for ExecuTorch; the sliding-window and global attention layers are exact
  • All linear layers and the tied embedding/output head quantized to 4-bit groupwise weights (group 64); the embedding/head data is stored once
  • Context capped at 8,960 tokens (upstream: 32K); at most 512 tokens per call
  • Quantization changes outputs: answers are fluent but can be worded differently from the original model

Inputs and outputs

  • forward(tokens int64 [1, 1..512], input_pos int64 [1]) -> logits float32 [1, 262144] (last position only)
  • The KV cache lives inside the program; call it with up to 512 new tokens at a time, then one token per step
  • Tokenize with the files in tokenizer/ (the official Gemma tokenizer and chat template); stop on token 1 (<eos>) or 106 (<end_of_turn>)

Files

File Size SHA-256
gemma3_1b_it_q4gsw.pte 610.6 MB 6056492708430182…
tokenizer/config.json 899 B 19cb5d28c9777827…
tokenizer/generation_config.json 215 B fd9324becc53c4be…
tokenizer/special_tokens_map.json 662 B 2f7b0adf4fb46977…
tokenizer/tokenizer.json 31.8 MB 4667f2089529e8e7…
tokenizer/tokenizer_config.json 1.1 MB bfe25c2735e39540…

Full checksums are in manifest.json. The playground verifies them after download.

Running it

These programs were exported with the ExecuTorch WebGPU backend (backends/webgpu) and run in a browser (headless Chromium, WebGPU on SwiftShader) with the WebAssembly runtime build used by the ExecuTorch WebGPU Playground (launching soon on executorch.ai), where its prefill logits and greedy output matched the CPU reference token for token. That runtime build is published in executorch-community/ExecuTorch-WebGPU-Runtime; the playground is the easiest way to run them. It downloads these files once, caches them in the browser, and runs everything locally.

Requirements: a browser with WebGPU enabled.

Provenance

  • Upstream: google/gemma-3-1b-it at revision dcc83ea841ab6100d6b47a070329e1ba4cf78752 (official)
  • Exported with: executorch 1.5.1+cpu, torch 2.14.1+cpu, torchao 0.18.0+cpu, transformers 5.19.0 (executorch git 3b6068392324)
  • Reproduce: python recipes/gemma-3-1b-it.py --out out/gemma-3-1b-it (recipe in export/)
  • Re-running the recipe produces byte-identical files.

Citation

If you use this model, please cite the original work:

@article{gemma_2025,
  title={Gemma 3},
  url={https://goo.gle/Gemma3Report},
  publisher={Kaggle},
  author={Gemma Team},
  year={2025}
}

License

This is a derivative of the upstream model and is distributed under the same terms (gemma); see LICENSE and PROHIBITED_USE_POLICY.md. Modifications (conversion to the ExecuTorch format and quantization) by Meta Platforms, Inc.

Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms. By using this model you agree to the Gemma Terms of Use, including the use restrictions in its Section 3.2 and the Gemma Prohibited Use Policy.

Downloads last month
5
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for executorch-community/Gemma-3-1B-IT-ExecuTorch-WebGPU

Quantized
(483)
this model

Collection including executorch-community/Gemma-3-1B-IT-ExecuTorch-WebGPU

Paper for executorch-community/Gemma-3-1B-IT-ExecuTorch-WebGPU