RichardErkhov commited on
Commit
f690e6d
·
verified ·
1 Parent(s): 4fd0c53

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +608 -0
README.md ADDED
@@ -0,0 +1,608 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ google-gemma-2-9b-it - GGUF
11
+ - Model creator: https://huggingface.co/SillyTilly/
12
+ - Original model: https://huggingface.co/SillyTilly/google-gemma-2-9b-it/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [google-gemma-2-9b-it.Q2_K.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q2_K.gguf) | Q2_K | 3.54GB |
18
+ | [google-gemma-2-9b-it.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.IQ3_XS.gguf) | IQ3_XS | 3.86GB |
19
+ | [google-gemma-2-9b-it.IQ3_S.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.IQ3_S.gguf) | IQ3_S | 4.04GB |
20
+ | [google-gemma-2-9b-it.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q3_K_S.gguf) | Q3_K_S | 4.04GB |
21
+ | [google-gemma-2-9b-it.IQ3_M.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.IQ3_M.gguf) | IQ3_M | 4.19GB |
22
+ | [google-gemma-2-9b-it.Q3_K.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q3_K.gguf) | Q3_K | 4.43GB |
23
+ | [google-gemma-2-9b-it.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q3_K_M.gguf) | Q3_K_M | 4.43GB |
24
+ | [google-gemma-2-9b-it.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q3_K_L.gguf) | Q3_K_L | 4.78GB |
25
+ | [google-gemma-2-9b-it.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.IQ4_XS.gguf) | IQ4_XS | 4.86GB |
26
+ | [google-gemma-2-9b-it.Q4_0.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q4_0.gguf) | Q4_0 | 5.07GB |
27
+ | [google-gemma-2-9b-it.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.IQ4_NL.gguf) | IQ4_NL | 5.1GB |
28
+ | [google-gemma-2-9b-it.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q4_K_S.gguf) | Q4_K_S | 5.1GB |
29
+ | [google-gemma-2-9b-it.Q4_K.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q4_K.gguf) | Q4_K | 5.37GB |
30
+ | [google-gemma-2-9b-it.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q4_K_M.gguf) | Q4_K_M | 5.37GB |
31
+ | [google-gemma-2-9b-it.Q4_1.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q4_1.gguf) | Q4_1 | 5.55GB |
32
+ | [google-gemma-2-9b-it.Q5_0.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q5_0.gguf) | Q5_0 | 6.04GB |
33
+ | [google-gemma-2-9b-it.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q5_K_S.gguf) | Q5_K_S | 6.04GB |
34
+ | [google-gemma-2-9b-it.Q5_K.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q5_K.gguf) | Q5_K | 6.19GB |
35
+ | [google-gemma-2-9b-it.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q5_K_M.gguf) | Q5_K_M | 6.19GB |
36
+ | [google-gemma-2-9b-it.Q5_1.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q5_1.gguf) | Q5_1 | 6.52GB |
37
+ | [google-gemma-2-9b-it.Q6_K.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q6_K.gguf) | Q6_K | 7.07GB |
38
+ | [google-gemma-2-9b-it.Q8_0.gguf](https://huggingface.co/RichardErkhov/SillyTilly_-_google-gemma-2-9b-it-gguf/blob/main/google-gemma-2-9b-it.Q8_0.gguf) | Q8_0 | 9.15GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ license: gemma
46
+ library_name: transformers
47
+ pipeline_tag: text-generation
48
+ extra_gated_heading: Access Gemma on Hugging Face
49
+ extra_gated_prompt: >-
50
+ To access Gemma on Hugging Face, you’re required to review and agree to
51
+ Google’s usage license. To do this, please ensure you’re logged in to Hugging
52
+ Face and click below. Requests are processed immediately.
53
+ extra_gated_button_content: Acknowledge license
54
+ tags:
55
+ - conversational
56
+ ---
57
+
58
+
59
+ # Gemma 2 model card
60
+
61
+ **Model Page**: [Gemma](https://ai.google.dev/gemma/docs)
62
+
63
+ **Resources and Technical Documentation**:
64
+
65
+ * [Responsible Generative AI Toolkit][rai-toolkit]
66
+ * [Gemma on Kaggle][kaggle-gemma]
67
+ * [Gemma on Vertex Model Garden][vertex-mg-gemma]
68
+
69
+ **Terms of Use**: [Terms](https://www.kaggle.com/models/google/gemma/license/consent/verify/huggingface?returnModelRepoId=google/gemma-2-9b-it)
70
+
71
+ **Authors**: Google
72
+
73
+ ## Model Information
74
+
75
+ Summary description and brief definition of inputs and outputs.
76
+
77
+ ### Description
78
+
79
+ Gemma is a family of lightweight, state-of-the-art open models from Google,
80
+ built from the same research and technology used to create the Gemini models.
81
+ They are text-to-text, decoder-only large language models, available in English,
82
+ with open weights for both pre-trained variants and instruction-tuned variants.
83
+ Gemma models are well-suited for a variety of text generation tasks, including
84
+ question answering, summarization, and reasoning. Their relatively small size
85
+ makes it possible to deploy them in environments with limited resources such as
86
+ a laptop, desktop or your own cloud infrastructure, democratizing access to
87
+ state of the art AI models and helping foster innovation for everyone.
88
+
89
+ ### Usage
90
+
91
+ Below we share some code snippets on how to get quickly started with running the model. First make sure to `pip install -U transformers`, then copy the snippet from the section that is relevant for your usecase.
92
+
93
+
94
+ #### Running the model on a single / multi GPU
95
+
96
+
97
+ ```python
98
+ # pip install accelerate
99
+ from transformers import AutoTokenizer, AutoModelForCausalLM
100
+ import torch
101
+
102
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b-it")
103
+ model = AutoModelForCausalLM.from_pretrained(
104
+ "google/gemma-2-9b-it",
105
+ device_map="auto",
106
+ torch_dtype=torch.bfloat16
107
+ )
108
+
109
+ input_text = "Write me a poem about Machine Learning."
110
+ input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
111
+
112
+ outputs = model.generate(**input_ids)
113
+ print(tokenizer.decode(outputs[0]))
114
+ ```
115
+
116
+ <a name="precisions"></a>
117
+ #### Running the model on a GPU using different precisions
118
+
119
+ The native weights of this model were exported in `bfloat16` precision. You can use `float16`, which may be faster on certain hardware, indicating the `torch_dtype` when loading the model. For convenience, the `float16` revision of the repo contains a copy of the weights already converted to that precision.
120
+
121
+ You can also use `float32` if you skip the dtype, but no precision increase will occur (model weights will just be upcasted to `float32`). See examples below.
122
+
123
+ * _Using `torch.float16`_
124
+
125
+ ```python
126
+ # pip install accelerate
127
+ from transformers import AutoTokenizer, AutoModelForCausalLM
128
+ import torch
129
+
130
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b-it")
131
+ model = AutoModelForCausalLM.from_pretrained(
132
+ "google/gemma-2-9b-it",
133
+ device_map="auto",
134
+ torch_dtype=torch.float16,
135
+ revision="float16",
136
+ )
137
+
138
+ input_text = "Write me a poem about Machine Learning."
139
+ input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
140
+
141
+ outputs = model.generate(**input_ids)
142
+ print(tokenizer.decode(outputs[0]))
143
+ ```
144
+
145
+ * _Using `torch.bfloat16`_
146
+
147
+ ```python
148
+ # pip install accelerate
149
+ from transformers import AutoTokenizer, AutoModelForCausalLM
150
+
151
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b-it")
152
+ model = AutoModelForCausalLM.from_pretrained(
153
+ "google/gemma-2-9b-it",
154
+ device_map="auto",
155
+ torch_dtype=torch.bfloat16)
156
+
157
+ input_text = "Write me a poem about Machine Learning."
158
+ input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
159
+
160
+ outputs = model.generate(**input_ids)
161
+ print(tokenizer.decode(outputs[0]))
162
+ ```
163
+
164
+ * _Upcasting to `torch.float32`_
165
+
166
+ ```python
167
+ # pip install accelerate
168
+ from transformers import AutoTokenizer, AutoModelForCausalLM
169
+
170
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b-it")
171
+ model = AutoModelForCausalLM.from_pretrained(
172
+ "google/gemma-2-9b-it",
173
+ device_map="auto")
174
+
175
+ input_text = "Write me a poem about Machine Learning."
176
+ input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
177
+
178
+ outputs = model.generate(**input_ids)
179
+ print(tokenizer.decode(outputs[0]))
180
+ ```
181
+
182
+ #### Quantized Versions through `bitsandbytes`
183
+
184
+ * _Using 8-bit precision (int8)_
185
+
186
+ ```python
187
+ # pip install bitsandbytes accelerate
188
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
189
+
190
+ quantization_config = BitsAndBytesConfig(load_in_8bit=True)
191
+
192
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b-it")
193
+ model = AutoModelForCausalLM.from_pretrained(
194
+ "google/gemma-2-9b-it",
195
+ quantization_config=quantization_config)
196
+
197
+ input_text = "Write me a poem about Machine Learning."
198
+ input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
199
+
200
+ outputs = model.generate(**input_ids)
201
+ print(tokenizer.decode(outputs[0]))
202
+ ```
203
+
204
+ * _Using 4-bit precision_
205
+
206
+ ```python
207
+ # pip install bitsandbytes accelerate
208
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
209
+
210
+ quantization_config = BitsAndBytesConfig(load_in_4bit=True)
211
+
212
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b-it")
213
+ model = AutoModelForCausalLM.from_pretrained(
214
+ "google/gemma-2-9b-it",
215
+ quantization_config=quantization_config)
216
+
217
+ input_text = "Write me a poem about Machine Learning."
218
+ input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
219
+
220
+ outputs = model.generate(**input_ids)
221
+ print(tokenizer.decode(outputs[0]))
222
+ ```
223
+
224
+
225
+ #### Other optimizations
226
+
227
+ * _Flash Attention 2_
228
+
229
+ First make sure to install `flash-attn` in your environment `pip install flash-attn`
230
+
231
+ ```diff
232
+ model = AutoModelForCausalLM.from_pretrained(
233
+ model_id,
234
+ torch_dtype=torch.float16,
235
+ + attn_implementation="flash_attention_2"
236
+ ).to(0)
237
+ ```
238
+
239
+ ### Chat Template
240
+
241
+ The instruction-tuned models use a chat template that must be adhered to for conversational use.
242
+ The easiest way to apply it is using the tokenizer's built-in chat template, as shown in the following snippet.
243
+
244
+ Let's load the model and apply the chat template to a conversation. In this example, we'll start with a single user interaction:
245
+
246
+ ```py
247
+ from transformers import AutoTokenizer, AutoModelForCausalLM
248
+ import transformers
249
+ import torch
250
+
251
+ model_id = "google/gemma-2-9b-it"
252
+ dtype = torch.bfloat16
253
+
254
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
255
+ model = AutoModelForCausalLM.from_pretrained(
256
+ model_id,
257
+ device_map="cuda",
258
+ torch_dtype=dtype,)
259
+
260
+ chat = [
261
+ { "role": "user", "content": "Write a hello world program" },
262
+ ]
263
+ prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
264
+ ```
265
+
266
+ At this point, the prompt contains the following text:
267
+
268
+ ```
269
+ <bos><start_of_turn>user
270
+ Write a hello world program<end_of_turn>
271
+ <start_of_turn>model
272
+ ```
273
+
274
+ As you can see, each turn is preceded by a `<start_of_turn>` delimiter and then the role of the entity
275
+ (either `user`, for content supplied by the user, or `model` for LLM responses). Turns finish with
276
+ the `<end_of_turn>` token.
277
+
278
+ You can follow this format to build the prompt manually, if you need to do it without the tokenizer's
279
+ chat template.
280
+
281
+ After the prompt is ready, generation can be performed like this:
282
+
283
+ ```py
284
+ inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
285
+ outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=150)
286
+ print(tokenizer.decode(outputs[0]))
287
+ ```
288
+
289
+ ### Inputs and outputs
290
+
291
+ * **Input:** Text string, such as a question, a prompt, or a document to be
292
+ summarized.
293
+ * **Output:** Generated English-language text in response to the input, such
294
+ as an answer to a question, or a summary of a document.
295
+
296
+ ### Citation
297
+
298
+ ```none
299
+ @article{gemma_2024,
300
+ title={Gemma},
301
+ url={https://www.kaggle.com/m/3301},
302
+ DOI={10.34740/KAGGLE/M/3301},
303
+ publisher={Kaggle},
304
+ author={Gemma Team},
305
+ year={2024}
306
+ }
307
+ ```
308
+
309
+ ## Model Data
310
+
311
+ Data used for model training and how the data was processed.
312
+
313
+ ### Training Dataset
314
+
315
+ These models were trained on a dataset of text data that includes a wide variety of sources. The 27B model was trained with 13 trillion tokens and the 9B model was trained with 8 trillion tokens.
316
+ Here are the key components:
317
+
318
+ * Web Documents: A diverse collection of web text ensures the model is exposed
319
+ to a broad range of linguistic styles, topics, and vocabulary. Primarily
320
+ English-language content.
321
+ * Code: Exposing the model to code helps it to learn the syntax and patterns of
322
+ programming languages, which improves its ability to generate code or
323
+ understand code-related questions.
324
+ * Mathematics: Training on mathematical text helps the model learn logical
325
+ reasoning, symbolic representation, and to address mathematical queries.
326
+
327
+ The combination of these diverse data sources is crucial for training a powerful
328
+ language model that can handle a wide variety of different tasks and text
329
+ formats.
330
+
331
+ ### Data Preprocessing
332
+
333
+ Here are the key data cleaning and filtering methods applied to the training
334
+ data:
335
+
336
+ * CSAM Filtering: Rigorous CSAM (Child Sexual Abuse Material) filtering was
337
+ applied at multiple stages in the data preparation process to ensure the
338
+ exclusion of harmful and illegal content.
339
+ * Sensitive Data Filtering: As part of making Gemma pre-trained models safe and
340
+ reliable, automated techniques were used to filter out certain personal
341
+ information and other sensitive data from training sets.
342
+ * Additional methods: Filtering based on content quality and safety in line with
343
+ [our policies][safety-policies].
344
+
345
+ ## Implementation Information
346
+
347
+ Details about the model internals.
348
+
349
+ ### Hardware
350
+
351
+ Gemma was trained using the latest generation of
352
+ [Tensor Processing Unit (TPU)][tpu] hardware (TPUv5p).
353
+
354
+ Training large language models requires significant computational power. TPUs,
355
+ designed specifically for matrix operations common in machine learning, offer
356
+ several advantages in this domain:
357
+
358
+ * Performance: TPUs are specifically designed to handle the massive computations
359
+ involved in training LLMs. They can speed up training considerably compared to
360
+ CPUs.
361
+ * Memory: TPUs often come with large amounts of high-bandwidth memory, allowing
362
+ for the handling of large models and batch sizes during training. This can
363
+ lead to better model quality.
364
+ * Scalability: TPU Pods (large clusters of TPUs) provide a scalable solution for
365
+ handling the growing complexity of large foundation models. You can distribute
366
+ training across multiple TPU devices for faster and more efficient processing.
367
+ * Cost-effectiveness: In many scenarios, TPUs can provide a more cost-effective
368
+ solution for training large models compared to CPU-based infrastructure,
369
+ especially when considering the time and resources saved due to faster
370
+ training.
371
+ * These advantages are aligned with
372
+ [Google's commitments to operate sustainably][sustainability].
373
+
374
+ ### Software
375
+
376
+ Training was done using [JAX][jax] and [ML Pathways][ml-pathways].
377
+
378
+ JAX allows researchers to take advantage of the latest generation of hardware,
379
+ including TPUs, for faster and more efficient training of large models.
380
+
381
+ ML Pathways is Google's latest effort to build artificially intelligent systems
382
+ capable of generalizing across multiple tasks. This is specially suitable for
383
+ [foundation models][foundation-models], including large language models like
384
+ these ones.
385
+
386
+ Together, JAX and ML Pathways are used as described in the
387
+ [paper about the Gemini family of models][gemini-2-paper]; "the 'single
388
+ controller' programming model of Jax and Pathways allows a single Python
389
+ process to orchestrate the entire training run, dramatically simplifying the
390
+ development workflow."
391
+
392
+ ## Evaluation
393
+
394
+ Model evaluation metrics and results.
395
+
396
+ ### Benchmark Results
397
+
398
+ These models were evaluated against a large collection of different datasets and
399
+ metrics to cover different aspects of text generation:
400
+
401
+ | Benchmark | Metric | Gemma PT 9B | Gemma PT 27B |
402
+ | ------------------------------ | ------------- | ----------- | ------------ |
403
+ | [MMLU][mmlu] | 5-shot, top-1 | 71.3 | 75.2 |
404
+ | [HellaSwag][hellaswag] | 10-shot | 81.9 | 86.4 |
405
+ | [PIQA][piqa] | 0-shot | 81.7 | 83.2 |
406
+ | [SocialIQA][socialiqa] | 0-shot | 53.4 | 53.7 |
407
+ | [BoolQ][boolq] | 0-shot | 84.2 | 84.8 |
408
+ | [WinoGrande][winogrande] | partial score | 80.6 | 83.7 |
409
+ | [ARC-e][arc] | 0-shot | 88.0 | 88.6 |
410
+ | [ARC-c][arc] | 25-shot | 68.4 | 71.4 |
411
+ | [TriviaQA][triviaqa] | 5-shot | 76.6 | 83.7 |
412
+ | [Natural Questions][naturalq] | 5-shot | 29.2 | 34.5 |
413
+ | [HumanEval][humaneval] | pass@1 | 40.2 | 51.8 |
414
+ | [MBPP][mbpp] | 3-shot | 52.4 | 62.6 |
415
+ | [GSM8K][gsm8k] | 5-shot, maj@1 | 68.6 | 74.0 |
416
+ | [MATH][math] | 4-shot | 36.6 | 42.3 |
417
+ | [AGIEval][agieval] | 3-5-shot | 52.8 | 55.1 |
418
+ | [BIG-Bench][big-bench] | 3-shot, CoT | 68.2 | 74.9 |
419
+ | ------------------------------ | ------------- | ----------- | ------------ |
420
+
421
+ ## Ethics and Safety
422
+
423
+ Ethics and safety evaluation approach and results.
424
+
425
+ ### Evaluation Approach
426
+
427
+ Our evaluation methods include structured evaluations and internal red-teaming
428
+ testing of relevant content policies. Red-teaming was conducted by a number of
429
+ different teams, each with different goals and human evaluation metrics. These
430
+ models were evaluated against a number of different categories relevant to
431
+ ethics and safety, including:
432
+
433
+ * Text-to-Text Content Safety: Human evaluation on prompts covering safety
434
+ policies including child sexual abuse and exploitation, harassment, violence
435
+ and gore, and hate speech.
436
+ * Text-to-Text Representational Harms: Benchmark against relevant academic
437
+ datasets such as [WinoBias][winobias] and [BBQ Dataset][bbq].
438
+ * Memorization: Automated evaluation of memorization of training data, including
439
+ the risk of personally identifiable information exposure.
440
+ * Large-scale harm: Tests for "dangerous capabilities," such as chemical,
441
+ biological, radiological, and nuclear (CBRN) risks.
442
+
443
+ ### Evaluation Results
444
+
445
+ The results of ethics and safety evaluations are within acceptable thresholds
446
+ for meeting [internal policies][safety-policies] for categories such as child
447
+ safety, content safety, representational harms, memorization, large-scale harms.
448
+ On top of robust internal evaluations, the results of well-known safety
449
+ benchmarks like BBQ, BOLD, Winogender, Winobias, RealToxicity, and TruthfulQA
450
+ are shown here.
451
+
452
+ #### Gemma 2.0
453
+
454
+ | Benchmark | Metric | Gemma 2 IT 9B | Gemma 2 IT 27B |
455
+ | ------------------------ | ------------- | --------------- | ---------------- |
456
+ | [RealToxicity][realtox] | average | 8.25 | 8.84 |
457
+ | [CrowS-Pairs][crows] | top-1 | 37.47 | 36.67 |
458
+ | [BBQ Ambig][bbq] | 1-shot, top-1 | 88.58 | 85.99 |
459
+ | [BBQ Disambig][bbq] | top-1 | 82.67 | 86.94 |
460
+ | [Winogender][winogender] | top-1 | 79.17 | 77.22 |
461
+ | [TruthfulQA][truthfulqa] | | 50.27 | 51.60 |
462
+ | [Winobias 1_2][winobias] | | 78.09 | 81.94 |
463
+ | [Winobias 2_2][winobias] | | 95.32 | 97.22 |
464
+ | [Toxigen][toxigen] | | 39.30 | 38.42 |
465
+ | ------------------------ | ------------- | --------------- | ---------------- |
466
+
467
+ ## Usage and Limitations
468
+
469
+ These models have certain limitations that users should be aware of.
470
+
471
+ ### Intended Usage
472
+
473
+ Open Large Language Models (LLMs) have a wide range of applications across
474
+ various industries and domains. The following list of potential uses is not
475
+ comprehensive. The purpose of this list is to provide contextual information
476
+ about the possible use-cases that the model creators considered as part of model
477
+ training and development.
478
+
479
+ * Content Creation and Communication
480
+ * Text Generation: These models can be used to generate creative text formats
481
+ such as poems, scripts, code, marketing copy, and email drafts.
482
+ * Chatbots and Conversational AI: Power conversational interfaces for customer
483
+ service, virtual assistants, or interactive applications.
484
+ * Text Summarization: Generate concise summaries of a text corpus, research
485
+ papers, or reports.
486
+ * Research and Education
487
+ * Natural Language Processing (NLP) Research: These models can serve as a
488
+ foundation for researchers to experiment with NLP techniques, develop
489
+ algorithms, and contribute to the advancement of the field.
490
+ * Language Learning Tools: Support interactive language learning experiences,
491
+ aiding in grammar correction or providing writing practice.
492
+ * Knowledge Exploration: Assist researchers in exploring large bodies of text
493
+ by generating summaries or answering questions about specific topics.
494
+
495
+ ### Limitations
496
+
497
+ * Training Data
498
+ * The quality and diversity of the training data significantly influence the
499
+ model's capabilities. Biases or gaps in the training data can lead to
500
+ limitations in the model's responses.
501
+ * The scope of the training dataset determines the subject areas the model can
502
+ handle effectively.
503
+ * Context and Task Complexity
504
+ * LLMs are better at tasks that can be framed with clear prompts and
505
+ instructions. Open-ended or highly complex tasks might be challenging.
506
+ * A model's performance can be influenced by the amount of context provided
507
+ (longer context generally leads to better outputs, up to a certain point).
508
+ * Language Ambiguity and Nuance
509
+ * Natural language is inherently complex. LLMs might struggle to grasp subtle
510
+ nuances, sarcasm, or figurative language.
511
+ * Factual Accuracy
512
+ * LLMs generate responses based on information they learned from their
513
+ training datasets, but they are not knowledge bases. They may generate
514
+ incorrect or outdated factual statements.
515
+ * Common Sense
516
+ * LLMs rely on statistical patterns in language. They might lack the ability
517
+ to apply common sense reasoning in certain situations.
518
+
519
+ ### Ethical Considerations and Risks
520
+
521
+ The development of large language models (LLMs) raises several ethical concerns.
522
+ In creating an open model, we have carefully considered the following:
523
+
524
+ * Bias and Fairness
525
+ * LLMs trained on large-scale, real-world text data can reflect socio-cultural
526
+ biases embedded in the training material. These models underwent careful
527
+ scrutiny, input data pre-processing described and posterior evaluations
528
+ reported in this card.
529
+ * Misinformation and Misuse
530
+ * LLMs can be misused to generate text that is false, misleading, or harmful.
531
+ * Guidelines are provided for responsible use with the model, see the
532
+ [Responsible Generative AI Toolkit][rai-toolkit].
533
+ * Transparency and Accountability:
534
+ * This model card summarizes details on the models' architecture,
535
+ capabilities, limitations, and evaluation processes.
536
+ * A responsibly developed open model offers the opportunity to share
537
+ innovation by making LLM technology accessible to developers and researchers
538
+ across the AI ecosystem.
539
+
540
+ Risks identified and mitigations:
541
+
542
+ * Perpetuation of biases: It's encouraged to perform continuous monitoring
543
+ (using evaluation metrics, human review) and the exploration of de-biasing
544
+ techniques during model training, fine-tuning, and other use cases.
545
+ * Generation of harmful content: Mechanisms and guidelines for content safety
546
+ are essential. Developers are encouraged to exercise caution and implement
547
+ appropriate content safety safeguards based on their specific product policies
548
+ and application use cases.
549
+ * Misuse for malicious purposes: Technical limitations and developer and
550
+ end-user education can help mitigate against malicious applications of LLMs.
551
+ Educational resources and reporting mechanisms for users to flag misuse are
552
+ provided. Prohibited uses of Gemma models are outlined in the
553
+ [Gemma Prohibited Use Policy][prohibited-use].
554
+ * Privacy violations: Models were trained on data filtered for removal of PII
555
+ (Personally Identifiable Information). Developers are encouraged to adhere to
556
+ privacy regulations with privacy-preserving techniques.
557
+
558
+ ### Benefits
559
+
560
+ At the time of release, this family of models provides high-performance open
561
+ large language model implementations designed from the ground up for Responsible
562
+ AI development compared to similarly sized models.
563
+
564
+ Using the benchmark evaluation metrics described in this document, these models
565
+ have shown to provide superior performance to other, comparably-sized open model
566
+ alternatives.
567
+
568
+ [rai-toolkit]: https://ai.google.dev/responsible
569
+ [kaggle-gemma]: https://www.kaggle.com/models/google/gemma-2
570
+ [terms]: https://ai.google.dev/gemma/terms
571
+ [vertex-mg-gemma]: https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/335
572
+ [sensitive-info]: https://cloud.google.com/dlp/docs/high-sensitivity-infotypes-reference
573
+ [safety-policies]: https://storage.googleapis.com/gweb-uniblog-publish-prod/documents/2023_Google_AI_Principles_Progress_Update.pdf#page=11
574
+ [prohibited-use]: https://ai.google.dev/gemma/prohibited_use_policy
575
+ [tpu]: https://cloud.google.com/tpu/docs/intro-to-tpu
576
+ [sustainability]: https://sustainability.google/operating-sustainably/
577
+ [jax]: https://github.com/google/jax
578
+ [ml-pathways]: https://blog.google/technology/ai/introducing-pathways-next-generation-ai-architecture/
579
+ [sustainability]: https://sustainability.google/operating-sustainably/
580
+ [foundation-models]: https://ai.google/discover/foundation-models/
581
+ [gemini-2-paper]: https://goo.gle/gemma2report
582
+ [mmlu]: https://arxiv.org/abs/2009.03300
583
+ [hellaswag]: https://arxiv.org/abs/1905.07830
584
+ [piqa]: https://arxiv.org/abs/1911.11641
585
+ [socialiqa]: https://arxiv.org/abs/1904.09728
586
+ [boolq]: https://arxiv.org/abs/1905.10044
587
+ [winogrande]: https://arxiv.org/abs/1907.10641
588
+ [commonsenseqa]: https://arxiv.org/abs/1811.00937
589
+ [openbookqa]: https://arxiv.org/abs/1809.02789
590
+ [arc]: https://arxiv.org/abs/1911.01547
591
+ [triviaqa]: https://arxiv.org/abs/1705.03551
592
+ [naturalq]: https://github.com/google-research-datasets/natural-questions
593
+ [humaneval]: https://arxiv.org/abs/2107.03374
594
+ [mbpp]: https://arxiv.org/abs/2108.07732
595
+ [gsm8k]: https://arxiv.org/abs/2110.14168
596
+ [realtox]: https://arxiv.org/abs/2009.11462
597
+ [bold]: https://arxiv.org/abs/2101.11718
598
+ [crows]: https://aclanthology.org/2020.emnlp-main.154/
599
+ [bbq]: https://arxiv.org/abs/2110.08193v2
600
+ [winogender]: https://arxiv.org/abs/1804.09301
601
+ [truthfulqa]: https://arxiv.org/abs/2109.07958
602
+ [winobias]: https://arxiv.org/abs/1804.06876
603
+ [math]: https://arxiv.org/abs/2103.03874
604
+ [agieval]: https://arxiv.org/abs/2304.06364
605
+ [big-bench]: https://arxiv.org/abs/2206.04615
606
+ [toxigen]: https://arxiv.org/abs/2203.09509
607
+
608
+