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