danielhanchen commited on
Commit
fcf5ba0
·
verified ·
1 Parent(s): b4db3b2

Add files using upload-large-folder tool

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