lunahr commited on
Commit
131bbb8
1 Parent(s): e48216d

enabled system prompt

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