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