munish0838 commited on
Commit
176d3ac
1 Parent(s): 3894e33

Upload README.md with huggingface_hub

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