rainjay commited on
Commit
c88cd50
1 Parent(s): 9947e01

Create README.md

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