RichardErkhov commited on
Commit
0aa095d
·
verified ·
1 Parent(s): b9fcdf4

uploaded readme

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