bullerwins commited on
Commit
915fe8a
1 Parent(s): f7c2758

Create README.md

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