RichardErkhov commited on
Commit
a0b57ec
·
verified ·
1 Parent(s): cccffbc

uploaded readme

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