craftslab commited on
Commit
8f99de8
Β·
verified Β·
1 Parent(s): ea97458

docs(readme): add README file

Browse files
Files changed (1) hide show
  1. README.md +177 -0
README.md ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - zh
5
+ license: apache-2.0
6
+ library_name: aria-engine
7
+ tags:
8
+ - gemma-4
9
+ - quantized
10
+ - per-channel-quantization
11
+ - hadamard
12
+ - on-device
13
+ - edge
14
+ - mobile
15
+ - text-generation
16
+ - instruction-tuned
17
+ - embeddings
18
+ pipeline_tag: text-generation
19
+ datasets:
20
+ - togethercomputer/RedPajama-Data-1T
21
+ - EleutherAI/the_pile
22
+ - bigcode/the-stack
23
+ base_model: google/gemma-4-e2b-it
24
+ model-index:
25
+ - name: Gemma-4-E2B-IT (Aria Quant Bundle, q4)
26
+ results:
27
+ - task:
28
+ type: text-generation
29
+ name: Generation Consistency (vs FP16, method reference)
30
+ metrics:
31
+ - type: description
32
+ value: "awaiting gen_quant_eval audit"
33
+ ---
34
+
35
+ # Model Card for Gemma-4-E2B-IT (Aria Quant Bundle, q4)
36
+
37
+ ## Model Details
38
+
39
+ ### Model Description
40
+
41
+ Gemma-4-E2B-IT is a ~1.5-billion-parameter instruction-tuned multimodal language model developed by Google, part of the Gemma 4 family. Its text backbone features **hybrid attention** (27 of 35 layers sliding-window linear attention + 8 standard full-attention layers), **GeGLU activation**, **aggressive Grouped Query Attention (GQA, 1 KV head for 8 query heads)**, **per-layer input projections**, **double-wide MLP**, and **128K native context length**. Pre-trained on diverse web-scale corpora and aligned via instruction tuning + RLHF. This distribution is provided by **Aria Compute** as an **aria-quant-bundle** β€” a quantized package using **Hadamard pre-processing + uniform per-channel 4-bit quantization**. Optimized for **CPU-only, on-device inference** on mobile phones, edge devices, and single-board computers via the [Aria Engine](https://ariacompute.com) runtime. No GPU or cloud connection is required.
42
+
43
+ - **Developed by:** Google
44
+ - **Quantized and distributed by:** Aria Compute
45
+ - **Model type:** Dense Transformer decoder-only (multimodal base: image/audio + text inputs, text outputs; this bundle ships the text backbone)
46
+ - **Language(s):** English (primary), Chinese, and 30+ additional languages
47
+ - **License:** Apache 2.0
48
+ - **Finetuned from model:** [google/gemma-4-e2b-it](https://huggingface.co/google/gemma-4-e2b-it)
49
+
50
+ ### Model Sources
51
+
52
+ - **Original Repository:** [google-gemma/gemma-4](https://github.com/google-gemma/gemma-4)
53
+ - **Original Paper:** [Gemma 4 Technical Report](https://arxiv.org/abs/2601.00000)
54
+ - **Aria Compute Dashboard:** [ariacompute.com/dashboard/models](https://ariacompute.com/dashboard/models)
55
+ - **Aria Engine:** [ariacompute.com](https://ariacompute.com)
56
+
57
+ ## Uses
58
+
59
+ ### Direct Use
60
+
61
+ This quantized bundle is intended for **on-device, offline text-generation tasks** on resource-constrained hardware, including:
62
+
63
+ - On-device chat and conversational assistants
64
+ - Real-time text completion and basic code snippet generation
65
+ - Instruction-following tasks for mobile and IoT applications
66
+ - Lightweight text embeddings for on-device retrieval and classification
67
+ - Short-form summarization of notifications, messages, and local content
68
+ - Local document analysis up to 32K context (chunked)
69
+
70
+ All inference runs **locally on CPU**. No data is sent to external servers.
71
+
72
+ ### Target Devices
73
+
74
+ | Platform | Runtime Memory | Feasibility |
75
+ |-------------------------------|----------------|-------------|
76
+ | High-end smartphone (8 GB) | ~1.5 GB | βœ… Recommended |
77
+ | Mid-range smartphone (4–6 GB) | ~1.5 GB | βœ… |
78
+ | Budget phone (2–3 GB) | ~1.5 GB | βœ… |
79
+ | Raspberry Pi 5 / SBC (4–8 GB) | ~1.5 GB | βœ… |
80
+ | IoT gateway (1–2 GB) | ~1.5 GB | ⚠️ Tight fit |
81
+ | Wearable (1 GB) | ~1.5 GB | ❌ |
82
+
83
+ **Memory breakdown (q4, at 4K context):** ~1.0 GB quantized model weights (mmap) + ~40 MB KV cache + ~30 MB runtime overhead + ~30 MB per-channel metadata overhead β‰ˆ ~1.1 GB.
84
+
85
+ > Note: KV cache is extremely compact thanks to aggressive GQA (1 KV head for 8 query heads) and hybrid attention β€” 27 of 35 layers use sliding-window attention (window 512, KV bounded by the window), so only the 8 full-attention layers scale KV with context. Combined with tie-word-embeddings, this keeps 128K context practical on ~1.1 GB-class devices.
86
+
87
+ ### Out-of-Scope Use
88
+
89
+ - Long-form creative writing (>2K tokens per generation)
90
+ - Mathematical theorem proving or formal verification
91
+ - Full program/application synthesis
92
+ - Multimodal input (image/audio encoding pipeline is pending audit for this quantized bundle β€” text-only in this release)
93
+ - Real-time audio/speech processing (use Aria speech models)
94
+ - Safety-critical decision systems without human oversight
95
+ - Deployment in production when **batch inference** or **GPU acceleration** is required (this bundle targets CPU-only, single-prompt inference)
96
+ - Tasks requiring factual precision beyond the model's ~1.5B parameter capacity
97
+
98
+ ## How to Get Started with the Model
99
+
100
+ ### Download from Aria Compute
101
+
102
+ Authenticated dashboard users can download the bundle via: https://ariacompute.com/dashboard/models
103
+
104
+ ### Quantization Recipe
105
+
106
+ This bundle uses a **per-channel** quantization recipe, one of several precision options in the Aria Compute lineup:
107
+
108
+ | Component | Quantization Strategy | Details |
109
+ |-----------|----------------------|---------|
110
+ | Attention Q/K/V/O weights | 4-bit | Uniform per-channel codebooks, Hadamard pre-processing |
111
+ | FFN gate/up/down weights | 4-bit | Uniform per-channel codebooks, Hadamard pre-processing |
112
+ | RMSNorm weights | FP16 | Preserved at full precision |
113
+ | Embedding table | FP16 | Preserved at full precision (tie_word_embeddings: true) |
114
+
115
+ - **Bundle size:** ~1.0 GB (BF16 text backbone: ~3.1 GB)
116
+ - **Generation quality:** Awaiting gen_quant_eval audit. The uniform 4-bit per-channel recipe is the smallest bundle in the Aria lineup β€” best for tight-memory devices at the cost of some quality. Per-channel codebooks preserve per-output-channel distribution characteristics. Formal quality benchmarks against FP16 and other Aria quant recipes are pending
117
+ - **Calibration-free:** Hadamard pre-processing + per-channel quantization, no task-specific calibration data required
118
+ - **Other precision options:** Also available for Gemma-4-E2B-IT: `gemma-4-e2b-it_q8_channel` (per-channel 8-bit, near-lossless) and `gemma-4-e2b-it_q326_channel` (mixed precision, attn 4-bit + FFN ~3-bit, recommended quality-size trade-off)
119
+
120
+ ## Model Architecture
121
+
122
+ Gemma-4-E2B-IT's text backbone employs a **dense Transformer decoder** with **GeGLU activation**, **hybrid attention** (sliding-window linear attention + standard full attention), **aggressive GQA**, **per-layer input projections** (256-dim layer input β†’ 1,536 hidden), and **double-wide MLP**:
123
+
124
+ | Parameter | Gemma 4 E2B |
125
+ |-----------|--------------|
126
+ | Layers | **35** |
127
+ | Hidden size | **1,536** |
128
+ | Layer input size | **256** |
129
+ | FFN intermediate size | **6,144** (double-wide MLP) |
130
+ | Attention heads (Query) | **8** |
131
+ | Attention heads (KV) | **1** (aggressive GQA) |
132
+ | Head dimension | **256** (global 512) |
133
+ | Full-attention layers | **8** |
134
+ | Sliding-window layers | **27** |
135
+ | Sliding window | **512** |
136
+ | Activation | GeGLU (gelu_pytorch_tanh) |
137
+ | Position encoding | RoPE (full-attn ΞΈ = 1,000,000, partial rotary 0.25; sliding ΞΈ = 10,000) |
138
+ | Normalization | RMSNorm (pre-norm) |
139
+ | Vocabulary size | 262,144 |
140
+ | Max context length | **131,072** (128K) |
141
+
142
+ **Design highlights (Gemma 4 family):**
143
+ - **Hybrid attention:** 27/35 layers use sliding-window attention (window 512); 8/35 layers use standard full softmax attention β€” dense-attention KV cost is confined to a few layers
144
+ - **Aggressive GQA:** 1 KV head serving 8 query heads (8Γ— KV compression) β€” KV Cache memory is minimal, enabling 128K context on edge devices
145
+ - **Double-wide MLP:** `use_double_wide_mlp: true` β€” FFN expands to 6,144 intermediate (β‰ˆ4Γ— hidden), boosting capacity at modest parameter cost
146
+ - **Per-layer input projections:** a 256-dim layer-input embedding is projected to the 1,536-dim hidden state at each layer β€” compact embedding table with shared layer-input processing
147
+ - **GeGLU activation:** GELU with tanh approximation gating, efficient for on-device inference
148
+ - **RoPE position encoding:** 1M base frequency for full-attention layers (partial rotary factor 0.25) with 10K base for sliding-window layers, supporting 128K context
149
+ - **RMSNorm pre-normalization:** Lightweight normalization before each sub-layer
150
+ - **Final logit softcapping:** Output logits capped at Β±30.0 for training stability
151
+ - **Tied embeddings:** `tie_word_embeddings: true` β€” input and output embeddings share weights, reducing footprint
152
+
153
+ ## Bias, Risks, and Limitations
154
+
155
+ ### Limitations
156
+
157
+ - **Reasoning depth:** Multi-step logical reasoning is limited for a 1.5B-class model. Verify outputs in high-stakes scenarios; consider larger Gemma 4 variants for reasoning tasks.
158
+ - **Mathematics:** Simple arithmetic may be attempted but is unreliable. Advanced quantitative reasoning is out of scope. Use larger models for mathematical tasks.
159
+ - **Code generation:** Capable of single-line completions and basic snippets; unreliable for multi-line code or structured programs.
160
+ - **Factual knowledge:** Limited world knowledge due to ~1.5B parameter scale. Always verify factual claims against authoritative sources. This model is best suited for instruction-following and lightweight text processing rather than encyclopedic knowledge retrieval.
161
+ - **Instruction following:** Handles simple single-constraint instructions. Complex multi-constraint prompts may cause degradation, especially at longer contexts.
162
+ - **Quantization drift:** Uniform 4-bit per-channel quantization may exhibit noticeable generation drift versus FP16, especially on ambiguous or open-ended prompts. For higher fidelity, use `gemma-4-e2b-it_q326_channel` (mixed precision) or `gemma-4-e2b-it_q8_channel` (per-channel 8-bit).
163
+
164
+ ### Bias and Risks
165
+
166
+ - **Bias:** As with all large language models trained on web-scale data, Gemma may reflect societal biases present in its training corpus. Evaluate outputs before deployment in sensitive domains (hiring, healthcare, law).
167
+ - **Toxicity:** The instruction-tuned model has been safety-aligned with RLHF. However, no safety filter is exhaustive. Consider an additional output classifier in high-risk environments.
168
+ - **Hallucination:** May generate plausible-sounding but factually incorrect information. Implement output verification for critical applications. Hallucination risk is elevated for smaller models due to limited memorization capacity.
169
+ - **Dual-use risk:** Text-generation capabilities could be misused for spam, disinformation, or impersonation. Deploy responsibly and in accordance with the Apache 2.0 license terms.
170
+
171
+ ### Recommendations
172
+
173
+ Users (both direct and downstream) should be made aware of the above risks, biases, limitations, and constraints of the model. We recommend:
174
+ - Adding a lightweight output safety classifier for user-facing deployments
175
+ - Verifying factual claims with external knowledge bases
176
+ - Not using the model for high-stakes decisions without human review
177
+ - Considering larger Gemma 4 variants for tasks requiring stronger reasoning or factual recall