Sync model repo (text/metadata)
Browse filesFiles changed (3)
- .gitattributes+1
- README.mdAdded+95
- tokenizer.jsonAdded+3
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -texttokenizer.json filter=lfs diff=lfs merge=lfs -text
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495---library_name: executorchdisplay_name: Gemma-4-E2B 8da4w — ExecuTorchlicense: apache-2.0tags: - text-generation - 8da4w - quantized - xnnpack - kleidiai - arm - executorch - edge-aipipeline_tag: text-generationbase_model: google/gemma-4-E2Bbase_model_relation: quantized---
# Gemma-4-E2B 8da4w (ExecuTorch + XNNPACK)This is an **8da4w-quantized** (8-bit dynamic per-token activations + 4-bit per-channel grouped weights) version of [google/gemma-4-E2B](https://huggingface.co/google/gemma-4-E2B), optimized for edge deployment on ARM devices using [ExecuTorch](https://github.com/pytorch/executorch) with the **XNNPACK + KleidiAI** backend. The model was quantized by ExecuTorch’s Gemma 4 export script without SDPA, with a custom static KV-cache, and exported to the `.pte` format for efficient on-device inference on ARM Cortex-A processors (modern Android phones, AWS Graviton, embedded ARM).
## Key Highlights
Compared to the FP32 baseline:
- **2.6× smaller** — 10246.6 MB → 3000 MB on disk
## Model Details
### Model Description
Gemma 4 E2B-IT is an instruction-tuned multimodal generative model from Google DeepMind. This text-only artifact is the same model after 8da4w post-training quantization and ExecuTorch/XNNPACK export, no fine-tuning was performed.Linear weights use groupwise INT4 quantization, activations are dynamically quantized to INT8, and embeddings use INT8.
- **Developed by:** Google DeepMind (base model); Arm Model Optimization pipeline (quantization and export)- **Model type:** Text generation (autoregressive language model)- **License:** Apache 2.0- **Base model:** google/gemma-4-E2B-it (https://huggingface.co/google/gemma-4-E2B-it) — quantized and exported, not fine-tuned
### Model Sources
- **Repository:** https://huggingface.co/google/gemma-4-E2B- **Paper:** [Gemma 4 Technical Report](https://arxiv.org/abs/2607.02770)
## How to Get Started with the Model
## Evaluation
### Testing Data, Factors & Metrics
#### Testing Data
#### Metrics
### Results
## Technical Specifications
### Objective
Open-ended text generation and multiple-choice scoring with the Gemma 4 E2B architecture, deployed on ARM CPUs using INT4 linear weights and INT8 activations.
### Quantization
- **Activations**: 8-bit dynamic, per-token quantization- **Linear weights**: 4-bit, per-channel grouped quantization with group size 32- **Token embedding**: 8-bit, per-channel weight quantization- **Backend**: XNNPACK with KleidiAI INT4 micro-kernels- **Higher-precision layers**: None. Every linear layer and the token embedding are quantized. Attention internals remain in higher precision within the custom fused SDPA path.- **Calibration**: 200 prompts randomly sampled from the MMLU test split
### Export Pipeline
1. Load the pretrained Gemma 4 E2B-IT weights from Hugging Face safetensors and convert them into ExecuTorch’s custom Gemma 4 text-decoder architecture.2. Configure a static KV cache with a maximum sequence length of 1,024 tokens and enable dynamically sized input sequences.3. Replace standard attention with the fused llama::custom_sdpa tiled-attention operator.4. Apply TorchAO 8da4w post-training quantization: - dynamic INT8 activations - grouped INT4 linear weights - group size 128 - incompatible layers retained at higher precision5. Quantize embedding tables to INT8. No calibration dataset or observer-calibration pass is used.6. Capture the quantized decoder with `torch.export` and decompose it into an ExecuTorch-compatible graph.7. Lower supported quantized and floating-point operations to the XNNPACK delegate and apply static memory planning.8. Serialize the graph and weights as an ExecuTorch `.pte` artifact compatible with the generic LLM runner.
## Known Limitations
- This is a text-only export. The original Gemma 4 E2B model’s image and audio encoders are not included.- 8da4w post-training quantization can reduce accuracy relative to the original model. Linear weights are INT4, dynamic activations are INT8, and embeddings are INT8.- Initial inference may incur one-time weight preparation or repacking overhead. Subsequent inference can be faster while the model remains loaded.
123version https://git-lfs.github.com/spec/v1oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0fsize 32169626.gitattributes+1
README.mdAdded+95
tokenizer.jsonAdded+3