Svak commited on
Commit
8a56a64
·
verified ·
1 Parent(s): 0f5fa6c

Create README.md

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