RichardErkhov commited on
Commit
b2057f9
1 Parent(s): 332e026

uploaded readme

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