RichardErkhov commited on
Commit
07a43c1
·
verified ·
1 Parent(s): 4c88f3f

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +577 -0
README.md ADDED
@@ -0,0 +1,577 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-2-9b - GGUF
11
+ - Model creator: https://huggingface.co/google/
12
+ - Original model: https://huggingface.co/google/gemma-2-9b/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [gemma-2-9b.Q2_K.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q2_K.gguf) | Q2_K | 3.54GB |
18
+ | [gemma-2-9b.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.IQ3_XS.gguf) | IQ3_XS | 3.86GB |
19
+ | [gemma-2-9b.IQ3_S.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.IQ3_S.gguf) | IQ3_S | 4.04GB |
20
+ | [gemma-2-9b.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q3_K_S.gguf) | Q3_K_S | 4.04GB |
21
+ | [gemma-2-9b.IQ3_M.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.IQ3_M.gguf) | IQ3_M | 4.19GB |
22
+ | [gemma-2-9b.Q3_K.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q3_K.gguf) | Q3_K | 4.43GB |
23
+ | [gemma-2-9b.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q3_K_M.gguf) | Q3_K_M | 4.43GB |
24
+ | [gemma-2-9b.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q3_K_L.gguf) | Q3_K_L | 4.78GB |
25
+ | [gemma-2-9b.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.IQ4_XS.gguf) | IQ4_XS | 4.86GB |
26
+ | [gemma-2-9b.Q4_0.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q4_0.gguf) | Q4_0 | 5.07GB |
27
+ | [gemma-2-9b.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.IQ4_NL.gguf) | IQ4_NL | 5.1GB |
28
+ | [gemma-2-9b.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q4_K_S.gguf) | Q4_K_S | 5.1GB |
29
+ | [gemma-2-9b.Q4_K.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q4_K.gguf) | Q4_K | 5.37GB |
30
+ | [gemma-2-9b.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q4_K_M.gguf) | Q4_K_M | 5.37GB |
31
+ | [gemma-2-9b.Q4_1.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q4_1.gguf) | Q4_1 | 5.55GB |
32
+ | [gemma-2-9b.Q5_0.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q5_0.gguf) | Q5_0 | 6.04GB |
33
+ | [gemma-2-9b.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q5_K_S.gguf) | Q5_K_S | 6.04GB |
34
+ | [gemma-2-9b.Q5_K.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q5_K.gguf) | Q5_K | 6.19GB |
35
+ | [gemma-2-9b.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q5_K_M.gguf) | Q5_K_M | 6.19GB |
36
+ | [gemma-2-9b.Q5_1.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q5_1.gguf) | Q5_1 | 6.52GB |
37
+ | [gemma-2-9b.Q6_K.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q6_K.gguf) | Q6_K | 7.07GB |
38
+ | [gemma-2-9b.Q8_0.gguf](https://huggingface.co/RichardErkhov/google_-_gemma-2-9b-gguf/blob/main/gemma-2-9b.Q8_0.gguf) | Q8_0 | 9.15GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ license: gemma
46
+ library_name: transformers
47
+ pipeline_tag: text-generation
48
+ extra_gated_heading: Access Gemma on Hugging Face
49
+ extra_gated_prompt: >-
50
+ To access Gemma on Hugging Face, you’re required to review and agree to
51
+ Google’s usage license. To do this, please ensure you’re logged in to Hugging
52
+ Face and click below. Requests are processed immediately.
53
+ extra_gated_button_content: Acknowledge license
54
+ ---
55
+
56
+
57
+ # Gemma 2 model card
58
+
59
+ **Model Page**: [Gemma](https://ai.google.dev/gemma/docs)
60
+
61
+ **Resources and Technical Documentation**:
62
+
63
+ * [Responsible Generative AI Toolkit][rai-toolkit]
64
+ * [Gemma on Kaggle][kaggle-gemma]
65
+ * [Gemma on Vertex Model Garden][vertex-mg-gemma]
66
+
67
+ **Terms of Use**: [Terms](https://www.kaggle.com/models/google/gemma/license/consent/verify/huggingface?returnModelRepoId=google/gemma-2-9b)
68
+
69
+ **Authors**: Google
70
+
71
+ ## Model Information
72
+
73
+ Summary description and brief definition of inputs and outputs.
74
+
75
+ ### Description
76
+
77
+ Gemma is a family of lightweight, state-of-the-art open models from Google,
78
+ built from the same research and technology used to create the Gemini models.
79
+ They are text-to-text, decoder-only large language models, available in English,
80
+ with open weights for both pre-trained variants and instruction-tuned variants.
81
+ Gemma models are well-suited for a variety of text generation tasks, including
82
+ question answering, summarization, and reasoning. Their relatively small size
83
+ makes it possible to deploy them in environments with limited resources such as
84
+ a laptop, desktop or your own cloud infrastructure, democratizing access to
85
+ state of the art AI models and helping foster innovation for everyone.
86
+
87
+ ### Usage
88
+
89
+ Below we share some code snippets on how to get quickly started with running the model. First, install the Transformers library with:
90
+ ```sh
91
+ pip install -U transformers
92
+ ```
93
+
94
+ Then, copy the snippet from the section that is relevant for your usecase.
95
+
96
+ #### Running with the `pipeline` API
97
+
98
+ ```python
99
+ import torch
100
+ from transformers import pipeline
101
+
102
+ pipe = pipeline(
103
+ "text-generation",
104
+ model="google/gemma-2-9b",
105
+ device="cuda", # replace with "mps" to run on a Mac device
106
+ )
107
+
108
+ text = "Once upon a time,"
109
+ outputs = pipe(text, max_new_tokens=256)
110
+ response = outputs[0]["generated_text"]
111
+ print(response)
112
+ ```
113
+
114
+ #### Running the model on a single / multi GPU
115
+
116
+ ```python
117
+ # pip install accelerate
118
+ from transformers import AutoTokenizer, AutoModelForCausalLM
119
+ import torch
120
+
121
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
122
+ model = AutoModelForCausalLM.from_pretrained(
123
+ "google/gemma-2-9b",
124
+ device_map="auto",
125
+ )
126
+
127
+ input_text = "Write me a poem about Machine Learning."
128
+ input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
129
+
130
+ outputs = model.generate(**input_ids, max_new_tokens=32)
131
+ print(tokenizer.decode(outputs[0]))
132
+ ```
133
+
134
+ #### Running the model through a CLI
135
+
136
+ The [local-gemma](https://github.com/huggingface/local-gemma) repository contains a lightweight wrapper around Transformers
137
+ for running Gemma 2 through a command line interface, or CLI. Follow the [installation instructions](https://github.com/huggingface/local-gemma#cli-usage)
138
+ for getting started, then launch the CLI through the following command:
139
+
140
+ ```shell
141
+ local-gemma --model "google/gemma-2-9b" --prompt "What is the capital of Mexico?"
142
+ ```
143
+
144
+ #### Quantized Versions through `bitsandbytes`
145
+
146
+ <details>
147
+ <summary>
148
+ Using 8-bit precision (int8)
149
+ </summary>
150
+
151
+ ```python
152
+ # pip install bitsandbytes accelerate
153
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
154
+
155
+ quantization_config = BitsAndBytesConfig(load_in_8bit=True)
156
+
157
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
158
+ model = AutoModelForCausalLM.from_pretrained(
159
+ "google/gemma-2-9b",
160
+ quantization_config=quantization_config,
161
+ )
162
+
163
+ input_text = "Write me a poem about Machine Learning."
164
+ input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
165
+
166
+ outputs = model.generate(**input_ids, max_new_tokens=32)
167
+ print(tokenizer.decode(outputs[0]))
168
+ ```
169
+ </details>
170
+
171
+ <details>
172
+ <summary>
173
+ Using 4-bit precision
174
+ </summary>
175
+
176
+ ```python
177
+ # pip install bitsandbytes accelerate
178
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
179
+
180
+ quantization_config = BitsAndBytesConfig(load_in_4bit=True)
181
+
182
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
183
+ model = AutoModelForCausalLM.from_pretrained(
184
+ "google/gemma-2-9b",
185
+ quantization_config=quantization_config,
186
+ )
187
+
188
+ input_text = "Write me a poem about Machine Learning."
189
+ input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
190
+
191
+ outputs = model.generate(**input_ids, max_new_tokens=32)
192
+ print(tokenizer.decode(outputs[0]))
193
+ ```
194
+ </details>
195
+
196
+ #### Advanced Usage
197
+
198
+ <details>
199
+ <summary>
200
+ Torch compile
201
+ </summary>
202
+
203
+ [Torch compile](https://pytorch.org/tutorials/intermediate/torch_compile_tutorial.html) is a method for speeding-up the
204
+ inference of PyTorch modules. The Gemma-2 model can be run up to 6x faster by leveraging torch compile.
205
+
206
+ Note that two warm-up steps are required before the full inference speed is realised:
207
+
208
+ ```python
209
+ import os
210
+ os.environ["TOKENIZERS_PARALLELISM"] = "false"
211
+
212
+ from transformers import AutoTokenizer, Gemma2ForCausalLM
213
+ from transformers.cache_utils import HybridCache
214
+ import torch
215
+
216
+ torch.set_float32_matmul_precision("high")
217
+
218
+ # load the model + tokenizer
219
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
220
+ model = Gemma2ForCausalLM.from_pretrained("google/gemma-2-9b", torch_dtype=torch.bfloat16)
221
+ model.to("cuda")
222
+
223
+ # apply the torch compile transformation
224
+ model.forward = torch.compile(model.forward, mode="reduce-overhead", fullgraph=True)
225
+
226
+ # pre-process inputs
227
+ input_text = "The theory of special relativity states "
228
+ model_inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
229
+ prompt_length = model_inputs.input_ids.shape[1]
230
+
231
+ # set-up k/v cache
232
+ past_key_values = HybridCache(
233
+ config=model.config,
234
+ max_batch_size=1,
235
+ max_cache_len=model.config.max_position_embeddings,
236
+ device=model.device,
237
+ dtype=model.dtype
238
+ )
239
+
240
+ # enable passing kv cache to generate
241
+ model._supports_cache_class = True
242
+ model.generation_config.cache_implementation = None
243
+
244
+ # two warm-up steps
245
+ for idx in range(2):
246
+ outputs = model.generate(**model_inputs, past_key_values=past_key_values, do_sample=True, temperature=1.0, max_new_tokens=128)
247
+ past_key_values.reset()
248
+
249
+ # fast run
250
+ outputs = model.generate(**model_inputs, past_key_values=past_key_values, do_sample=True, temperature=1.0, max_new_tokens=128)
251
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
252
+ ```
253
+
254
+ For more details, refer to the [Transformers documentation](https://huggingface.co/docs/transformers/main/en/llm_optims?static-kv=basic+usage%3A+generation_config).
255
+
256
+ </details>
257
+
258
+ ### Inputs and outputs
259
+
260
+ * **Input:** Text string, such as a question, a prompt, or a document to be
261
+ summarized.
262
+ * **Output:** Generated English-language text in response to the input, such
263
+ as an answer to a question, or a summary of a document.
264
+
265
+ ### Citation
266
+
267
+ ```none
268
+ @article{gemma_2024,
269
+ title={Gemma},
270
+ url={https://www.kaggle.com/m/3301},
271
+ DOI={10.34740/KAGGLE/M/3301},
272
+ publisher={Kaggle},
273
+ author={Gemma Team},
274
+ year={2024}
275
+ }
276
+ ```
277
+
278
+ ## Model Data
279
+
280
+ Data used for model training and how the data was processed.
281
+
282
+ ### Training Dataset
283
+
284
+ These models were trained on a dataset of text data that includes a wide variety of sources. The 27B model was trained with 13 trillion tokens and the 9B model was trained with 8 trillion tokens.
285
+ Here are the key components:
286
+
287
+ * Web Documents: A diverse collection of web text ensures the model is exposed
288
+ to a broad range of linguistic styles, topics, and vocabulary. Primarily
289
+ English-language content.
290
+ * Code: Exposing the model to code helps it to learn the syntax and patterns of
291
+ programming languages, which improves its ability to generate code or
292
+ understand code-related questions.
293
+ * Mathematics: Training on mathematical text helps the model learn logical
294
+ reasoning, symbolic representation, and to address mathematical queries.
295
+
296
+ The combination of these diverse data sources is crucial for training a powerful
297
+ language model that can handle a wide variety of different tasks and text
298
+ formats.
299
+
300
+ ### Data Preprocessing
301
+
302
+ Here are the key data cleaning and filtering methods applied to the training
303
+ data:
304
+
305
+ * CSAM Filtering: Rigorous CSAM (Child Sexual Abuse Material) filtering was
306
+ applied at multiple stages in the data preparation process to ensure the
307
+ exclusion of harmful and illegal content.
308
+ * Sensitive Data Filtering: As part of making Gemma pre-trained models safe and
309
+ reliable, automated techniques were used to filter out certain personal
310
+ information and other sensitive data from training sets.
311
+ * Additional methods: Filtering based on content quality and safety in line with
312
+ [our policies][safety-policies].
313
+
314
+ ## Implementation Information
315
+
316
+ Details about the model internals.
317
+
318
+ ### Hardware
319
+
320
+ Gemma was trained using the latest generation of
321
+ [Tensor Processing Unit (TPU)][tpu] hardware (TPUv5p).
322
+
323
+ Training large language models requires significant computational power. TPUs,
324
+ designed specifically for matrix operations common in machine learning, offer
325
+ several advantages in this domain:
326
+
327
+ * Performance: TPUs are specifically designed to handle the massive computations
328
+ involved in training LLMs. They can speed up training considerably compared to
329
+ CPUs.
330
+ * Memory: TPUs often come with large amounts of high-bandwidth memory, allowing
331
+ for the handling of large models and batch sizes during training. This can
332
+ lead to better model quality.
333
+ * Scalability: TPU Pods (large clusters of TPUs) provide a scalable solution for
334
+ handling the growing complexity of large foundation models. You can distribute
335
+ training across multiple TPU devices for faster and more efficient processing.
336
+ * Cost-effectiveness: In many scenarios, TPUs can provide a more cost-effective
337
+ solution for training large models compared to CPU-based infrastructure,
338
+ especially when considering the time and resources saved due to faster
339
+ training.
340
+ * These advantages are aligned with
341
+ [Google's commitments to operate sustainably][sustainability].
342
+
343
+ ### Software
344
+
345
+ Training was done using [JAX][jax] and [ML Pathways][ml-pathways].
346
+
347
+ JAX allows researchers to take advantage of the latest generation of hardware,
348
+ including TPUs, for faster and more efficient training of large models.
349
+
350
+ ML Pathways is Google's latest effort to build artificially intelligent systems
351
+ capable of generalizing across multiple tasks. This is specially suitable for
352
+ [foundation models][foundation-models], including large language models like
353
+ these ones.
354
+
355
+ Together, JAX and ML Pathways are used as described in the
356
+ [paper about the Gemini family of models][gemini-2-paper]; "the 'single
357
+ controller' programming model of Jax and Pathways allows a single Python
358
+ process to orchestrate the entire training run, dramatically simplifying the
359
+ development workflow."
360
+
361
+ ## Evaluation
362
+
363
+ Model evaluation metrics and results.
364
+
365
+ ### Benchmark Results
366
+
367
+ These models were evaluated against a large collection of different datasets and
368
+ metrics to cover different aspects of text generation:
369
+
370
+ | Benchmark | Metric | Gemma PT 9B | Gemma PT 27B |
371
+ | ------------------------------ | ------------- | ----------- | ------------ |
372
+ | [MMLU][mmlu] | 5-shot, top-1 | 71.3 | 75.2 |
373
+ | [HellaSwag][hellaswag] | 10-shot | 81.9 | 86.4 |
374
+ | [PIQA][piqa] | 0-shot | 81.7 | 83.2 |
375
+ | [SocialIQA][socialiqa] | 0-shot | 53.4 | 53.7 |
376
+ | [BoolQ][boolq] | 0-shot | 84.2 | 84.8 |
377
+ | [WinoGrande][winogrande] | partial score | 80.6 | 83.7 |
378
+ | [ARC-e][arc] | 0-shot | 88.0 | 88.6 |
379
+ | [ARC-c][arc] | 25-shot | 68.4 | 71.4 |
380
+ | [TriviaQA][triviaqa] | 5-shot | 76.6 | 83.7 |
381
+ | [Natural Questions][naturalq] | 5-shot | 29.2 | 34.5 |
382
+ | [HumanEval][humaneval] | pass@1 | 40.2 | 51.8 |
383
+ | [MBPP][mbpp] | 3-shot | 52.4 | 62.6 |
384
+ | [GSM8K][gsm8k] | 5-shot, maj@1 | 68.6 | 74.0 |
385
+ | [MATH][math] | 4-shot | 36.6 | 42.3 |
386
+ | [AGIEval][agieval] | 3-5-shot | 52.8 | 55.1 |
387
+ | [BIG-Bench][big-bench] | 3-shot, CoT | 68.2 | 74.9 |
388
+ | ------------------------------ | ------------- | ----------- | ------------ |
389
+
390
+ ## Ethics and Safety
391
+
392
+ Ethics and safety evaluation approach and results.
393
+
394
+ ### Evaluation Approach
395
+
396
+ Our evaluation methods include structured evaluations and internal red-teaming
397
+ testing of relevant content policies. Red-teaming was conducted by a number of
398
+ different teams, each with different goals and human evaluation metrics. These
399
+ models were evaluated against a number of different categories relevant to
400
+ ethics and safety, including:
401
+
402
+ * Text-to-Text Content Safety: Human evaluation on prompts covering safety
403
+ policies including child sexual abuse and exploitation, harassment, violence
404
+ and gore, and hate speech.
405
+ * Text-to-Text Representational Harms: Benchmark against relevant academic
406
+ datasets such as [WinoBias][winobias] and [BBQ Dataset][bbq].
407
+ * Memorization: Automated evaluation of memorization of training data, including
408
+ the risk of personally identifiable information exposure.
409
+ * Large-scale harm: Tests for "dangerous capabilities," such as chemical,
410
+ biological, radiological, and nuclear (CBRN) risks.
411
+
412
+ ### Evaluation Results
413
+
414
+ The results of ethics and safety evaluations are within acceptable thresholds
415
+ for meeting [internal policies][safety-policies] for categories such as child
416
+ safety, content safety, representational harms, memorization, large-scale harms.
417
+ On top of robust internal evaluations, the results of well-known safety
418
+ benchmarks like BBQ, BOLD, Winogender, Winobias, RealToxicity, and TruthfulQA
419
+ are shown here.
420
+
421
+ #### Gemma 2.0
422
+
423
+ | Benchmark | Metric | Gemma 2 IT 9B | Gemma 2 IT 27B |
424
+ | ------------------------ | ------------- | --------------- | ---------------- |
425
+ | [RealToxicity][realtox] | average | 8.25 | 8.84 |
426
+ | [CrowS-Pairs][crows] | top-1 | 37.47 | 36.67 |
427
+ | [BBQ Ambig][bbq] | 1-shot, top-1 | 88.58 | 85.99 |
428
+ | [BBQ Disambig][bbq] | top-1 | 82.67 | 86.94 |
429
+ | [Winogender][winogender] | top-1 | 79.17 | 77.22 |
430
+ | [TruthfulQA][truthfulqa] | | 50.27 | 51.60 |
431
+ | [Winobias 1_2][winobias] | | 78.09 | 81.94 |
432
+ | [Winobias 2_2][winobias] | | 95.32 | 97.22 |
433
+ | [Toxigen][toxigen] | | 39.30 | 38.42 |
434
+ | ------------------------ | ------------- | --------------- | ---------------- |
435
+
436
+ ## Usage and Limitations
437
+
438
+ These models have certain limitations that users should be aware of.
439
+
440
+ ### Intended Usage
441
+
442
+ Open Large Language Models (LLMs) have a wide range of applications across
443
+ various industries and domains. The following list of potential uses is not
444
+ comprehensive. The purpose of this list is to provide contextual information
445
+ about the possible use-cases that the model creators considered as part of model
446
+ training and development.
447
+
448
+ * Content Creation and Communication
449
+ * Text Generation: These models can be used to generate creative text formats
450
+ such as poems, scripts, code, marketing copy, and email drafts.
451
+ * Chatbots and Conversational AI: Power conversational interfaces for customer
452
+ service, virtual assistants, or interactive applications.
453
+ * Text Summarization: Generate concise summaries of a text corpus, research
454
+ papers, or reports.
455
+ * Research and Education
456
+ * Natural Language Processing (NLP) Research: These models can serve as a
457
+ foundation for researchers to experiment with NLP techniques, develop
458
+ algorithms, and contribute to the advancement of the field.
459
+ * Language Learning Tools: Support interactive language learning experiences,
460
+ aiding in grammar correction or providing writing practice.
461
+ * Knowledge Exploration: Assist researchers in exploring large bodies of text
462
+ by generating summaries or answering questions about specific topics.
463
+
464
+ ### Limitations
465
+
466
+ * Training Data
467
+ * The quality and diversity of the training data significantly influence the
468
+ model's capabilities. Biases or gaps in the training data can lead to
469
+ limitations in the model's responses.
470
+ * The scope of the training dataset determines the subject areas the model can
471
+ handle effectively.
472
+ * Context and Task Complexity
473
+ * LLMs are better at tasks that can be framed with clear prompts and
474
+ instructions. Open-ended or highly complex tasks might be challenging.
475
+ * A model's performance can be influenced by the amount of context provided
476
+ (longer context generally leads to better outputs, up to a certain point).
477
+ * Language Ambiguity and Nuance
478
+ * Natural language is inherently complex. LLMs might struggle to grasp subtle
479
+ nuances, sarcasm, or figurative language.
480
+ * Factual Accuracy
481
+ * LLMs generate responses based on information they learned from their
482
+ training datasets, but they are not knowledge bases. They may generate
483
+ incorrect or outdated factual statements.
484
+ * Common Sense
485
+ * LLMs rely on statistical patterns in language. They might lack the ability
486
+ to apply common sense reasoning in certain situations.
487
+
488
+ ### Ethical Considerations and Risks
489
+
490
+ The development of large language models (LLMs) raises several ethical concerns.
491
+ In creating an open model, we have carefully considered the following:
492
+
493
+ * Bias and Fairness
494
+ * LLMs trained on large-scale, real-world text data can reflect socio-cultural
495
+ biases embedded in the training material. These models underwent careful
496
+ scrutiny, input data pre-processing described and posterior evaluations
497
+ reported in this card.
498
+ * Misinformation and Misuse
499
+ * LLMs can be misused to generate text that is false, misleading, or harmful.
500
+ * Guidelines are provided for responsible use with the model, see the
501
+ [Responsible Generative AI Toolkit][rai-toolkit].
502
+ * Transparency and Accountability:
503
+ * This model card summarizes details on the models' architecture,
504
+ capabilities, limitations, and evaluation processes.
505
+ * A responsibly developed open model offers the opportunity to share
506
+ innovation by making LLM technology accessible to developers and researchers
507
+ across the AI ecosystem.
508
+
509
+ Risks identified and mitigations:
510
+
511
+ * Perpetuation of biases: It's encouraged to perform continuous monitoring
512
+ (using evaluation metrics, human review) and the exploration of de-biasing
513
+ techniques during model training, fine-tuning, and other use cases.
514
+ * Generation of harmful content: Mechanisms and guidelines for content safety
515
+ are essential. Developers are encouraged to exercise caution and implement
516
+ appropriate content safety safeguards based on their specific product policies
517
+ and application use cases.
518
+ * Misuse for malicious purposes: Technical limitations and developer and
519
+ end-user education can help mitigate against malicious applications of LLMs.
520
+ Educational resources and reporting mechanisms for users to flag misuse are
521
+ provided. Prohibited uses of Gemma models are outlined in the
522
+ [Gemma Prohibited Use Policy][prohibited-use].
523
+ * Privacy violations: Models were trained on data filtered for removal of PII
524
+ (Personally Identifiable Information). Developers are encouraged to adhere to
525
+ privacy regulations with privacy-preserving techniques.
526
+
527
+ ### Benefits
528
+
529
+ At the time of release, this family of models provides high-performance open
530
+ large language model implementations designed from the ground up for Responsible
531
+ AI development compared to similarly sized models.
532
+
533
+ Using the benchmark evaluation metrics described in this document, these models
534
+ have shown to provide superior performance to other, comparably-sized open model
535
+ alternatives.
536
+
537
+ [rai-toolkit]: https://ai.google.dev/responsible
538
+ [kaggle-gemma]: https://www.kaggle.com/models/google/gemma-2
539
+ [terms]: https://ai.google.dev/gemma/terms
540
+ [vertex-mg-gemma]: https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/335
541
+ [sensitive-info]: https://cloud.google.com/dlp/docs/high-sensitivity-infotypes-reference
542
+ [safety-policies]: https://storage.googleapis.com/gweb-uniblog-publish-prod/documents/2023_Google_AI_Principles_Progress_Update.pdf#page=11
543
+ [prohibited-use]: https://ai.google.dev/gemma/prohibited_use_policy
544
+ [tpu]: https://cloud.google.com/tpu/docs/intro-to-tpu
545
+ [sustainability]: https://sustainability.google/operating-sustainably/
546
+ [jax]: https://github.com/google/jax
547
+ [ml-pathways]: https://blog.google/technology/ai/introducing-pathways-next-generation-ai-architecture/
548
+ [sustainability]: https://sustainability.google/operating-sustainably/
549
+ [foundation-models]: https://ai.google/discover/foundation-models/
550
+ [gemini-2-paper]: https://goo.gle/gemma2report
551
+ [mmlu]: https://arxiv.org/abs/2009.03300
552
+ [hellaswag]: https://arxiv.org/abs/1905.07830
553
+ [piqa]: https://arxiv.org/abs/1911.11641
554
+ [socialiqa]: https://arxiv.org/abs/1904.09728
555
+ [boolq]: https://arxiv.org/abs/1905.10044
556
+ [winogrande]: https://arxiv.org/abs/1907.10641
557
+ [commonsenseqa]: https://arxiv.org/abs/1811.00937
558
+ [openbookqa]: https://arxiv.org/abs/1809.02789
559
+ [arc]: https://arxiv.org/abs/1911.01547
560
+ [triviaqa]: https://arxiv.org/abs/1705.03551
561
+ [naturalq]: https://github.com/google-research-datasets/natural-questions
562
+ [humaneval]: https://arxiv.org/abs/2107.03374
563
+ [mbpp]: https://arxiv.org/abs/2108.07732
564
+ [gsm8k]: https://arxiv.org/abs/2110.14168
565
+ [realtox]: https://arxiv.org/abs/2009.11462
566
+ [bold]: https://arxiv.org/abs/2101.11718
567
+ [crows]: https://aclanthology.org/2020.emnlp-main.154/
568
+ [bbq]: https://arxiv.org/abs/2110.08193v2
569
+ [winogender]: https://arxiv.org/abs/1804.09301
570
+ [truthfulqa]: https://arxiv.org/abs/2109.07958
571
+ [winobias]: https://arxiv.org/abs/1804.06876
572
+ [math]: https://arxiv.org/abs/2103.03874
573
+ [agieval]: https://arxiv.org/abs/2304.06364
574
+ [big-bench]: https://arxiv.org/abs/2206.04615
575
+ [toxigen]: https://arxiv.org/abs/2203.09509
576
+
577
+