gphorvath commited on
Commit
51a0d16
1 Parent(s): f548600

Create README.md

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