danielhanchen commited on
Commit
b31b5bf
·
verified ·
1 Parent(s): 91b3149

Add files using upload-large-folder tool

Browse files
.gitattributes CHANGED
@@ -33,3 +33,17 @@ 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
37
+ model-00004-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
38
+ model-00005-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
39
+ model-00006-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
40
+ model-00007-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
41
+ model-00008-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
42
+ model-00009-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
43
+ model-00001-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
44
+ model-00003-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
45
+ model-00010-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
46
+ model-00011-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
47
+ model-00012-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
48
+ model-00002-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
49
+ tokenizer.model filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,535 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: gemma
3
+ library_name: transformers
4
+ pipeline_tag: image-text-to-text
5
+ extra_gated_heading: Access Gemma on Hugging Face
6
+ extra_gated_prompt: To access Gemma on Hugging Face, you’re required to review and
7
+ agree to Google’s usage license. To do this, please ensure you’re logged in to Hugging
8
+ Face and click below. Requests are processed immediately.
9
+ extra_gated_button_content: Acknowledge license
10
+ base_model: google/gemma-3-27b-pt
11
+ ---
12
+
13
+ # Gemma 3 model card
14
+
15
+ **Model Page**: [Gemma](https://ai.google.dev/gemma/docs/core)
16
+
17
+ **Resources and Technical Documentation**:
18
+
19
+ * [Gemma 3 Technical Report][g3-tech-report]
20
+ * [Responsible Generative AI Toolkit][rai-toolkit]
21
+ * [Gemma on Kaggle][kaggle-gemma]
22
+ * [Gemma on Vertex Model Garden][vertex-mg-gemma3]
23
+
24
+ **Terms of Use**: [Terms][terms]
25
+
26
+ **Authors**: Google DeepMind
27
+
28
+ ## Model Information
29
+
30
+ Summary description and brief definition of inputs and outputs.
31
+
32
+ ### Description
33
+
34
+ Gemma is a family of lightweight, state-of-the-art open models from Google,
35
+ built from the same research and technology used to create the Gemini models.
36
+ Gemma 3 models are multimodal, handling text and image input and generating text
37
+ output, with open weights for both pre-trained variants and instruction-tuned
38
+ variants. Gemma 3 has a large, 128K context window, multilingual support in over
39
+ 140 languages, and is available in more sizes than previous versions. Gemma 3
40
+ models are well-suited for a variety of text generation and image understanding
41
+ tasks, including question answering, summarization, and reasoning. Their
42
+ relatively small size makes it possible to deploy them in environments with
43
+ limited resources such as laptops, desktops or your own cloud infrastructure,
44
+ democratizing access to state of the art AI models and helping foster innovation
45
+ for everyone.
46
+
47
+ ### Inputs and outputs
48
+
49
+ - **Input:**
50
+ - Text string, such as a question, a prompt, or a document to be summarized
51
+ - Images, normalized to 896 x 896 resolution and encoded to 256 tokens
52
+ each
53
+ - Total input context of 128K tokens for the 4B, 12B, and 27B sizes, and
54
+ 32K tokens for the 1B size
55
+
56
+ - **Output:**
57
+ - Generated text in response to the input, such as an answer to a
58
+ question, analysis of image content, or a summary of a document
59
+ - Total output context of 8192 tokens
60
+
61
+ ### Usage
62
+
63
+ Below there are some code snippets on how to get quickly started with running the model. First, install the Transformers library with the version made for Gemma 3:
64
+
65
+ ```sh
66
+ $ pip install git+https://github.com/huggingface/[email protected]
67
+ ```
68
+
69
+ Then, copy the snippet from the section that is relevant for your use case.
70
+
71
+ #### Running with the `pipeline` API
72
+
73
+ You can initialize the model and processor for inference with `pipeline` as follows.
74
+
75
+ ```python
76
+ from transformers import pipeline
77
+ import torch
78
+
79
+ pipe = pipeline(
80
+ "image-text-to-text",
81
+ model="google/gemma-3-27b-it",
82
+ device="cuda",
83
+ torch_dtype=torch.bfloat16
84
+ )
85
+ ```
86
+
87
+ With instruction-tuned models, you need to use chat templates to process our inputs first. Then, you can pass it to the pipeline.
88
+
89
+ ```python
90
+ messages = [
91
+ {
92
+ "role": "system",
93
+ "content": [{"type": "text", "text": "You are a helpful assistant."}]
94
+ },
95
+ {
96
+ "role": "user",
97
+ "content": [
98
+ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
99
+ {"type": "text", "text": "What animal is on the candy?"}
100
+ ]
101
+ }
102
+ ]
103
+
104
+ output = pipe(text=messages, max_new_tokens=200)
105
+ print(output[0][0]["generated_text"][-1]["content"])
106
+ # Okay, let's take a look!
107
+ # Based on the image, the animal on the candy is a **turtle**.
108
+ # You can see the shell shape and the head and legs.
109
+ ```
110
+
111
+ #### Running the model on a single/multi GPU
112
+
113
+ ```python
114
+ # pip install accelerate
115
+
116
+ from transformers import AutoProcessor, Gemma3ForConditionalGeneration
117
+ from PIL import Image
118
+ import requests
119
+ import torch
120
+
121
+ model_id = "google/gemma-3-27b-it"
122
+
123
+ model = Gemma3ForConditionalGeneration.from_pretrained(
124
+ model_id, device_map="auto"
125
+ ).eval()
126
+
127
+ processor = AutoProcessor.from_pretrained(model_id)
128
+
129
+ messages = [
130
+ {
131
+ "role": "system",
132
+ "content": [{"type": "text", "text": "You are a helpful assistant."}]
133
+ },
134
+ {
135
+ "role": "user",
136
+ "content": [
137
+ {"type": "image", "image": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg"},
138
+ {"type": "text", "text": "Describe this image in detail."}
139
+ ]
140
+ }
141
+ ]
142
+
143
+ inputs = processor.apply_chat_template(
144
+ messages, add_generation_prompt=True, tokenize=True,
145
+ return_dict=True, return_tensors="pt"
146
+ ).to(model.device, dtype=torch.bfloat16)
147
+
148
+ input_len = inputs["input_ids"].shape[-1]
149
+
150
+ with torch.inference_mode():
151
+ generation = model.generate(**inputs, max_new_tokens=100, do_sample=False)
152
+ generation = generation[0][input_len:]
153
+
154
+ decoded = processor.decode(generation, skip_special_tokens=True)
155
+ print(decoded)
156
+
157
+ # **Overall Impression:** The image is a close-up shot of a vibrant garden scene,
158
+ # focusing on a cluster of pink cosmos flowers and a busy bumblebee.
159
+ # It has a slightly soft, natural feel, likely captured in daylight.
160
+ ```
161
+
162
+ ### Citation
163
+
164
+ ```none
165
+ @article{gemma_2025,
166
+ title={Gemma 3},
167
+ url={https://goo.gle/Gemma3Report},
168
+ publisher={Kaggle},
169
+ author={Gemma Team},
170
+ year={2025}
171
+ }
172
+ ```
173
+
174
+ ## Model Data
175
+
176
+ Data used for model training and how the data was processed.
177
+
178
+ ### Training Dataset
179
+
180
+ These models were trained on a dataset of text data that includes a wide variety
181
+ of sources. The 27B model was trained with 14 trillion tokens, the 12B model was
182
+ trained with 12 trillion tokens, 4B model was trained with 4 trillion tokens and
183
+ 1B with 2 trillion tokens. Here are the key components:
184
+
185
+ - Web Documents: A diverse collection of web text ensures the model is
186
+ exposed to a broad range of linguistic styles, topics, and vocabulary. The
187
+ training dataset includes content in over 140 languages.
188
+ - Code: Exposing the model to code helps it to learn the syntax and
189
+ patterns of programming languages, which improves its ability to generate
190
+ code and understand code-related questions.
191
+ - Mathematics: Training on mathematical text helps the model learn logical
192
+ reasoning, symbolic representation, and to address mathematical queries.
193
+ - Images: A wide range of images enables the model to perform image
194
+ analysis and visual data extraction tasks.
195
+
196
+ The combination of these diverse data sources is crucial for training a powerful
197
+ multimodal model that can handle a wide variety of different tasks and data
198
+ formats.
199
+
200
+ ### Data Preprocessing
201
+
202
+ Here are the key data cleaning and filtering methods applied to the training
203
+ data:
204
+
205
+ - CSAM Filtering: Rigorous CSAM (Child Sexual Abuse Material) filtering
206
+ was applied at multiple stages in the data preparation process to ensure
207
+ the exclusion of harmful and illegal content.
208
+ - Sensitive Data Filtering: As part of making Gemma pre-trained models
209
+ safe and reliable, automated techniques were used to filter out certain
210
+ personal information and other sensitive data from training sets.
211
+ - Additional methods: Filtering based on content quality and safety in
212
+ line with [our policies][safety-policies].
213
+
214
+ ## Implementation Information
215
+
216
+ Details about the model internals.
217
+
218
+ ### Hardware
219
+
220
+ Gemma was trained using [Tensor Processing Unit (TPU)][tpu] hardware (TPUv4p,
221
+ TPUv5p and TPUv5e). Training vision-language models (VLMS) requires significant
222
+ computational power. TPUs, designed specifically for matrix operations common in
223
+ machine learning, offer several advantages in this domain:
224
+
225
+ - Performance: TPUs are specifically designed to handle the massive
226
+ computations involved in training VLMs. They can speed up training
227
+ considerably compared to CPUs.
228
+ - Memory: TPUs often come with large amounts of high-bandwidth memory,
229
+ allowing for the handling of large models and batch sizes during training.
230
+ This can lead to better model quality.
231
+ - Scalability: TPU Pods (large clusters of TPUs) provide a scalable
232
+ solution for handling the growing complexity of large foundation models.
233
+ You can distribute training across multiple TPU devices for faster and more
234
+ efficient processing.
235
+ - Cost-effectiveness: In many scenarios, TPUs can provide a more
236
+ cost-effective solution for training large models compared to CPU-based
237
+ infrastructure, especially when considering the time and resources saved
238
+ due to faster training.
239
+ - These advantages are aligned with
240
+ [Google's commitments to operate sustainably][sustainability].
241
+
242
+ ### Software
243
+
244
+ Training was done using [JAX][jax] and [ML Pathways][ml-pathways].
245
+
246
+ JAX allows researchers to take advantage of the latest generation of hardware,
247
+ including TPUs, for faster and more efficient training of large models. ML
248
+ Pathways is Google's latest effort to build artificially intelligent systems
249
+ capable of generalizing across multiple tasks. This is specially suitable for
250
+ foundation models, including large language models like these ones.
251
+
252
+ Together, JAX and ML Pathways are used as described in the
253
+ [paper about the Gemini family of models][gemini-2-paper]; *"the 'single
254
+ controller' programming model of Jax and Pathways allows a single Python
255
+ process to orchestrate the entire training run, dramatically simplifying the
256
+ development workflow."*
257
+
258
+ ## Evaluation
259
+
260
+ Model evaluation metrics and results.
261
+
262
+ ### Benchmark Results
263
+
264
+ These models were evaluated against a large collection of different datasets and
265
+ metrics to cover different aspects of text generation:
266
+
267
+ #### Reasoning and factuality
268
+
269
+ | Benchmark | Metric | Gemma 3 PT 1B | Gemma 3 PT 4B | Gemma 3 PT 12B | Gemma 3 PT 27B |
270
+ | ------------------------------ |----------------|:--------------:|:-------------:|:--------------:|:--------------:|
271
+ | [HellaSwag][hellaswag] | 10-shot | 62.3 | 77.2 | 84.2 | 85.6 |
272
+ | [BoolQ][boolq] | 0-shot | 63.2 | 72.3 | 78.8 | 82.4 |
273
+ | [PIQA][piqa] | 0-shot | 73.8 | 79.6 | 81.8 | 83.3 |
274
+ | [SocialIQA][socialiqa] | 0-shot | 48.9 | 51.9 | 53.4 | 54.9 |
275
+ | [TriviaQA][triviaqa] | 5-shot | 39.8 | 65.8 | 78.2 | 85.5 |
276
+ | [Natural Questions][naturalq] | 5-shot | 9.48 | 20.0 | 31.4 | 36.1 |
277
+ | [ARC-c][arc] | 25-shot | 38.4 | 56.2 | 68.9 | 70.6 |
278
+ | [ARC-e][arc] | 0-shot | 73.0 | 82.4 | 88.3 | 89.0 |
279
+ | [WinoGrande][winogrande] | 5-shot | 58.2 | 64.7 | 74.3 | 78.8 |
280
+ | [BIG-Bench Hard][bbh] | few-shot | 28.4 | 50.9 | 72.6 | 77.7 |
281
+ | [DROP][drop] | 1-shot | 42.4 | 60.1 | 72.2 | 77.2 |
282
+
283
+ [hellaswag]: https://arxiv.org/abs/1905.07830
284
+ [boolq]: https://arxiv.org/abs/1905.10044
285
+ [piqa]: https://arxiv.org/abs/1911.11641
286
+ [socialiqa]: https://arxiv.org/abs/1904.09728
287
+ [triviaqa]: https://arxiv.org/abs/1705.03551
288
+ [naturalq]: https://github.com/google-research-datasets/natural-questions
289
+ [arc]: https://arxiv.org/abs/1911.01547
290
+ [winogrande]: https://arxiv.org/abs/1907.10641
291
+ [bbh]: https://paperswithcode.com/dataset/bbh
292
+ [drop]: https://arxiv.org/abs/1903.00161
293
+
294
+ #### STEM and code
295
+
296
+ | Benchmark | Metric | Gemma 3 PT 4B | Gemma 3 PT 12B | Gemma 3 PT 27B |
297
+ | ------------------------------ |----------------|:-------------:|:--------------:|:--------------:|
298
+ | [MMLU][mmlu] | 5-shot | 59.6 | 74.5 | 78.6 |
299
+ | [MMLU][mmlu] (Pro COT) | 5-shot | 29.2 | 45.3 | 52.2 |
300
+ | [AGIEval][agieval] | 3-5-shot | 42.1 | 57.4 | 66.2 |
301
+ | [MATH][math] | 4-shot | 24.2 | 43.3 | 50.0 |
302
+ | [GSM8K][gsm8k] | 8-shot | 38.4 | 71.0 | 82.6 |
303
+ | [GPQA][gpqa] | 5-shot | 15.0 | 25.4 | 24.3 |
304
+ | [MBPP][mbpp] | 3-shot | 46.0 | 60.4 | 65.6 |
305
+ | [HumanEval][humaneval] | 0-shot | 36.0 | 45.7 | 48.8 |
306
+
307
+ [mmlu]: https://arxiv.org/abs/2009.03300
308
+ [agieval]: https://arxiv.org/abs/2304.06364
309
+ [math]: https://arxiv.org/abs/2103.03874
310
+ [gsm8k]: https://arxiv.org/abs/2110.14168
311
+ [gpqa]: https://arxiv.org/abs/2311.12022
312
+ [mbpp]: https://arxiv.org/abs/2108.07732
313
+ [humaneval]: https://arxiv.org/abs/2107.03374
314
+
315
+ #### Multilingual
316
+
317
+ | Benchmark | Gemma 3 PT 1B | Gemma 3 PT 4B | Gemma 3 PT 12B | Gemma 3 PT 27B |
318
+ | ------------------------------------ |:-------------:|:-------------:|:--------------:|:--------------:|
319
+ | [MGSM][mgsm] | 2.04 | 34.7 | 64.3 | 74.3 |
320
+ | [Global-MMLU-Lite][global-mmlu-lite] | 24.9 | 57.0 | 69.4 | 75.7 |
321
+ | [WMT24++][wmt24pp] (ChrF) | 36.7 | 48.4 | 53.9 | 55.7 |
322
+ | [FloRes][flores] | 29.5 | 39.2 | 46.0 | 48.8 |
323
+ | [XQuAD][xquad] (all) | 43.9 | 68.0 | 74.5 | 76.8 |
324
+ | [ECLeKTic][eclektic] | 4.69 | 11.0 | 17.2 | 24.4 |
325
+ | [IndicGenBench][indicgenbench] | 41.4 | 57.2 | 61.7 | 63.4 |
326
+
327
+ [mgsm]: https://arxiv.org/abs/2210.03057
328
+ [flores]: https://arxiv.org/abs/2106.03193
329
+ [xquad]: https://arxiv.org/abs/1910.11856v3
330
+ [global-mmlu-lite]: https://huggingface.co/datasets/CohereForAI/Global-MMLU-Lite
331
+ [wmt24pp]: https://arxiv.org/abs/2502.12404v1
332
+ [eclektic]: https://arxiv.org/abs/2502.21228
333
+ [indicgenbench]: https://arxiv.org/abs/2404.16816
334
+
335
+ #### Multimodal
336
+
337
+ | Benchmark | Gemma 3 PT 4B | Gemma 3 PT 12B | Gemma 3 PT 27B |
338
+ | ------------------------------ |:-------------:|:--------------:|:--------------:|
339
+ | [COCOcap][coco-cap] | 102 | 111 | 116 |
340
+ | [DocVQA][docvqa] (val) | 72.8 | 82.3 | 85.6 |
341
+ | [InfoVQA][info-vqa] (val) | 44.1 | 54.8 | 59.4 |
342
+ | [MMMU][mmmu] (pt) | 39.2 | 50.3 | 56.1 |
343
+ | [TextVQA][textvqa] (val) | 58.9 | 66.5 | 68.6 |
344
+ | [RealWorldQA][realworldqa] | 45.5 | 52.2 | 53.9 |
345
+ | [ReMI][remi] | 27.3 | 38.5 | 44.8 |
346
+ | [AI2D][ai2d] | 63.2 | 75.2 | 79.0 |
347
+ | [ChartQA][chartqa] | 63.6 | 74.7 | 76.3 |
348
+ | [VQAv2][vqav2] | 63.9 | 71.2 | 72.9 |
349
+ | [BLINK][blinkvqa] | 38.0 | 35.9 | 39.6 |
350
+ | [OKVQA][okvqa] | 51.0 | 58.7 | 60.2 |
351
+ | [TallyQA][tallyqa] | 42.5 | 51.8 | 54.3 |
352
+ | [SpatialSense VQA][ss-vqa] | 50.9 | 60.0 | 59.4 |
353
+ | [CountBenchQA][countbenchqa] | 26.1 | 17.8 | 68.0 |
354
+
355
+ [coco-cap]: https://cocodataset.org/#home
356
+ [docvqa]: https://www.docvqa.org/
357
+ [info-vqa]: https://arxiv.org/abs/2104.12756
358
+ [mmmu]: https://arxiv.org/abs/2311.16502
359
+ [textvqa]: https://textvqa.org/
360
+ [realworldqa]: https://paperswithcode.com/dataset/realworldqa
361
+ [remi]: https://arxiv.org/html/2406.09175v1
362
+ [ai2d]: https://allenai.org/data/diagrams
363
+ [chartqa]: https://arxiv.org/abs/2203.10244
364
+ [vqav2]: https://visualqa.org/index.html
365
+ [blinkvqa]: https://arxiv.org/abs/2404.12390
366
+ [okvqa]: https://okvqa.allenai.org/
367
+ [tallyqa]: https://arxiv.org/abs/1810.12440
368
+ [ss-vqa]: https://arxiv.org/abs/1908.02660
369
+ [countbenchqa]: https://github.com/google-research/big_vision/blob/main/big_vision/datasets/countbenchqa/
370
+
371
+ ## Ethics and Safety
372
+
373
+ Ethics and safety evaluation approach and results.
374
+
375
+ ### Evaluation Approach
376
+
377
+ Our evaluation methods include structured evaluations and internal red-teaming
378
+ testing of relevant content policies. Red-teaming was conducted by a number of
379
+ different teams, each with different goals and human evaluation metrics. These
380
+ models were evaluated against a number of different categories relevant to
381
+ ethics and safety, including:
382
+
383
+ - **Child Safety**: Evaluation of text-to-text and image to text prompts
384
+ covering child safety policies, including child sexual abuse and
385
+ exploitation.
386
+ - **Content Safety:** Evaluation of text-to-text and image to text prompts
387
+ covering safety policies including, harassment, violence and gore, and hate
388
+ speech.
389
+ - **Representational Harms**: Evaluation of text-to-text and image to text
390
+ prompts covering safety policies including bias, stereotyping, and harmful
391
+ associations or inaccuracies.
392
+
393
+ In addition to development level evaluations, we conduct "assurance
394
+ evaluations" which are our 'arms-length' internal evaluations for responsibility
395
+ governance decision making. They are conducted separately from the model
396
+ development team, to inform decision making about release. High level findings
397
+ are fed back to the model team, but prompt sets are held-out to prevent
398
+ overfitting and preserve the results' ability to inform decision making.
399
+ Assurance evaluation results are reported to our Responsibility & Safety Council
400
+ as part of release review.
401
+
402
+ ### Evaluation Results
403
+
404
+ For all areas of safety testing, we saw major improvements in the categories of
405
+ child safety, content safety, and representational harms relative to previous
406
+ Gemma models. All testing was conducted without safety filters to evaluate the
407
+ model capabilities and behaviors. For both text-to-text and image-to-text, and
408
+ across all model sizes, the model produced minimal policy violations, and showed
409
+ significant improvements over previous Gemma models' performance with respect
410
+ to ungrounded inferences. A limitation of our evaluations was they included only
411
+ English language prompts.
412
+
413
+ ## Usage and Limitations
414
+
415
+ These models have certain limitations that users should be aware of.
416
+
417
+ ### Intended Usage
418
+
419
+ Open vision-language models (VLMs) models have a wide range of applications
420
+ across various industries and domains. The following list of potential uses is
421
+ not comprehensive. The purpose of this list is to provide contextual information
422
+ about the possible use-cases that the model creators considered as part of model
423
+ training and development.
424
+
425
+ - Content Creation and Communication
426
+ - Text Generation: These models can be used to generate creative text
427
+ formats such as poems, scripts, code, marketing copy, and email drafts.
428
+ - Chatbots and Conversational AI: Power conversational interfaces
429
+ for customer service, virtual assistants, or interactive applications.
430
+ - Text Summarization: Generate concise summaries of a text corpus,
431
+ research papers, or reports.
432
+ - Image Data Extraction: These models can be used to extract,
433
+ interpret, and summarize visual data for text communications.
434
+ - Research and Education
435
+ - Natural Language Processing (NLP) and VLM Research: These
436
+ models can serve as a foundation for researchers to experiment with VLM
437
+ and NLP techniques, develop algorithms, and contribute to the
438
+ advancement of the field.
439
+ - Language Learning Tools: Support interactive language learning
440
+ experiences, aiding in grammar correction or providing writing practice.
441
+ - Knowledge Exploration: Assist researchers in exploring large
442
+ bodies of text by generating summaries or answering questions about
443
+ specific topics.
444
+
445
+ ### Limitations
446
+
447
+ - Training Data
448
+ - The quality and diversity of the training data significantly
449
+ influence the model's capabilities. Biases or gaps in the training data
450
+ can lead to limitations in the model's responses.
451
+ - The scope of the training dataset determines the subject areas
452
+ the model can handle effectively.
453
+ - Context and Task Complexity
454
+ - Models are better at tasks that can be framed with clear
455
+ prompts and instructions. Open-ended or highly complex tasks might be
456
+ challenging.
457
+ - A model's performance can be influenced by the amount of context
458
+ provided (longer context generally leads to better outputs, up to a
459
+ certain point).
460
+ - Language Ambiguity and Nuance
461
+ - Natural language is inherently complex. Models might struggle
462
+ to grasp subtle nuances, sarcasm, or figurative language.
463
+ - Factual Accuracy
464
+ - Models generate responses based on information they learned
465
+ from their training datasets, but they are not knowledge bases. They
466
+ may generate incorrect or outdated factual statements.
467
+ - Common Sense
468
+ - Models rely on statistical patterns in language. They might
469
+ lack the ability to apply common sense reasoning in certain situations.
470
+
471
+ ### Ethical Considerations and Risks
472
+
473
+ The development of vision-language models (VLMs) raises several ethical
474
+ concerns. In creating an open model, we have carefully considered the following:
475
+
476
+ - Bias and Fairness
477
+ - VLMs trained on large-scale, real-world text and image data can
478
+ reflect socio-cultural biases embedded in the training material. These
479
+ models underwent careful scrutiny, input data pre-processing described
480
+ and posterior evaluations reported in this card.
481
+ - Misinformation and Misuse
482
+ - VLMs can be misused to generate text that is false, misleading,
483
+ or harmful.
484
+ - Guidelines are provided for responsible use with the model, see the
485
+ [Responsible Generative AI Toolkit][rai-toolkit].
486
+ - Transparency and Accountability:
487
+ - This model card summarizes details on the models' architecture,
488
+ capabilities, limitations, and evaluation processes.
489
+ - A responsibly developed open model offers the opportunity to
490
+ share innovation by making VLM technology accessible to developers and
491
+ researchers across the AI ecosystem.
492
+
493
+ Risks identified and mitigations:
494
+
495
+ - **Perpetuation of biases**: It's encouraged to perform continuous
496
+ monitoring (using evaluation metrics, human review) and the exploration of
497
+ de-biasing techniques during model training, fine-tuning, and other use
498
+ cases.
499
+ - **Generation of harmful content**: Mechanisms and guidelines for content
500
+ safety are essential. Developers are encouraged to exercise caution and
501
+ implement appropriate content safety safeguards based on their specific
502
+ product policies and application use cases.
503
+ - **Misuse for malicious purposes**: Technical limitations and developer
504
+ and end-user education can help mitigate against malicious applications of
505
+ VLMs. Educational resources and reporting mechanisms for users to flag
506
+ misuse are provided. Prohibited uses of Gemma models are outlined in the
507
+ [Gemma Prohibited Use Policy][prohibited-use].
508
+ - **Privacy violations**: Models were trained on data filtered for removal
509
+ of certain personal information and other sensitive data. Developers are
510
+ encouraged to adhere to privacy regulations with privacy-preserving
511
+ techniques.
512
+
513
+ ### Benefits
514
+
515
+ At the time of release, this family of models provides high-performance open
516
+ vision-language model implementations designed from the ground up for
517
+ responsible AI development compared to similarly sized models.
518
+
519
+ Using the benchmark evaluation metrics described in this document, these models
520
+ have shown to provide superior performance to other, comparably-sized open model
521
+ alternatives.
522
+
523
+ [g3-tech-report]: https://goo.gle/Gemma3Report
524
+ [rai-toolkit]: https://ai.google.dev/responsible
525
+ [kaggle-gemma]: https://www.kaggle.com/models/google/gemma-3
526
+ [vertex-mg-gemma3]: https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/gemma3
527
+ [terms]: https://ai.google.dev/gemma/terms
528
+ [safety-policies]: https://ai.google/static/documents/ai-responsibility-update-published-february-2025.pdf
529
+ [prohibited-use]: https://ai.google.dev/gemma/prohibited_use_policy
530
+ [tpu]: https://cloud.google.com/tpu/docs/intro-to-tpu
531
+ [sustainability]: https://sustainability.google/operating-sustainably/
532
+ [jax]: https://github.com/jax-ml/jax
533
+ [ml-pathways]: https://blog.google/technology/ai/introducing-pathways-next-generation-ai-architecture/
534
+ [sustainability]: https://sustainability.google/operating-sustainably/
535
+ [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.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "chat_template": "{{ bos_token }}\n{%- if messages[0]['role'] == 'system' -%}\n {%- if messages[0]['content'] is string -%}\n {%- set first_user_prefix = messages[0]['content'] + '\n\n' -%}\n {%- else -%}\n {%- set first_user_prefix = messages[0]['content'][0]['text'] + '\n\n' -%}\n {%- endif -%}\n {%- set loop_messages = messages[1:] -%}\n{%- else -%}\n {%- set first_user_prefix = \"\" -%}\n {%- set loop_messages = messages -%}\n{%- endif -%}\n{%- for message in loop_messages -%}\n {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}\n {{ raise_exception(\"Conversation roles must alternate user/assistant/user/assistant/...\") }}\n {%- endif -%}\n {%- if (message['role'] == 'assistant') -%}\n {%- set role = \"model\" -%}\n {%- else -%}\n {%- set role = message['role'] -%}\n {%- endif -%}\n {{ '<start_of_turn>' + role + '\n' + (first_user_prefix if loop.first else \"\") }}\n {%- if message['content'] is string -%}\n {{ message['content'] | trim }}\n {%- elif message['content'] is iterable -%}\n {%- for item in message['content'] -%}\n {%- if item['type'] == 'image' -%}\n {{ '<start_of_image>' }}\n {%- elif item['type'] == 'text' -%}\n {{ item['text'] | trim }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{ raise_exception(\"Invalid content type\") }}\n {%- endif -%}\n {{ '<end_of_turn>\n' }}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n {{'<start_of_turn>model\n'}}\n{%- endif -%}\n"
3
+ }
config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma3ForConditionalGeneration"
4
+ ],
5
+ "boi_token_index": 255999,
6
+ "eoi_token_index": 256000,
7
+ "eos_token_id": [
8
+ 1,
9
+ 106
10
+ ],
11
+ "image_token_index": 262144,
12
+ "initializer_range": 0.02,
13
+ "mm_tokens_per_image": 256,
14
+ "model_type": "gemma3",
15
+ "text_config": {
16
+ "head_dim": 128,
17
+ "hidden_size": 5376,
18
+ "intermediate_size": 21504,
19
+ "model_type": "gemma3_text",
20
+ "num_attention_heads": 32,
21
+ "num_hidden_layers": 62,
22
+ "num_key_value_heads": 16,
23
+ "query_pre_attn_scalar": 168,
24
+ "rope_scaling": {
25
+ "factor": 8.0,
26
+ "rope_type": "linear"
27
+ },
28
+ "sliding_window": 1024
29
+ },
30
+ "torch_dtype": "bfloat16",
31
+ "transformers_version": "4.50.0.dev0",
32
+ "vision_config": {
33
+ "hidden_size": 1152,
34
+ "image_size": 896,
35
+ "intermediate_size": 4304,
36
+ "model_type": "siglip_vision_model",
37
+ "num_attention_heads": 16,
38
+ "num_hidden_layers": 27,
39
+ "patch_size": 14,
40
+ "vision_use_head": false
41
+ }
42
+ }
generation_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 2,
4
+ "cache_implementation": "hybrid",
5
+ "eos_token_id": [
6
+ 1,
7
+ 106
8
+ ],
9
+ "pad_token_id": 0,
10
+ "transformers_version": "4.50.0.dev0"
11
+ }
model-00001-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4da0290139f018bdea488b556c136d0f0ca4506fe5f5555cd97c0f6f2e886add
3
+ size 4854573696
model-00002-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf17dbadf9c7cd696e4768639601c3300ea659e49f018000956078cefd475cdf
3
+ size 4954792944
model-00003-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c12b9d629d07b4583e19a467713f92b5c1ae8c9d7ef11faf1bdb91c4c7b59efc
3
+ size 4954792976
model-00004-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7171ed512e46c90cb579a58f66851bad09b028220422ceb1ae85080ab4ffb958
3
+ size 4954793016
model-00005-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9fb9667695749e55d808f407d78f18f80bd8ff999175c2c480cad7075ff5b2cf
3
+ size 4954793016
model-00006-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:91ae339063266e0c12da89af8aa0cfdb3f9dc9bb1b4b2678863793a28026dbe7
3
+ size 4954793016
model-00007-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0497dda2b32df5d583caaffae35a96f3524a1e4305b850f4b1ce2e60fc354fe4
3
+ size 4954793016
model-00008-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9061b71b9cc82e187bd72c8f4594c5c1d900b0bc98c416d72902209514cf8ac4
3
+ size 4954793016
model-00009-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ebf2e19c3385d4b342e1517639293fe093ad793f41895862713e38603635c769
3
+ size 4954793016
model-00010-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d651ceb24678d80796a36f9a026f7178631b44e9d86f6f87e52093d915f702ad
3
+ size 4954793016
model-00011-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a2de7fa772158381c7569a5699cadb9da3b06d92b802f54ac1c09f4a2c2e594
3
+ size 4954793016
model-00012-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61f4d0c537a889d474396c6fb21ebb90946a64d70345403d47627ecb559e8e91
3
+ size 462476696
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_convert_rgb": null,
3
+ "do_normalize": true,
4
+ "do_pan_and_scan": null,
5
+ "do_rescale": true,
6
+ "do_resize": true,
7
+ "image_mean": [
8
+ 0.5,
9
+ 0.5,
10
+ 0.5
11
+ ],
12
+ "image_processor_type": "Gemma3ImageProcessor",
13
+ "image_seq_length": 256,
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "pan_and_scan_max_num_crops": null,
20
+ "pan_and_scan_min_crop_size": null,
21
+ "pan_and_scan_min_ratio_to_activate": null,
22
+ "processor_class": "Gemma3Processor",
23
+ "resample": 2,
24
+ "rescale_factor": 0.00392156862745098,
25
+ "size": {
26
+ "height": 896,
27
+ "width": 896
28
+ }
29
+ }
processor_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "image_seq_length": 256,
3
+ "processor_class": "Gemma3Processor"
4
+ }
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": "<eos>",
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