RichardErkhov commited on
Commit
319ad2a
1 Parent(s): 90e5e9c

uploaded readme

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