RichardErkhov commited on
Commit
7bb10ac
1 Parent(s): 38e569d

uploaded readme

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