RichardErkhov commited on
Commit
93ba3ed
1 Parent(s): 008d1a4

uploaded readme

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