Gemma-4-E2B-IT 8da4w+emb4
This is an 8da4w+emb4-quantized (8-bit dynamic per-token activations + 4-bit per-channel grouped linear weights + packed 4-bit embedding weights) version of google/gemma-4-E2B-it, optimized for edge deployment on ARM devices using ExecuTorch with the XNNPACK + KleidiAI backend.
The model was quantized by ExecuTorch’s Gemma 4 export script with custom fused SDPA and a static KV cache, then 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+emb4 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 packed INT4 weights.
- 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-it
- Paper: Gemma 4 Technical Report
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 instruction-tuned 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 grouped quantization with group size 128
- Token embedding: packed 4-bit weight quantization
- Backend: XNNPACK with KleidiAI INT4 micro-kernels
- Higher-precision operations: Custom fused SDPA keeps attention internals in floating point. Linear layers with shapes incompatible with grouped INT4 quantization, if any, are retained at their original precision.
- Calibration: None. Dynamic activation quantization does not use a calibration dataset or observer-calibration pass.
Export Pipeline
- Load the pretrained Gemma 4 E2B-IT weights from Hugging Face safetensors and convert them into ExecuTorch’s custom Gemma 4 text-decoder architecture.
- Configure a static KV cache with a maximum sequence length of 1,024 tokens and enable dynamically sized input sequences.
- Replace standard attention with the fused
llama::custom_sdpatiled-attention operator. - Apply TorchAO 8da4w post-training quantization:
- dynamic INT8 activations
- grouped INT4 linear weights
- group size 128
- incompatible layers retained at higher precision
- Quantize embedding tables to packed INT4 weights. No calibration dataset or observer-calibration pass is used.
- Capture the quantized decoder with
torch.exportand decompose it into an ExecuTorch-compatible graph. - Lower supported quantized and floating-point operations to the XNNPACK delegate and apply static memory planning.
- Serialize the graph and weights as an ExecuTorch
.pteartifact compatible with the generic LLM runner.
Known Limitations
- This is a text-only export. The original Gemma 4 E2B-IT model’s image and audio encoders are not included.
- 8da4w+emb4 post-training quantization can reduce accuracy relative to the original model. Linear and embedding weights are INT4, and dynamic activations are INT8.
- Initial inference may incur one-time weight preparation or repacking overhead. Subsequent inference can be faster while the model remains loaded.
About this version
Original Model: Gemma-4-E2B-IT by Google DeepMind - Repository
Optimization/conversion: 8da4w+emb4 post-training quantization and ExecuTorch .pte export with XNNPACK + KleidiAI backend support for execution on Arm-based platforms.
Converted/optimized by: Arm
License: The Original Model and the Optimized Model are subject to Apache-2.0.
This repository contains a converted or optimized version of the Original Model (the “Optimized Model”). The Original Model has been converted or optimized as described above for execution on Arm-based platforms.
No retraining or fine-tuning of the Original Model was performed as part of the conversion or optimization. The conversion or optimization was not intended to change the Original Model’s behavior or intended use.
Original Model and Documentation
For information about the Original Model, including its development, training data, intended uses, limitations and other relevant information, please refer to the Original Model repository. Information in that repository was provided by the original developer or other third parties and, unless expressly stated otherwise, has not been independently verified by Arm.
Licenses and Third-Party Terms
Use of the Original Model and the Optimized Model is subject to the applicable licenses, usage restrictions and other terms identified above and in the relevant repositories. Publication of the Optimized Model does not grant any rights beyond those provided under the applicable license terms.
You are responsible for reviewing those terms and ensuring that your use of the Original Model and the Optimized Model is permitted.
Purpose of this Release
The Optimized Model is provided as a reference implementation to demonstrate and evaluate execution and performance on Arm-based systems. It is not a production-ready or supported solution.
Arm’s publication of the Optimized Model does not constitute an endorsement or certification of the Original Model or a representation that the Optimized Model is suitable for production use or any particular purpose.
To the fullest extent permitted by applicable law (i) the Optimized Model is provided “as is.” Arm makes no representations or warranties that the Original Model, the Optimized Model or their outputs are accurate, safe, secure, non-infringing, legally compliant, suitable for production use or fit for any particular purpose; and (ii) Arm will not be liable for any loss or damage arising from or in connection with the Optimized Model, its use or its outputs.
You are responsible for independently evaluating the Optimized Model, its outputs and its suitability for your intended use, including compliance with applicable legal, regulatory, safety and security requirements.
Arm does not commit to provide ongoing support, maintenance or updates for the Optimized Model. Any use of or reliance on the Optimized Model or its outputs is at your own risk.
- Downloads last month
- 1