RichardErkhov commited on
Commit
e188b33
1 Parent(s): aa300f0

uploaded readme

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