Erland danielhanchen commited on
Commit
40311b6
·
verified ·
0 Parent(s):

Duplicate from unsloth/gemma-3-270m-it

Browse files

Co-authored-by: Daniel (Unsloth) <[email protected]>

.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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,558 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - google/gemma-3-270m-it
4
+ license: gemma
5
+ tags:
6
+ - gemma3
7
+ - unsloth
8
+ - gemma
9
+ - google
10
+ pipeline_tag: text-generation
11
+ library_name: transformers
12
+ ---
13
+ <div>
14
+ <p style="margin-bottom: 0; margin-top: 0;">
15
+ <strong>See <a href="https://huggingface.co/collections/unsloth/gemma-3-67d12b7e8816ec6efa7e4e5b">our collection</a> for all versions of Gemma 3 including GGUF, 4-bit & 16-bit formats.</strong>
16
+ </p>
17
+ <p style="margin-bottom: 0;">
18
+ <em><a href="https://docs.unsloth.ai/basics/tutorial-how-to-run-gemma-3-effectively">Read our Guide</a> to see how to Run Gemma 3 correctly.</em>
19
+ </p>
20
+ <div style="display: flex; gap: 5px; align-items: center; ">
21
+ <a href="https://github.com/unslothai/unsloth/">
22
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
23
+ </a>
24
+ <a href="https://discord.gg/unsloth">
25
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
26
+ </a>
27
+ <a href="https://docs.unsloth.ai/basics/tutorial-how-to-run-deepseek-r1-on-your-own-local-device">
28
+ <img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
29
+ </a>
30
+ </div>
31
+ <h1 style="margin-top: 0rem;">✨ Fine-tune Gemma 3 with Unsloth!</h1>
32
+ </div>
33
+
34
+ - Fine-tune Gemma 3 (270M) for free using our Google [Colab notebook here](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma3_(270M).ipynb)!
35
+ - Read our Blog about Gemma 3 support: [unsloth.ai/blog/gemma3](https://unsloth.ai/blog/gemma3)
36
+ - View the rest of our notebooks in our [docs here](https://docs.unsloth.ai/get-started/unsloth-notebooks).
37
+
38
+ | Unsloth supports | Free Notebooks | Performance | Memory use |
39
+ |-----------------|--------------------------------------------------------------------------------------------------------------------------|-------------|----------|
40
+ | **Gemma 3 (4B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma3_(4B).ipynb) | 2x faster | 80% less |
41
+ | **Gemma-3n-E4B** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma3N_(4B)-Conversational.ipynb) | 2x faster | 60% less |
42
+ | **Gemma-3n-E4B (Audio)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma3N_(4B)-Audio.ipynb) | 2x faster | 60% less |
43
+ | **GRPO with Gemma 3 (1B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma3_(1B)-GRPO.ipynb) | 2x faster | 80% less |
44
+ | **Gemma 3 (4B) Vision** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma3_(4B)-Vision.ipynb) | 2x faster | 60% less |
45
+
46
+ # Gemma 3 model card
47
+
48
+ **Model Page**: [Gemma](https://ai.google.dev/gemma/docs/core)
49
+
50
+ **Resources and Technical Documentation**:
51
+
52
+ * [Gemma 3 Technical Report][g3-tech-report]
53
+ * [Responsible Generative AI Toolkit][rai-toolkit]
54
+ * [Gemma on Kaggle][kaggle-gemma]
55
+ * [Gemma on Vertex Model Garden][vertex-mg-gemma3]
56
+
57
+ **Terms of Use**: [Terms][terms]
58
+
59
+ **Authors**: Google DeepMind
60
+
61
+ ## Model Information
62
+
63
+ Summary description and brief definition of inputs and outputs.
64
+
65
+ ### Description
66
+
67
+ Gemma is a family of lightweight, state-of-the-art open models from Google,
68
+ built from the same research and technology used to create the Gemini models.
69
+ Gemma 3 models are multimodal, handling text and image input and generating text
70
+ output, with open weights for both pre-trained variants and instruction-tuned
71
+ variants. Gemma 3 has a large, 128K context window, multilingual support in over
72
+ 140 languages, and is available in more sizes than previous versions. Gemma 3
73
+ models are well-suited for a variety of text generation and image understanding
74
+ tasks, including question answering, summarization, and reasoning. Their
75
+ relatively small size makes it possible to deploy them in environments with
76
+ limited resources such as laptops, desktops or your own cloud infrastructure,
77
+ democratizing access to state of the art AI models and helping foster innovation
78
+ for everyone.
79
+
80
+ ### Inputs and outputs
81
+
82
+ - **Input:**
83
+ - Text string, such as a question, a prompt, or a document to be summarized
84
+ - Images, normalized to 896 x 896 resolution and encoded to 256 tokens
85
+ each, for the 4B, 12B, and 27B sizes.
86
+ - Total input context of 128K tokens for the 4B, 12B, and 27B sizes, and
87
+ 32K tokens for the 1B and 270M sizes.
88
+
89
+ - **Output:**
90
+ - Generated text in response to the input, such as an answer to a
91
+ question, analysis of image content, or a summary of a document
92
+ - Total output context up to 128K tokens for the 4B, 12B, and 27B sizes,
93
+ and 32K tokens for the 1B and 270M sizes per request, subtracting the
94
+ request input tokens
95
+
96
+ ### Citation
97
+
98
+ ```none
99
+ @article{gemma_2025,
100
+ title={Gemma 3},
101
+ url={https://arxiv.org/abs/2503.19786},
102
+ publisher={Google DeepMind},
103
+ author={Gemma Team},
104
+ year={2025}
105
+ }
106
+ ```
107
+
108
+ ## Model Data
109
+
110
+ Data used for model training and how the data was processed.
111
+
112
+ ### Training Dataset
113
+
114
+ These models were trained on a dataset of text data that includes a wide variety
115
+ of sources. The 27B model was trained with 14 trillion tokens, the 12B model was
116
+ trained with 12 trillion tokens, 4B model was trained with 4 trillion tokens,
117
+ the 1B with 2 trillion tokens, and the 270M with 6 trillion tokens. The
118
+ knowledge cutoff date for the training data was August 2024. Here are the key
119
+ components:
120
+
121
+ - Web Documents: A diverse collection of web text ensures the model is
122
+ exposed to a broad range of linguistic styles, topics, and vocabulary. The
123
+ training dataset includes content in over 140 languages.
124
+ - Code: Exposing the model to code helps it to learn the syntax and
125
+ patterns of programming languages, which improves its ability to generate
126
+ code and understand code-related questions.
127
+ - Mathematics: Training on mathematical text helps the model learn logical
128
+ reasoning, symbolic representation, and to address mathematical queries.
129
+ - Images: A wide range of images enables the model to perform image
130
+ analysis and visual data extraction tasks.
131
+
132
+ The combination of these diverse data sources is crucial for training a powerful
133
+ multimodal model that can handle a wide variety of different tasks and data
134
+ formats.
135
+
136
+ ### Data Preprocessing
137
+
138
+ Here are the key data cleaning and filtering methods applied to the training
139
+ data:
140
+
141
+ - CSAM Filtering: Rigorous CSAM (Child Sexual Abuse Material) filtering
142
+ was applied at multiple stages in the data preparation process to ensure
143
+ the exclusion of harmful and illegal content.
144
+ - Sensitive Data Filtering: As part of making Gemma pre-trained models
145
+ safe and reliable, automated techniques were used to filter out certain
146
+ personal information and other sensitive data from training sets.
147
+ - Additional methods: Filtering based on content quality and safety in
148
+ line with [our policies][safety-policies].
149
+
150
+ ## Implementation Information
151
+
152
+ Details about the model internals.
153
+
154
+ ### Hardware
155
+
156
+ Gemma was trained using [Tensor Processing Unit (TPU)][tpu] hardware (TPUv4p,
157
+ TPUv5p and TPUv5e). Training vision-language models (VLMS) requires significant
158
+ computational power. TPUs, designed specifically for matrix operations common in
159
+ machine learning, offer several advantages in this domain:
160
+
161
+ - Performance: TPUs are specifically designed to handle the massive
162
+ computations involved in training VLMs. They can speed up training
163
+ considerably compared to CPUs.
164
+ - Memory: TPUs often come with large amounts of high-bandwidth memory,
165
+ allowing for the handling of large models and batch sizes during training.
166
+ This can lead to better model quality.
167
+ - Scalability: TPU Pods (large clusters of TPUs) provide a scalable
168
+ solution for handling the growing complexity of large foundation models.
169
+ You can distribute training across multiple TPU devices for faster and more
170
+ efficient processing.
171
+ - Cost-effectiveness: In many scenarios, TPUs can provide a more
172
+ cost-effective solution for training large models compared to CPU-based
173
+ infrastructure, especially when considering the time and resources saved
174
+ due to faster training.
175
+ - These advantages are aligned with
176
+ [Google's commitments to operate sustainably][sustainability].
177
+
178
+ ### Software
179
+
180
+ Training was done using [JAX][jax] and [ML Pathways][ml-pathways].
181
+
182
+ JAX allows researchers to take advantage of the latest generation of hardware,
183
+ including TPUs, for faster and more efficient training of large models. ML
184
+ Pathways is Google's latest effort to build artificially intelligent systems
185
+ capable of generalizing across multiple tasks. This is specially suitable for
186
+ foundation models, including large language models like these ones.
187
+
188
+ Together, JAX and ML Pathways are used as described in the
189
+ [paper about the Gemini family of models][gemini-2-paper]; *"the 'single
190
+ controller' programming model of Jax and Pathways allows a single Python
191
+ process to orchestrate the entire training run, dramatically simplifying the
192
+ development workflow."*
193
+
194
+ ## Evaluation
195
+
196
+ Model evaluation metrics and results.
197
+
198
+ ### Benchmark Results
199
+
200
+ These models were evaluated against a large collection of different datasets and
201
+ metrics to cover different aspects of text generation. Evaluation results marked
202
+ with **IT** are for instruction-tuned models. Evaluation results marked with
203
+ **PT** are for pre-trained models.
204
+
205
+ #### Gemma 3 270M
206
+
207
+ | **Benchmark** | **n-shot** | **Gemma 3 PT 270M** |
208
+ | :------------------------ | :-----------: | ------------------: |
209
+ | [HellaSwag][hellaswag] | 10-shot | 40.9 |
210
+ | [BoolQ][boolq] | 0-shot | 61.4 |
211
+ | [PIQA][piqa] | 0-shot | 67.7 |
212
+ | [TriviaQA][triviaqa] | 5-shot | 15.4 |
213
+ | [ARC-c][arc] | 25-shot | 29.0 |
214
+ | [ARC-e][arc] | 0-shot | 57.7 |
215
+ | [WinoGrande][winogrande] | 5-shot | 52.0 |
216
+
217
+ [hellaswag]: https://arxiv.org/abs/1905.07830
218
+ [boolq]: https://arxiv.org/abs/1905.10044
219
+ [piqa]: https://arxiv.org/abs/1911.11641
220
+ [triviaqa]: https://arxiv.org/abs/1705.03551
221
+ [arc]: https://arxiv.org/abs/1911.01547
222
+ [winogrande]: https://arxiv.org/abs/1907.10641
223
+
224
+ | **Benchmark** | **n-shot** | **Gemma 3 IT 270m** |
225
+ | :------------------------ | :-----------: | ------------------: |
226
+ | [HellaSwag][hellaswag] | 0-shot | 37.7 |
227
+ | [PIQA][piqa] | 0-shot | 66.2 |
228
+ | [ARC-c][arc] | 0-shot | 28.2 |
229
+ | [WinoGrande][winogrande] | 0-shot | 52.3 |
230
+ | [BIG-Bench Hard][bbh] | few-shot | 26.7 |
231
+ | [IF Eval][ifeval] | 0-shot | 51.2 |
232
+
233
+ [hellaswag]: https://arxiv.org/abs/1905.07830
234
+ [piqa]: https://arxiv.org/abs/1911.11641
235
+ [arc]: https://arxiv.org/abs/1911.01547
236
+ [winogrande]: https://arxiv.org/abs/1907.10641
237
+ [bbh]: https://paperswithcode.com/dataset/bbh
238
+ [bbh]: https://paperswithcode.com/dataset/bbh
239
+ [ifeval]: https://arxiv.org/abs/2311.07911
240
+
241
+ #### Gemma 3 1B, 4B, 12B & 27B
242
+
243
+ ##### Reasoning and factuality
244
+
245
+ | Benchmark | n-shot | Gemma 3 IT 1B | Gemma 3 IT 4B | Gemma 3 IT 12B | Gemma 3 IT 27B |
246
+ |--------------------------------|--------|:-------------:|:-------------:|:--------------:|:--------------:|
247
+ | [GPQA][gpqa] Diamond | 0-shot | 19.2 | 30.8 | 40.9 | 42.4 |
248
+ | [SimpleQA][simpleqa] | 0-shot | 2.2 | 4.0 | 6.3 | 10.0 |
249
+ | [FACTS Grounding][facts-grdg] | - | 36.4 | 70.1 | 75.8 | 74.9 |
250
+ | [BIG-Bench Hard][bbh] | 0-shot | 39.1 | 72.2 | 85.7 | 87.6 |
251
+ | [BIG-Bench Extra Hard][bbeh] | 0-shot | 7.2 | 11.0 | 16.3 | 19.3 |
252
+ | [IFEval][ifeval] | 0-shot | 80.2 | 90.2 | 88.9 | 90.4 |
253
+
254
+ | Benchmark | n-shot | Gemma 3 PT 1B | Gemma 3 PT 4B | Gemma 3 PT 12B | Gemma 3 PT 27B |
255
+ | ------------------------------ |----------|:--------------:|:-------------:|:--------------:|:--------------:|
256
+ | [HellaSwag][hellaswag] | 10-shot | 62.3 | 77.2 | 84.2 | 85.6 |
257
+ | [BoolQ][boolq] | 0-shot | 63.2 | 72.3 | 78.8 | 82.4 |
258
+ | [PIQA][piqa] | 0-shot | 73.8 | 79.6 | 81.8 | 83.3 |
259
+ | [SocialIQA][socialiqa] | 0-shot | 48.9 | 51.9 | 53.4 | 54.9 |
260
+ | [TriviaQA][triviaqa] | 5-shot | 39.8 | 65.8 | 78.2 | 85.5 |
261
+ | [Natural Questions][naturalq] | 5-shot | 9.48 | 20.0 | 31.4 | 36.1 |
262
+ | [ARC-c][arc] | 25-shot | 38.4 | 56.2 | 68.9 | 70.6 |
263
+ | [ARC-e][arc] | 0-shot | 73.0 | 82.4 | 88.3 | 89.0 |
264
+ | [WinoGrande][winogrande] | 5-shot | 58.2 | 64.7 | 74.3 | 78.8 |
265
+ | [BIG-Bench Hard][bbh] | few-shot | 28.4 | 50.9 | 72.6 | 77.7 |
266
+ | [DROP][drop] | 1-shot | 42.4 | 60.1 | 72.2 | 77.2 |
267
+
268
+ [gpqa]: https://arxiv.org/abs/2311.12022
269
+ [simpleqa]: https://arxiv.org/abs/2411.04368
270
+ [facts-grdg]: https://goo.gle/FACTS_paper
271
+ [bbeh]: https://github.com/google-deepmind/bbeh
272
+ [ifeval]: https://arxiv.org/abs/2311.07911
273
+ [hellaswag]: https://arxiv.org/abs/1905.07830
274
+ [boolq]: https://arxiv.org/abs/1905.10044
275
+ [piqa]: https://arxiv.org/abs/1911.11641
276
+ [socialiqa]: https://arxiv.org/abs/1904.09728
277
+ [triviaqa]: https://arxiv.org/abs/1705.03551
278
+ [naturalq]: https://github.com/google-research-datasets/natural-questions
279
+ [arc]: https://arxiv.org/abs/1911.01547
280
+ [winogrande]: https://arxiv.org/abs/1907.10641
281
+ [bbh]: https://paperswithcode.com/dataset/bbh
282
+ [drop]: https://arxiv.org/abs/1903.00161
283
+
284
+ ##### STEM and code
285
+
286
+ | Benchmark | n-shot | Gemma 3 IT 1B | Gemma 3 IT 4B | Gemma 3 IT 12B | Gemma 3 IT 27B |
287
+ |----------------------------|--------|:-------------:|:-------------:|:--------------:|:--------------:|
288
+ | [MMLU][mmlu] (Pro) | 0-shot | 14.7 | 43.6 | 60.6 | 67.5 |
289
+ | [LiveCodeBench][lcb] | 0-shot | 1.9 | 12.6 | 24.6 | 29.7 |
290
+ | [Bird-SQL][bird-sql] (dev) | - | 6.4 | 36.3 | 47.9 | 54.4 |
291
+ | [Math][math] | 0-shot | 48.0 | 75.6 | 83.8 | 89.0 |
292
+ | HiddenMath | 0-shot | 15.8 | 43.0 | 54.5 | 60.3 |
293
+ | [MBPP][mbpp] | 3-shot | 35.2 | 63.2 | 73.0 | 74.4 |
294
+ | [HumanEval][humaneval] | 0-shot | 41.5 | 71.3 | 85.4 | 87.8 |
295
+ | [Natural2Code][nat2code] | 0-shot | 56.0 | 70.3 | 80.7 | 84.5 |
296
+ | [GSM8K][gsm8k] | 0-shot | 62.8 | 89.2 | 94.4 | 95.9 |
297
+
298
+ | Benchmark | n-shot | Gemma 3 PT 4B | Gemma 3 PT 12B | Gemma 3 PT 27B |
299
+ | ------------------------------ |----------------|:-------------:|:--------------:|:--------------:|
300
+ | [MMLU][mmlu] | 5-shot | 59.6 | 74.5 | 78.6 |
301
+ | [MMLU][mmlu] (Pro COT) | 5-shot | 29.2 | 45.3 | 52.2 |
302
+ | [AGIEval][agieval] | 3-5-shot | 42.1 | 57.4 | 66.2 |
303
+ | [MATH][math] | 4-shot | 24.2 | 43.3 | 50.0 |
304
+ | [GSM8K][gsm8k] | 8-shot | 38.4 | 71.0 | 82.6 |
305
+ | [GPQA][gpqa] | 5-shot | 15.0 | 25.4 | 24.3 |
306
+ | [MBPP][mbpp] | 3-shot | 46.0 | 60.4 | 65.6 |
307
+ | [HumanEval][humaneval] | 0-shot | 36.0 | 45.7 | 48.8 |
308
+
309
+ [mmlu]: https://arxiv.org/abs/2009.03300
310
+ [agieval]: https://arxiv.org/abs/2304.06364
311
+ [math]: https://arxiv.org/abs/2103.03874
312
+ [gsm8k]: https://arxiv.org/abs/2110.14168
313
+ [gpqa]: https://arxiv.org/abs/2311.12022
314
+ [mbpp]: https://arxiv.org/abs/2108.07732
315
+ [humaneval]: https://arxiv.org/abs/2107.03374
316
+ [lcb]: https://arxiv.org/abs/2403.07974
317
+ [bird-sql]: https://arxiv.org/abs/2305.03111
318
+ [nat2code]: https://arxiv.org/abs/2405.04520
319
+
320
+ #### Multilingual
321
+
322
+ | Benchmark | n-shot | Gemma 3 IT 1B | Gemma 3 IT 4B | Gemma 3 IT 12B | Gemma 3 IT 27B |
323
+ |--------------------------------------|--------|:-------------:|:-------------:|:--------------:|:--------------:|
324
+ | [Global-MMLU-Lite][global-mmlu-lite] | 0-shot | 34.2 | 54.5 | 69.5 | 75.1 |
325
+ | [ECLeKTic][eclektic] | 0-shot | 1.4 | 4.6 | 10.3 | 16.7 |
326
+ | [WMT24++][wmt24pp] | 0-shot | 35.9 | 46.8 | 51.6 | 53.4 |
327
+
328
+ | Benchmark | Gemma 3 PT 1B | Gemma 3 PT 4B | Gemma 3 PT 12B | Gemma 3 PT 27B |
329
+ | ------------------------------------ |:-------------:|:-------------:|:--------------:|:--------------:|
330
+ | [MGSM][mgsm] | 2.04 | 34.7 | 64.3 | 74.3 |
331
+ | [Global-MMLU-Lite][global-mmlu-lite] | 24.9 | 57.0 | 69.4 | 75.7 |
332
+ | [WMT24++][wmt24pp] (ChrF) | 36.7 | 48.4 | 53.9 | 55.7 |
333
+ | [FloRes][flores] | 29.5 | 39.2 | 46.0 | 48.8 |
334
+ | [XQuAD][xquad] (all) | 43.9 | 68.0 | 74.5 | 76.8 |
335
+ | [ECLeKTic][eclektic] | 4.69 | 11.0 | 17.2 | 24.4 |
336
+ | [IndicGenBench][indicgenbench] | 41.4 | 57.2 | 61.7 | 63.4 |
337
+
338
+ [mgsm]: https://arxiv.org/abs/2210.03057
339
+ [flores]: https://arxiv.org/abs/2106.03193
340
+ [xquad]: https://arxiv.org/abs/1910.11856v3
341
+ [global-mmlu-lite]: https://huggingface.co/datasets/CohereForAI/Global-MMLU-Lite
342
+ [wmt24pp]: https://arxiv.org/abs/2502.12404v1
343
+ [eclektic]: https://arxiv.org/abs/2502.21228
344
+ [indicgenbench]: https://arxiv.org/abs/2404.16816
345
+
346
+ ##### Multimodal
347
+
348
+ | Benchmark | Gemma 3 IT 4B | Gemma 3 IT 12B | Gemma 3 IT 27B |
349
+ |-----------------------------------|:-------------:|:--------------:|:--------------:|
350
+ | [MMMU][mmmu] (val) | 48.8 | 59.6 | 64.9 |
351
+ | [DocVQA][docvqa] | 75.8 | 87.1 | 86.6 |
352
+ | [InfoVQA][info-vqa] | 50.0 | 64.9 | 70.6 |
353
+ | [TextVQA][textvqa] | 57.8 | 67.7 | 65.1 |
354
+ | [AI2D][ai2d] | 74.8 | 84.2 | 84.5 |
355
+ | [ChartQA][chartqa] | 68.8 | 75.7 | 78.0 |
356
+ | [VQAv2][vqav2] (val) | 62.4 | 71.6 | 71.0 |
357
+ | [MathVista][mathvista] (testmini) | 50.0 | 62.9 | 67.6 |
358
+
359
+ | Benchmark | Gemma 3 PT 4B | Gemma 3 PT 12B | Gemma 3 PT 27B |
360
+ | ------------------------------ |:-------------:|:--------------:|:--------------:|
361
+ | [COCOcap][coco-cap] | 102 | 111 | 116 |
362
+ | [DocVQA][docvqa] (val) | 72.8 | 82.3 | 85.6 |
363
+ | [InfoVQA][info-vqa] (val) | 44.1 | 54.8 | 59.4 |
364
+ | [MMMU][mmmu] (pt) | 39.2 | 50.3 | 56.1 |
365
+ | [TextVQA][textvqa] (val) | 58.9 | 66.5 | 68.6 |
366
+ | [RealWorldQA][realworldqa] | 45.5 | 52.2 | 53.9 |
367
+ | [ReMI][remi] | 27.3 | 38.5 | 44.8 |
368
+ | [AI2D][ai2d] | 63.2 | 75.2 | 79.0 |
369
+ | [ChartQA][chartqa] | 63.6 | 74.7 | 76.3 |
370
+ | [VQAv2][vqav2] | 63.9 | 71.2 | 72.9 |
371
+ | [BLINK][blinkvqa] | 38.0 | 35.9 | 39.6 |
372
+ | [OKVQA][okvqa] | 51.0 | 58.7 | 60.2 |
373
+ | [TallyQA][tallyqa] | 42.5 | 51.8 | 54.3 |
374
+ | [SpatialSense VQA][ss-vqa] | 50.9 | 60.0 | 59.4 |
375
+ | [CountBenchQA][countbenchqa] | 26.1 | 17.8 | 68.0 |
376
+
377
+ [coco-cap]: https://cocodataset.org/#home
378
+ [docvqa]: https://www.docvqa.org/
379
+ [info-vqa]: https://arxiv.org/abs/2104.12756
380
+ [mmmu]: https://arxiv.org/abs/2311.16502
381
+ [textvqa]: https://textvqa.org/
382
+ [realworldqa]: https://paperswithcode.com/dataset/realworldqa
383
+ [remi]: https://arxiv.org/html/2406.09175v1
384
+ [ai2d]: https://allenai.org/data/diagrams
385
+ [chartqa]: https://arxiv.org/abs/2203.10244
386
+ [vqav2]: https://visualqa.org/index.html
387
+ [blinkvqa]: https://arxiv.org/abs/2404.12390
388
+ [okvqa]: https://okvqa.allenai.org/
389
+ [tallyqa]: https://arxiv.org/abs/1810.12440
390
+ [ss-vqa]: https://arxiv.org/abs/1908.02660
391
+ [countbenchqa]: https://github.com/google-research/big_vision/blob/main/big_vision/datasets/countbenchqa/
392
+ [mathvista]: https://arxiv.org/abs/2310.02255
393
+
394
+ ## Ethics and Safety
395
+
396
+ Ethics and safety evaluation approach and results.
397
+
398
+ ### Evaluation Approach
399
+
400
+ Our evaluation methods include structured evaluations and internal red-teaming
401
+ testing of relevant content policies. Red-teaming was conducted by a number of
402
+ different teams, each with different goals and human evaluation metrics. These
403
+ models were evaluated against a number of different categories relevant to
404
+ ethics and safety, including:
405
+
406
+ - **Child Safety**: Evaluation of text-to-text and image to text prompts
407
+ covering child safety policies, including child sexual abuse and
408
+ exploitation.
409
+ - **Content Safety:** Evaluation of text-to-text and image to text prompts
410
+ covering safety policies including, harassment, violence and gore, and hate
411
+ speech.
412
+ - **Representational Harms**: Evaluation of text-to-text and image to text
413
+ prompts covering safety policies including bias, stereotyping, and harmful
414
+ associations or inaccuracies.
415
+
416
+ In addition to development level evaluations, we conduct "assurance
417
+ evaluations" which are our 'arms-length' internal evaluations for responsibility
418
+ governance decision making. They are conducted separately from the model
419
+ development team, to inform decision making about release. High level findings
420
+ are fed back to the model team, but prompt sets are held-out to prevent
421
+ overfitting and preserve the results' ability to inform decision making.
422
+ Assurance evaluation results are reported to our Responsibility & Safety Council
423
+ as part of release review.
424
+
425
+ ### Evaluation Results
426
+
427
+ For all areas of safety testing, we saw major improvements in the categories of
428
+ child safety, content safety, and representational harms relative to previous
429
+ Gemma models. All testing was conducted without safety filters to evaluate the
430
+ model capabilities and behaviors. For both text-to-text and image-to-text, and
431
+ across all model sizes, the model produced minimal policy violations, and showed
432
+ significant improvements over previous Gemma models' performance with respect
433
+ to ungrounded inferences. A limitation of our evaluations was they included only
434
+ English language prompts.
435
+
436
+ ## Usage and Limitations
437
+
438
+ These models have certain limitations that users should be aware of.
439
+
440
+ ### Intended Usage
441
+
442
+ Open vision-language models (VLMs) models have a wide range of applications
443
+ across various industries and domains. The following list of potential uses is
444
+ not comprehensive. The purpose of this list is to provide contextual information
445
+ about the possible use-cases that the model creators considered as part of model
446
+ training and development.
447
+
448
+ - Content Creation and Communication
449
+ - Text Generation: These models can be used to generate creative text
450
+ formats such as poems, scripts, code, marketing copy, and email drafts.
451
+ - Chatbots and Conversational AI: Power conversational interfaces
452
+ for customer service, virtual assistants, or interactive applications.
453
+ - Text Summarization: Generate concise summaries of a text corpus,
454
+ research papers, or reports.
455
+ - Image Data Extraction: These models can be used to extract,
456
+ interpret, and summarize visual data for text communications.
457
+ - Research and Education
458
+ - Natural Language Processing (NLP) and VLM Research: These
459
+ models can serve as a foundation for researchers to experiment with VLM
460
+ and NLP techniques, develop algorithms, and contribute to the
461
+ advancement of the field.
462
+ - Language Learning Tools: Support interactive language learning
463
+ experiences, aiding in grammar correction or providing writing practice.
464
+ - Knowledge Exploration: Assist researchers in exploring large
465
+ bodies of text by generating summaries or answering questions about
466
+ specific topics.
467
+
468
+ ### Limitations
469
+
470
+ - Training Data
471
+ - The quality and diversity of the training data significantly
472
+ influence the model's capabilities. Biases or gaps in the training data
473
+ can lead to limitations in the model's responses.
474
+ - The scope of the training dataset determines the subject areas
475
+ the model can handle effectively.
476
+ - Context and Task Complexity
477
+ - Models are better at tasks that can be framed with clear
478
+ prompts and instructions. Open-ended or highly complex tasks might be
479
+ challenging.
480
+ - A model's performance can be influenced by the amount of context
481
+ provided (longer context generally leads to better outputs, up to a
482
+ certain point).
483
+ - Language Ambiguity and Nuance
484
+ - Natural language is inherently complex. Models might struggle
485
+ to grasp subtle nuances, sarcasm, or figurative language.
486
+ - Factual Accuracy
487
+ - Models generate responses based on information they learned
488
+ from their training datasets, but they are not knowledge bases. They
489
+ may generate incorrect or outdated factual statements.
490
+ - Common Sense
491
+ - Models rely on statistical patterns in language. They might
492
+ lack the ability to apply common sense reasoning in certain situations.
493
+
494
+ ### Ethical Considerations and Risks
495
+
496
+ The development of vision-language models (VLMs) raises several ethical
497
+ concerns. In creating an open model, we have carefully considered the following:
498
+
499
+ - Bias and Fairness
500
+ - VLMs trained on large-scale, real-world text and image data can
501
+ reflect socio-cultural biases embedded in the training material. These
502
+ models underwent careful scrutiny, input data pre-processing described
503
+ and posterior evaluations reported in this card.
504
+ - Misinformation and Misuse
505
+ - VLMs can be misused to generate text that is false, misleading,
506
+ or harmful.
507
+ - Guidelines are provided for responsible use with the model, see the
508
+ [Responsible Generative AI Toolkit][rai-toolkit].
509
+ - Transparency and Accountability:
510
+ - This model card summarizes details on the models' architecture,
511
+ capabilities, limitations, and evaluation processes.
512
+ - A responsibly developed open model offers the opportunity to
513
+ share innovation by making VLM technology accessible to developers and
514
+ researchers across the AI ecosystem.
515
+
516
+ Risks identified and mitigations:
517
+
518
+ - **Perpetuation of biases**: It's encouraged to perform continuous
519
+ monitoring (using evaluation metrics, human review) and the exploration of
520
+ de-biasing techniques during model training, fine-tuning, and other use
521
+ cases.
522
+ - **Generation of harmful content**: Mechanisms and guidelines for content
523
+ safety are essential. Developers are encouraged to exercise caution and
524
+ implement appropriate content safety safeguards based on their specific
525
+ product policies and application use cases.
526
+ - **Misuse for malicious purposes**: Technical limitations and developer
527
+ and end-user education can help mitigate against malicious applications of
528
+ VLMs. Educational resources and reporting mechanisms for users to flag
529
+ misuse are provided. Prohibited uses of Gemma models are outlined in the
530
+ [Gemma Prohibited Use Policy][prohibited-use].
531
+ - **Privacy violations**: Models were trained on data filtered for removal
532
+ of certain personal information and other sensitive data. Developers are
533
+ encouraged to adhere to privacy regulations with privacy-preserving
534
+ techniques.
535
+
536
+ ### Benefits
537
+
538
+ At the time of release, this family of models provides high-performance open
539
+ vision-language model implementations designed from the ground up for
540
+ responsible AI development compared to similarly sized models.
541
+
542
+ Using the benchmark evaluation metrics described in this document, these models
543
+ have shown to provide superior performance to other, comparably-sized open model
544
+ alternatives.
545
+
546
+ [g3-tech-report]: https://arxiv.org/abs/2503.19786
547
+ [rai-toolkit]: https://ai.google.dev/responsible
548
+ [kaggle-gemma]: https://www.kaggle.com/models/google/gemma-3
549
+ [vertex-mg-gemma3]: https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/gemma3
550
+ [terms]: https://ai.google.dev/gemma/terms
551
+ [safety-policies]: https://ai.google/static/documents/ai-responsibility-update-published-february-2025.pdf
552
+ [prohibited-use]: https://ai.google.dev/gemma/prohibited_use_policy
553
+ [tpu]: https://cloud.google.com/tpu/docs/intro-to-tpu
554
+ [sustainability]: https://sustainability.google/operating-sustainably/
555
+ [jax]: https://github.com/jax-ml/jax
556
+ [ml-pathways]: https://blog.google/technology/ai/introducing-pathways-next-generation-ai-architecture/
557
+ [sustainability]: https://sustainability.google/operating-sustainably/
558
+ [gemini-2-paper]: https://arxiv.org/abs/2312.11805
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "<image_soft_token>": 262144
3
+ }
chat_template.jinja ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {# Unsloth Chat template fixes #}
2
+ {{ bos_token }}
3
+ {%- if messages[0]['role'] == 'system' -%}
4
+ {%- if messages[0]['content'] is string -%}
5
+ {%- set first_user_prefix = messages[0]['content'] + '
6
+
7
+ ' -%}
8
+ {%- else -%}
9
+ {%- set first_user_prefix = messages[0]['content'][0]['text'] + '
10
+
11
+ ' -%}
12
+ {%- endif -%}
13
+ {%- set loop_messages = messages[1:] -%}
14
+ {%- else -%}
15
+ {%- set first_user_prefix = "" -%}
16
+ {%- set loop_messages = messages -%}
17
+ {%- endif -%}
18
+ {%- for message in loop_messages -%}
19
+ {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
20
+ {{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
21
+ {%- endif -%}
22
+ {%- if (message['role'] == 'assistant') -%}
23
+ {%- set role = "model" -%}
24
+ {%- else -%}
25
+ {%- set role = message['role'] -%}
26
+ {%- endif -%}
27
+ {{ '<start_of_turn>' + role + '
28
+ ' + (first_user_prefix if loop.first else "") }}
29
+ {%- if message['content'] is string -%}
30
+ {{ message['content'] | trim }}
31
+ {%- elif message['content'] is iterable -%}
32
+ {%- for item in message['content'] -%}
33
+ {%- if item['type'] == 'image' -%}
34
+ {{ '<start_of_image>' }}
35
+ {%- elif item['type'] == 'text' -%}
36
+ {{ item['text'] | trim }}
37
+ {%- endif -%}
38
+ {%- endfor -%}
39
+ {%- elif message['content'] is defined -%}
40
+ {{ raise_exception("Invalid content type") }}
41
+ {%- endif -%}
42
+ {{ '<end_of_turn>
43
+ ' }}
44
+ {%- endfor -%}
45
+ {%- if add_generation_prompt -%}
46
+ {{'<start_of_turn>model
47
+ '}}
48
+ {%- endif -%}
49
+
50
+ {# Copyright 2025-present Unsloth. Apache 2.0 License. #}
config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_sliding_window_pattern": 6,
3
+ "architectures": [
4
+ "Gemma3ForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "attn_logit_softcapping": null,
9
+ "bos_token_id": 2,
10
+ "eos_token_id": 106,
11
+ "final_logit_softcapping": null,
12
+ "head_dim": 256,
13
+ "hidden_activation": "gelu_pytorch_tanh",
14
+ "hidden_size": 640,
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 2048,
17
+ "layer_types": [
18
+ "sliding_attention",
19
+ "sliding_attention",
20
+ "sliding_attention",
21
+ "sliding_attention",
22
+ "sliding_attention",
23
+ "full_attention",
24
+ "sliding_attention",
25
+ "sliding_attention",
26
+ "sliding_attention",
27
+ "sliding_attention",
28
+ "sliding_attention",
29
+ "full_attention",
30
+ "sliding_attention",
31
+ "sliding_attention",
32
+ "sliding_attention",
33
+ "sliding_attention",
34
+ "sliding_attention",
35
+ "full_attention"
36
+ ],
37
+ "max_position_embeddings": 32768,
38
+ "model_type": "gemma3_text",
39
+ "num_attention_heads": 4,
40
+ "num_hidden_layers": 18,
41
+ "num_key_value_heads": 1,
42
+ "pad_token_id": 0,
43
+ "query_pre_attn_scalar": 256,
44
+ "rms_norm_eps": 1e-06,
45
+ "rope_local_base_freq": 10000.0,
46
+ "rope_scaling": null,
47
+ "rope_theta": 1000000.0,
48
+ "sliding_window": 512,
49
+ "torch_dtype": "bfloat16",
50
+ "transformers_version": "4.55.2",
51
+ "unsloth_fixed": true,
52
+ "use_bidirectional_attention": false,
53
+ "use_cache": true,
54
+ "vocab_size": 262144
55
+ }
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 2,
3
+ "cache_implementation": "hybrid",
4
+ "do_sample": true,
5
+ "eos_token_id": [
6
+ 1,
7
+ 106
8
+ ],
9
+ "max_length": 32768,
10
+ "pad_token_id": 0,
11
+ "top_k": 64,
12
+ "top_p": 0.95,
13
+ "transformers_version": "4.55.2"
14
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:700b710a9a99c295ed546647aa81cacf9f81f4c573ea2be613a0e2517a44afab
3
+ size 536223056
special_tokens_map.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "boi_token": "<start_of_image>",
3
+ "bos_token": {
4
+ "content": "<bos>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ "eoi_token": "<end_of_image>",
11
+ "eos_token": {
12
+ "content": "<end_of_turn>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false
17
+ },
18
+ "image_token": "<image_soft_token>",
19
+ "pad_token": {
20
+ "content": "<pad>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false
25
+ },
26
+ "unk_token": {
27
+ "content": "<unk>",
28
+ "lstrip": false,
29
+ "normalized": false,
30
+ "rstrip": false,
31
+ "single_word": false
32
+ }
33
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4667f2089529e8e7657cfb6d1c19910ae71ff5f28aa7ab2ff2763330affad795
3
+ size 33384568
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c
3
+ size 4689074
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff