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