RichardErkhov commited on
Commit
c70cd5e
·
verified ·
1 Parent(s): 2941a53

uploaded readme

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