nina-arm commited on
Commit
7affdf3
·
verified ·
1 Parent(s): 975fab4

Sync model repo (text/metadata)

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +95 -0
  3. tokenizer.json +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: executorch
3
+ display_name: Gemma-4-E2B 8da4w — ExecuTorch
4
+ license: apache-2.0
5
+ tags:
6
+ - text-generation
7
+ - 8da4w
8
+ - quantized
9
+ - xnnpack
10
+ - kleidiai
11
+ - arm
12
+ - executorch
13
+ - edge-ai
14
+ pipeline_tag: text-generation
15
+ base_model: google/gemma-4-E2B
16
+ base_model_relation: quantized
17
+ ---
18
+
19
+ # Gemma-4-E2B 8da4w (ExecuTorch + XNNPACK)
20
+ 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.
21
+ 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).
22
+
23
+ ## Key Highlights
24
+
25
+ Compared to the FP32 baseline:
26
+
27
+ - **2.6× smaller** — 10246.6 MB → 3000 MB on disk
28
+
29
+ ## Model Details
30
+
31
+ ### Model Description
32
+
33
+ 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.
34
+ Linear weights use groupwise INT4 quantization, activations are dynamically quantized to INT8, and embeddings use INT8.
35
+
36
+ - **Developed by:** Google DeepMind (base model); Arm Model Optimization pipeline (quantization and export)
37
+ - **Model type:** Text generation (autoregressive language model)
38
+ - **License:** Apache 2.0
39
+ - **Base model:** google/gemma-4-E2B-it (https://huggingface.co/google/gemma-4-E2B-it) — quantized and exported, not fine-tuned
40
+
41
+ ### Model Sources
42
+
43
+ - **Repository:** https://huggingface.co/google/gemma-4-E2B
44
+ - **Paper:** [Gemma 4 Technical Report](https://arxiv.org/abs/2607.02770)
45
+
46
+ ## How to Get Started with the Model
47
+
48
+ ## Evaluation
49
+
50
+ ### Testing Data, Factors & Metrics
51
+
52
+ #### Testing Data
53
+
54
+
55
+ #### Metrics
56
+
57
+
58
+ ### Results
59
+
60
+ ## Technical Specifications
61
+
62
+ ### Objective
63
+
64
+ 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.
65
+
66
+ ### Quantization
67
+
68
+ - **Activations**: 8-bit dynamic, per-token quantization
69
+ - **Linear weights**: 4-bit, per-channel grouped quantization with group size 32
70
+ - **Token embedding**: 8-bit, per-channel weight quantization
71
+ - **Backend**: XNNPACK with KleidiAI INT4 micro-kernels
72
+ - **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.
73
+ - **Calibration**: 200 prompts randomly sampled from the MMLU test split
74
+
75
+ ### Export Pipeline
76
+
77
+ 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.
78
+ 2. Configure a static KV cache with a maximum sequence length of 1,024 tokens and enable dynamically sized input sequences.
79
+ 3. Replace standard attention with the fused llama::custom_sdpa tiled-attention operator.
80
+ 4. Apply TorchAO 8da4w post-training quantization:
81
+ - dynamic INT8 activations
82
+ - grouped INT4 linear weights
83
+ - group size 128
84
+ - incompatible layers retained at higher precision
85
+ 5. Quantize embedding tables to INT8. No calibration dataset or observer-calibration pass is used.
86
+ 6. Capture the quantized decoder with `torch.export` and decompose it into an ExecuTorch-compatible graph.
87
+ 7. Lower supported quantized and floating-point operations to the XNNPACK delegate and apply static memory planning.
88
+ 8. Serialize the graph and weights as an ExecuTorch `.pte` artifact compatible with the generic LLM runner.
89
+
90
+ ## Known Limitations
91
+
92
+ - This is a text-only export. The original Gemma 4 E2B model’s image and audio encoders are not included.
93
+ - 8da4w post-training quantization can reduce accuracy relative to the original model. Linear weights are INT4, dynamic activations are INT8, and embeddings are INT8.
94
+ - Initial inference may incur one-time weight preparation or repacking overhead. Subsequent inference can be faster while the model remains loaded.
95
+
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
3
+ size 32169626