RichardErkhov commited on
Commit
49b153d
·
verified ·
1 Parent(s): c540d85

uploaded readme

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