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|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
tags: []
|
4 |
+
widget:
|
5 |
+
- messages:
|
6 |
+
- role: user
|
7 |
+
content: How does the brain work?
|
8 |
+
inference:
|
9 |
+
parameters:
|
10 |
+
max_new_tokens: 200
|
11 |
+
extra_gated_heading: "Access Gemma on Hugging Face"
|
12 |
+
extra_gated_prompt: "To access Gemma on Hugging Face, you’re required to review and agree to Google’s usage license. To do this, please ensure you’re logged-in to Hugging Face and click below. Requests are processed immediately."
|
13 |
+
extra_gated_button_content: "Acknowledge license"
|
14 |
+
license: other
|
15 |
+
license_name: gemma-terms-of-use
|
16 |
+
license_link: https://ai.google.dev/gemma/terms
|
17 |
+
---
|
18 |
+
|
19 |
+
GPTQ quantized version of gemma-2b-it model.
|
20 |
+
|
21 |
+
---
|
22 |
+
|
23 |
+
# Gemma Model Card
|
24 |
+
|
25 |
+
**Model Page**: [Gemma](https://ai.google.dev/gemma/docs)
|
26 |
+
|
27 |
+
This model card corresponds to the 2B instruct version of the Gemma model. You can also visit the model card of the [2B base model](https://huggingface.co/google/gemma-2b), [7B base model](https://huggingface.co/google/gemma-7b), and [7B instruct model](https://huggingface.co/google/gemma-7b-it).
|
28 |
+
|
29 |
+
**Resources and Technical Documentation**:
|
30 |
+
|
31 |
+
* [Responsible Generative AI Toolkit](https://ai.google.dev/responsible)
|
32 |
+
* [Gemma on Kaggle](https://www.kaggle.com/models/google/gemma)
|
33 |
+
* [Gemma on Vertex Model Garden](https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/335?version=gemma-2b-it-gg-hf)
|
34 |
+
|
35 |
+
**Terms of Use**: [Terms](https://www.kaggle.com/models/google/gemma/license/consent)
|
36 |
+
|
37 |
+
**Authors**: Google
|
38 |
+
|
39 |
+
## Model Information
|
40 |
+
|
41 |
+
Summary description and brief definition of inputs and outputs.
|
42 |
+
|
43 |
+
### Description
|
44 |
+
|
45 |
+
Gemma is a family of lightweight, state-of-the-art open models from Google,
|
46 |
+
built from the same research and technology used to create the Gemini models.
|
47 |
+
They are text-to-text, decoder-only large language models, available in English,
|
48 |
+
with open weights, pre-trained variants, and instruction-tuned variants. Gemma
|
49 |
+
models are well-suited for a variety of text generation tasks, including
|
50 |
+
question answering, summarization, and reasoning. Their relatively small size
|
51 |
+
makes it possible to deploy them in environments with limited resources such as
|
52 |
+
a laptop, desktop or your own cloud infrastructure, democratizing access to
|
53 |
+
state of the art AI models and helping foster innovation for everyone.
|
54 |
+
|
55 |
+
### Usage
|
56 |
+
|
57 |
+
Below we share some code snippets on how to get quickly started with running the model. First make sure to `pip install -U transformers`, then copy the snippet from the section that is relevant for your usecase.
|
58 |
+
|
59 |
+
#### Running the model on a CPU
|
60 |
+
|
61 |
+
|
62 |
+
```python
|
63 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
64 |
+
|
65 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it")
|
66 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it")
|
67 |
+
|
68 |
+
input_text = "Write me a poem about Machine Learning."
|
69 |
+
input_ids = tokenizer(input_text, return_tensors="pt")
|
70 |
+
|
71 |
+
outputs = model.generate(**input_ids)
|
72 |
+
print(tokenizer.decode(outputs[0]))
|
73 |
+
```
|
74 |
+
|
75 |
+
|
76 |
+
#### Running the model on a single / multi GPU
|
77 |
+
|
78 |
+
|
79 |
+
```python
|
80 |
+
# pip install accelerate
|
81 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
82 |
+
|
83 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it")
|
84 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it", device_map="auto")
|
85 |
+
|
86 |
+
input_text = "Write me a poem about Machine Learning."
|
87 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
88 |
+
|
89 |
+
outputs = model.generate(**input_ids)
|
90 |
+
print(tokenizer.decode(outputs[0]))
|
91 |
+
```
|
92 |
+
|
93 |
+
|
94 |
+
#### Running the model on a GPU using different precisions
|
95 |
+
|
96 |
+
* _Using `torch.float16`_
|
97 |
+
|
98 |
+
```python
|
99 |
+
# pip install accelerate
|
100 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
101 |
+
|
102 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it")
|
103 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it", device_map="auto", torch_dtype=torch.float16)
|
104 |
+
|
105 |
+
input_text = "Write me a poem about Machine Learning."
|
106 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
107 |
+
|
108 |
+
outputs = model.generate(**input_ids)
|
109 |
+
print(tokenizer.decode(outputs[0]))
|
110 |
+
```
|
111 |
+
|
112 |
+
* _Using `torch.bfloat16`_
|
113 |
+
|
114 |
+
```python
|
115 |
+
# pip install accelerate
|
116 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
117 |
+
|
118 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it")
|
119 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it", device_map="auto", torch_dtype=torch.bfloat16)
|
120 |
+
|
121 |
+
input_text = "Write me a poem about Machine Learning."
|
122 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
123 |
+
|
124 |
+
outputs = model.generate(**input_ids)
|
125 |
+
print(tokenizer.decode(outputs[0]))
|
126 |
+
```
|
127 |
+
|
128 |
+
#### Quantized Versions through `bitsandbytes`
|
129 |
+
|
130 |
+
* _Using 8-bit precision (int8)_
|
131 |
+
|
132 |
+
```python
|
133 |
+
# pip install bitsandbytes accelerate
|
134 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
135 |
+
|
136 |
+
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
|
137 |
+
|
138 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it")
|
139 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it", quantization_config=quantization_config)
|
140 |
+
|
141 |
+
input_text = "Write me a poem about Machine Learning."
|
142 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
143 |
+
|
144 |
+
outputs = model.generate(**input_ids)
|
145 |
+
print(tokenizer.decode(outputs[0]))
|
146 |
+
```
|
147 |
+
|
148 |
+
* _Using 4-bit precision_
|
149 |
+
|
150 |
+
```python
|
151 |
+
# pip install bitsandbytes accelerate
|
152 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
153 |
+
|
154 |
+
quantization_config = BitsAndBytesConfig(load_in_4bit=True)
|
155 |
+
|
156 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it")
|
157 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it", quantization_config=quantization_config)
|
158 |
+
|
159 |
+
input_text = "Write me a poem about Machine Learning."
|
160 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
161 |
+
|
162 |
+
outputs = model.generate(**input_ids)
|
163 |
+
print(tokenizer.decode(outputs[0]))
|
164 |
+
```
|
165 |
+
|
166 |
+
|
167 |
+
#### Other optimizations
|
168 |
+
|
169 |
+
* _Flash Attention 2_
|
170 |
+
|
171 |
+
First make sure to install `flash-attn` in your environment `pip install flash-attn`
|
172 |
+
|
173 |
+
```diff
|
174 |
+
model = AutoModelForCausalLM.from_pretrained(
|
175 |
+
model_id,
|
176 |
+
torch_dtype=torch.float16,
|
177 |
+
+ attn_implementation="flash_attention_2"
|
178 |
+
).to(0)
|
179 |
+
```
|
180 |
+
|
181 |
+
### Chat Template
|
182 |
+
|
183 |
+
The instruction-tuned models use a chat template that must be adhered to for conversational use.
|
184 |
+
The easiest way to apply it is using the tokenizer's built-in chat template, as shown in the following snippet.
|
185 |
+
|
186 |
+
Let's load the model and apply the chat template to a conversation. In this example, we'll start with a single user interaction:
|
187 |
+
|
188 |
+
```py
|
189 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
190 |
+
import transformers
|
191 |
+
import torch
|
192 |
+
|
193 |
+
model_id = "gg-hf/gemma-2b-it"
|
194 |
+
dtype = torch.bfloat16
|
195 |
+
|
196 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
197 |
+
model = AutoModelForCausalLM.from_pretrained(
|
198 |
+
model_id,
|
199 |
+
device_map="cuda",
|
200 |
+
torch_dtype=dtype,
|
201 |
+
)
|
202 |
+
|
203 |
+
chat = [
|
204 |
+
{ "role": "user", "content": "Write a hello world program" },
|
205 |
+
]
|
206 |
+
prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
|
207 |
+
```
|
208 |
+
|
209 |
+
At this point, the prompt contains the following text:
|
210 |
+
|
211 |
+
```
|
212 |
+
<bos><start_of_turn>user
|
213 |
+
Write a hello world program<end_of_turn>
|
214 |
+
<start_of_turn>model
|
215 |
+
```
|
216 |
+
|
217 |
+
As you can see, each turn is preceded by a `<start_of_turn>` delimiter and then the role of the entity
|
218 |
+
(either `user`, for content supplied by the user, or `model` for LLM responses). Turns finish with
|
219 |
+
the `<end_of_turn>` token.
|
220 |
+
|
221 |
+
You can follow this format to build the prompt manually, if you need to do it without the tokenizer's
|
222 |
+
chat template.
|
223 |
+
|
224 |
+
After the prompt is ready, generation can be performed like this:
|
225 |
+
|
226 |
+
```py
|
227 |
+
inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
|
228 |
+
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=150)
|
229 |
+
```
|
230 |
+
|
231 |
+
### Inputs and outputs
|
232 |
+
|
233 |
+
* **Input:** Text string, such as a question, a prompt, or a document to be
|
234 |
+
summarized.
|
235 |
+
* **Output:** Generated English-language text in response to the input, such
|
236 |
+
as an answer to a question, or a summary of a document.
|
237 |
+
|
238 |
+
## Model Data
|
239 |
+
|
240 |
+
Data used for model training and how the data was processed.
|
241 |
+
|
242 |
+
### Training Dataset
|
243 |
+
|
244 |
+
These models were trained on a dataset of text data that includes a wide variety
|
245 |
+
of sources, totaling 6 trillion tokens. Here are the key components:
|
246 |
+
|
247 |
+
* Web Documents: A diverse collection of web text ensures the model is exposed
|
248 |
+
to a broad range of linguistic styles, topics, and vocabulary. Primarily
|
249 |
+
English-language content.
|
250 |
+
* Code: Exposing the model to code helps it to learn the syntax and patterns of
|
251 |
+
programming languages, which improves its ability to generate code or
|
252 |
+
understand code-related questions.
|
253 |
+
* Mathematics: Training on mathematical text helps the model learn logical
|
254 |
+
reasoning, symbolic representation, and to address mathematical queries.
|
255 |
+
|
256 |
+
The combination of these diverse data sources is crucial for training a powerful
|
257 |
+
language model that can handle a wide variety of different tasks and text
|
258 |
+
formats.
|
259 |
+
|
260 |
+
### Data Preprocessing
|
261 |
+
|
262 |
+
Here are the key data cleaning and filtering methods applied to the training
|
263 |
+
data:
|
264 |
+
|
265 |
+
* CSAM Filtering: Rigorous CSAM (Child Sexual Abuse Material) filtering was
|
266 |
+
applied at multiple stages in the data preparation process to ensure the
|
267 |
+
exclusion of harmful and illegal content
|
268 |
+
* Sensitive Data Filtering: As part of making Gemma pre-trained models safe and
|
269 |
+
reliable, automated techniques were used to filter out certain personal
|
270 |
+
information and other sensitive data from training sets.
|
271 |
+
* Additional methods: Filtering based on content quality and safely in line with
|
272 |
+
[our policies](https://storage.googleapis.com/gweb-uniblog-publish-prod/documents/2023_Google_AI_Principles_Progress_Update.pdf#page=11).
|
273 |
+
|
274 |
+
## Implementation Information
|
275 |
+
|
276 |
+
Details about the model internals.
|
277 |
+
|
278 |
+
### Hardware
|
279 |
+
|
280 |
+
Gemma was trained using the latest generation of
|
281 |
+
[Tensor Processing Unit (TPU)](https://cloud.google.com/tpu/docs/intro-to-tpu) hardware (TPUv5e).
|
282 |
+
|
283 |
+
Training large language models requires significant computational power. TPUs,
|
284 |
+
designed specifically for matrix operations common in machine learning, offer
|
285 |
+
several advantages in this domain:
|
286 |
+
|
287 |
+
* Performance: TPUs are specifically designed to handle the massive computations
|
288 |
+
involved in training LLMs. They can speed up training considerably compared to
|
289 |
+
CPUs.
|
290 |
+
* Memory: TPUs often come with large amounts of high-bandwidth memory, allowing
|
291 |
+
for the handling of large models and batch sizes during training. This can
|
292 |
+
lead to better model quality.
|
293 |
+
* Scalability: TPU Pods (large clusters of TPUs) provide a scalable solution for
|
294 |
+
handling the growing complexity of large foundation models. You can distribute
|
295 |
+
training across multiple TPU devices for faster and more efficient processing.
|
296 |
+
* Cost-effectiveness: In many scenarios, TPUs can provide a more cost-effective
|
297 |
+
solution for training large models compared to CPU-based infrastructure,
|
298 |
+
especially when considering the time and resources saved due to faster
|
299 |
+
training.
|
300 |
+
* These advantages are aligned with
|
301 |
+
[Google's commitments to operate sustainably](https://sustainability.google/operating-sustainably/).
|
302 |
+
|
303 |
+
### Software
|
304 |
+
|
305 |
+
Training was done using [JAX](https://github.com/google/jax) and [ML Pathways](https://blog.google/technology/ai/introducing-pathways-next-generation-ai-architecture/ml-pathways).
|
306 |
+
|
307 |
+
JAX allows researchers to take advantage of the latest generation of hardware,
|
308 |
+
including TPUs, for faster and more efficient training of large models.
|
309 |
+
|
310 |
+
ML Pathways is Google's latest effort to build artificially intelligent systems
|
311 |
+
capable of generalizing across multiple tasks. This is specially suitable for
|
312 |
+
[foundation models](https://ai.google/discover/foundation-models/), including large language models like
|
313 |
+
these ones.
|
314 |
+
|
315 |
+
Together, JAX and ML Pathways are used as described in the
|
316 |
+
[paper about the Gemini family of models](https://arxiv.org/abs/2312.11805); "the 'single
|
317 |
+
controller' programming model of Jax and Pathways allows a single Python
|
318 |
+
process to orchestrate the entire training run, dramatically simplifying the
|
319 |
+
development workflow."
|
320 |
+
|
321 |
+
## Evaluation
|
322 |
+
|
323 |
+
Model evaluation metrics and results.
|
324 |
+
|
325 |
+
### Benchmark Results
|
326 |
+
|
327 |
+
These models were evaluated against a large collection of different datasets and
|
328 |
+
metrics to cover different aspects of text generation:
|
329 |
+
|
330 |
+
| Benchmark | Metric | 2B Params | 7B Params |
|
331 |
+
| ------------------------------ | ------------- | ----------- | --------- |
|
332 |
+
| [MMLU](https://arxiv.org/abs/2009.03300) | 5-shot, top-1 | 42.3 | 64.3 |
|
333 |
+
| [HellaSwag](https://arxiv.org/abs/1905.07830) | 0-shot |71.4 | 81.2 |
|
334 |
+
| [PIQA](https://arxiv.org/abs/1911.11641) | 0-shot | 77.3 | 81.2 |
|
335 |
+
| [SocialIQA](https://arxiv.org/abs/1904.09728) | 0-shot | 59.7 | 51.8 |
|
336 |
+
| [BooIQ](https://arxiv.org/abs/1905.10044) | 0-shot | 69.4 | 83.2 |
|
337 |
+
| [WinoGrande](https://arxiv.org/abs/1907.10641) | partial score | 65.4 | 72.3 |
|
338 |
+
| [CommonsenseQA](https://arxiv.org/abs/1811.00937) | 7-shot | 65.3 | 71.3 |
|
339 |
+
| [OpenBookQA](https://arxiv.org/abs/1809.02789) | | 47.8 | 52.8 |
|
340 |
+
| [ARC-e](https://arxiv.org/abs/1911.01547) | | 73.2 | 81.5 |
|
341 |
+
| [ARC-c](https://arxiv.org/abs/1911.01547) | | 42.1 | 53.2 |
|
342 |
+
| [TriviaQA](https://arxiv.org/abs/1705.03551) | 5-shot | 53.2 | 63.4 |
|
343 |
+
| [Natural Questions](https://github.com/google-research-datasets/natural-questions) | 5-shot | - | 23 |
|
344 |
+
| [HumanEval](https://arxiv.org/abs/2107.03374) | pass@1 | 22.0 | 32.3 |
|
345 |
+
| [MBPP](https://arxiv.org/abs/2108.07732) | 3-shot | 29.2 | 44.4 |
|
346 |
+
| [GSM8K](https://arxiv.org/abs/2110.14168) | maj@1 | 17.7 | 46.4 |
|
347 |
+
| [MATH](https://arxiv.org/abs/2108.07732) | 4-shot | 11.8 | 24.3 |
|
348 |
+
| [AGIEval](https://arxiv.org/abs/2304.06364) | | 24.2 | 41.7 |
|
349 |
+
| [BIG-Bench](https://arxiv.org/abs/2206.04615) | | 35.2 | 55.1 |
|
350 |
+
| ------------------------------ | ------------- | ----------- | --------- |
|
351 |
+
| **Average** | | **54.0** | **56.4** |
|
352 |
+
|
353 |
+
## Ethics and Safety
|
354 |
+
|
355 |
+
Ethics and safety evaluation approach and results.
|
356 |
+
|
357 |
+
### Evaluation Approach
|
358 |
+
|
359 |
+
Our evaluation methods include structured evaluations and internal red-teaming
|
360 |
+
testing of relevant content policies. Red-teaming was conducted by a number of
|
361 |
+
different teams, each with different goals and human evaluation metrics. These
|
362 |
+
models were evaluated against a number of different categories relevant to
|
363 |
+
ethics and safety, including:
|
364 |
+
|
365 |
+
* Text-to-Text Content Safety: Human evaluation on prompts covering safety
|
366 |
+
policies including child sexual abuse and exploitation, harassment, violence
|
367 |
+
and gore, and hate speech.
|
368 |
+
* Text-to-Text Representational Harms: Benchmark against relevant academic
|
369 |
+
datasets such as [WinoBias](https://arxiv.org/abs/1804.06876) and [BBQ Dataset](https://arxiv.org/abs/2110.08193v2).
|
370 |
+
* Memorization: Automated evaluation of memorization of training data, including
|
371 |
+
the risk of personally identifiable information exposure.
|
372 |
+
* Large-scale harm: Tests for "dangerous capabilities," such as chemical,
|
373 |
+
biological, radiological, and nuclear (CBRN) risks.
|
374 |
+
|
375 |
+
### Evaluation Results
|
376 |
+
|
377 |
+
The results of ethics and safety evaluations are within acceptable thresholds
|
378 |
+
for meeting [internal policies](https://storage.googleapis.com/gweb-uniblog-publish-prod/documents/2023_Google_AI_Principles_Progress_Update.pdf#page=11) for categories such as child
|
379 |
+
safety, content safety, representational harms, memorization, large-scale harms.
|
380 |
+
On top of robust internal evaluations, the results of well known safety
|
381 |
+
benchmarks like BBQ, BOLD, Winogender, Winobias, RealToxicity, and TruthfulQA
|
382 |
+
are shown here.
|
383 |
+
|
384 |
+
| Benchmark | Metric | 2B Params | 7B Params |
|
385 |
+
| ------------------------------ | ------------- | ----------- | --------- |
|
386 |
+
| [RealToxicity](https://arxiv.org/abs/2009.11462) | average | 6.86 | 7.90 |
|
387 |
+
| [BOLD](https://arxiv.org/abs/2101.11718) | | 45.57 | 49.08 |
|
388 |
+
| [CrowS-Pairs](https://aclanthology.org/2020.emnlp-main.154/) | top-1 | 45.82 | 51.33 |
|
389 |
+
| [BBQ Ambig](https://arxiv.org/abs/2110.08193v2) | 1-shot, top-1 | 62.58 | 92.54 |
|
390 |
+
| [BBQ Disambig](https://arxiv.org/abs/2110.08193v2) | top-1 | 54.62 | 71.99 |
|
391 |
+
| [Winogender](https://arxiv.org/abs/1804.09301) | top-1 | 51.25 | 54.17 |
|
392 |
+
| [TruthfulQA](https://arxiv.org/abs/2109.07958) | | 44.84 | 31.81 |
|
393 |
+
| [Winobias 1_2](https://arxiv.org/abs/1804.06876) | | 56.12 | 59.09 |
|
394 |
+
| [Winobias 2_2](https://arxiv.org/abs/1804.06876) | | 91.10 | 92.23 |
|
395 |
+
| [Toxigen](https://arxiv.org/abs/2203.09509) | | 29.77 | 39.59 |
|
396 |
+
| ------------------------------ | ------------- | ----------- | --------- |
|
397 |
+
|
398 |
+
|
399 |
+
## Usage and Limitations
|
400 |
+
|
401 |
+
These models have certain limitations that users should be aware of.
|
402 |
+
|
403 |
+
### Intended Usage
|
404 |
+
|
405 |
+
Open Large Language Models (LLMs) have a wide range of applications across
|
406 |
+
various industries and domains. The following list of potential uses is not
|
407 |
+
comprehensive. The purpose of this list is to provide contextual information
|
408 |
+
about the possible use-cases that the model creators considered as part of model
|
409 |
+
training and development.
|
410 |
+
|
411 |
+
* Content Creation and Communication
|
412 |
+
* Text Generation: These models can be used to generate creative text formats
|
413 |
+
such as poems, scripts, code, marketing copy, and email drafts.
|
414 |
+
* Chatbots and Conversational AI: Power conversational interfaces for customer
|
415 |
+
service, virtual assistants, or interactive applications.
|
416 |
+
* Text Summarization: Generate concise summaries of a text corpus, research
|
417 |
+
papers, or reports.
|
418 |
+
* Research and Education
|
419 |
+
* Natural Language Processing (NLP) Research: These models can serve as a
|
420 |
+
foundation for researchers to experiment with NLP techniques, develop
|
421 |
+
algorithms, and contribute to the advancement of the field.
|
422 |
+
* Language Learning Tools: Support interactive language learning experiences,
|
423 |
+
aiding in grammar correction or providing writing practice.
|
424 |
+
* Knowledge Exploration: Assist researchers in exploring large bodies of text
|
425 |
+
by generating summaries or answering questions about specific topics.
|
426 |
+
|
427 |
+
### Limitations
|
428 |
+
|
429 |
+
* Training Data
|
430 |
+
* The quality and diversity of the training data significantly influence the
|
431 |
+
model's capabilities. Biases or gaps in the training data can lead to
|
432 |
+
limitations in the model's responses.
|
433 |
+
* The scope of the training dataset determines the subject areas the model can
|
434 |
+
handle effectively.
|
435 |
+
* Context and Task Complexity
|
436 |
+
* LLMs are better at tasks that can be framed with clear prompts and
|
437 |
+
instructions. Open-ended or highly complex tasks might be challenging.
|
438 |
+
* A model's performance can be influenced by the amount of context provided
|
439 |
+
(longer context generally leads to better outputs, up to a certain point).
|
440 |
+
* Language Ambiguity and Nuance
|
441 |
+
* Natural language is inherently complex. LLMs might struggle to grasp subtle
|
442 |
+
nuances, sarcasm, or figurative language.
|
443 |
+
* Factual Accuracy
|
444 |
+
* LLMs generate responses based on information they learned from their
|
445 |
+
training datasets, but they are not knowledge bases. They may generate
|
446 |
+
incorrect or outdated factual statements.
|
447 |
+
* Common Sense
|
448 |
+
* LLMs rely on statistical patterns in language. They might lack the ability
|
449 |
+
to apply common sense reasoning in certain situations.
|
450 |
+
|
451 |
+
### Ethical Considerations and Risks
|
452 |
+
|
453 |
+
The development of large language models (LLMs) raises several ethical concerns.
|
454 |
+
In creating an open model, we have carefully considered the following:
|
455 |
+
|
456 |
+
* Bias and Fairness
|
457 |
+
* LLMs trained on large-scale, real-world text data can reflect socio-cultural
|
458 |
+
biases embedded in the training material. These models underwent careful
|
459 |
+
scrutiny, input data pre-processing described and posterior evaluations
|
460 |
+
reported in this card.
|
461 |
+
* Misinformation and Misuse
|
462 |
+
* LLMs can be misused to generate text that is false, misleading, or harmful.
|
463 |
+
* Guidelines are provided for responsible use with the model, see the
|
464 |
+
[Responsible Generative AI Toolkit](http://ai.google.dev/gemma/responsible).
|
465 |
+
* Transparency and Accountability:
|
466 |
+
* This model card summarizes details on the models' architecture,
|
467 |
+
capabilities, limitations, and evaluation processes.
|
468 |
+
* A responsibly developed open model offers the opportunity to share
|
469 |
+
innovation by making LLM technology accessible to developers and researchers
|
470 |
+
across the AI ecosystem.
|
471 |
+
|
472 |
+
Risks identified and mitigations:
|
473 |
+
|
474 |
+
* Perpetuation of biases: It's encouraged to perform continuous monitoring
|
475 |
+
(using evaluation metrics, human review) and the exploration of de-biasing
|
476 |
+
techniques during model training, fine-tuning, and other use cases.
|
477 |
+
* Generation of harmful content: Mechanisms and guidelines for content safety
|
478 |
+
are essential. Developers are encouraged to exercise caution and implement
|
479 |
+
appropriate content safety safeguards based on their specific product policies
|
480 |
+
and application use cases.
|
481 |
+
* Misuse for malicious purposes: Technical limitations and developer and
|
482 |
+
end-user education can help mitigate against malicious applications of LLMs.
|
483 |
+
Educational resources and reporting mechanisms for users to flag misuse are
|
484 |
+
provided. Prohibited uses of Gemma models are outlined in the
|
485 |
+
[Gemma Prohibited Use Policy](https://ai.google.dev/gemma/prohibited_use_policy).
|
486 |
+
* Privacy violations: Models were trained on data filtered for removal of PII
|
487 |
+
(Personally Identifiable Information). Developers are encouraged to adhere to
|
488 |
+
privacy regulations with privacy-preserving techniques.
|
489 |
+
|
490 |
+
### Benefits
|
491 |
+
|
492 |
+
At the time of release, this family of models provides high-performance open
|
493 |
+
large language model implementations designed from the ground up for Responsible
|
494 |
+
AI development compared to similarly sized models.
|
495 |
+
|
496 |
+
Using the benchmark evaluation metrics described in this document, these models
|
497 |
+
have shown to provide superior performance to other, comparably-sized open model
|
498 |
+
alternatives.
|
499 |
+
|