LlamaFinetuneBase commited on
Commit
3902779
1 Parent(s): 977b491

Upload README.md with huggingface_hub

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