Update README.md
Browse files
README.md
CHANGED
|
@@ -20,3 +20,279 @@ tags:
|
|
| 20 |
This gemma2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
| 21 |
|
| 22 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
This gemma2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
| 21 |
|
| 22 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
| 23 |
+
|
| 24 |
+
--
|
| 25 |
+
|
| 26 |
+
### Inputs and outputs
|
| 27 |
+
|
| 28 |
+
* **Input:** Text string, such as a question, a prompt, or a document to be
|
| 29 |
+
summarized.
|
| 30 |
+
* **Output:** Generated English-language text in response to the input, such
|
| 31 |
+
as an answer to a question, or a summary of a document.
|
| 32 |
+
### Citation
|
| 33 |
+
|
| 34 |
+
```none
|
| 35 |
+
@article{gemma_2024,
|
| 36 |
+
title={Gemma},
|
| 37 |
+
url={https://www.kaggle.com/m/3301},
|
| 38 |
+
DOI={10.34740/KAGGLE/M/3301},
|
| 39 |
+
publisher={Kaggle},
|
| 40 |
+
author={Gemma Team},
|
| 41 |
+
year={2024}
|
| 42 |
+
}
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Model Data
|
| 46 |
+
|
| 47 |
+
Data used for model training and how the data was processed.
|
| 48 |
+
|
| 49 |
+
### Training Dataset
|
| 50 |
+
|
| 51 |
+
These models were trained on a dataset of text data that includes a wide variety of sources. The 27B model was trained with 13 trillion tokens and the 9B model was trained with 8 trillion tokens.
|
| 52 |
+
Here are the key components:
|
| 53 |
+
|
| 54 |
+
* Web Documents: A diverse collection of web text ensures the model is exposed
|
| 55 |
+
to a broad range of linguistic styles, topics, and vocabulary. Primarily
|
| 56 |
+
English-language content.
|
| 57 |
+
* Code: Exposing the model to code helps it to learn the syntax and patterns of
|
| 58 |
+
programming languages, which improves its ability to generate code or
|
| 59 |
+
understand code-related questions.
|
| 60 |
+
* Mathematics: Training on mathematical text helps the model learn logical
|
| 61 |
+
reasoning, symbolic representation, and to address mathematical queries.
|
| 62 |
+
|
| 63 |
+
The combination of these diverse data sources is crucial for training a powerful
|
| 64 |
+
language model that can handle a wide variety of different tasks and text
|
| 65 |
+
formats.
|
| 66 |
+
|
| 67 |
+
### Data Preprocessing
|
| 68 |
+
|
| 69 |
+
Here are the key data cleaning and filtering methods applied to the training
|
| 70 |
+
data:
|
| 71 |
+
|
| 72 |
+
* CSAM Filtering: Rigorous CSAM (Child Sexual Abuse Material) filtering was
|
| 73 |
+
applied at multiple stages in the data preparation process to ensure the
|
| 74 |
+
exclusion of harmful and illegal content.
|
| 75 |
+
* Sensitive Data Filtering: As part of making Gemma pre-trained models safe and
|
| 76 |
+
reliable, automated techniques were used to filter out certain personal
|
| 77 |
+
information and other sensitive data from training sets.
|
| 78 |
+
* Additional methods: Filtering based on content quality and safety in line with
|
| 79 |
+
[our policies][safety-policies].
|
| 80 |
+
|
| 81 |
+
## Implementation Information
|
| 82 |
+
|
| 83 |
+
Details about the model internals.
|
| 84 |
+
|
| 85 |
+
### Hardware
|
| 86 |
+
|
| 87 |
+
Gemma was trained using the latest generation of
|
| 88 |
+
[Tensor Processing Unit (TPU)][tpu] hardware (TPUv5p).
|
| 89 |
+
|
| 90 |
+
Training large language models requires significant computational power. TPUs,
|
| 91 |
+
designed specifically for matrix operations common in machine learning, offer
|
| 92 |
+
several advantages in this domain:
|
| 93 |
+
|
| 94 |
+
* Performance: TPUs are specifically designed to handle the massive computations
|
| 95 |
+
involved in training LLMs. They can speed up training considerably compared to
|
| 96 |
+
CPUs.
|
| 97 |
+
* Memory: TPUs often come with large amounts of high-bandwidth memory, allowing
|
| 98 |
+
for the handling of large models and batch sizes during training. This can
|
| 99 |
+
lead to better model quality.
|
| 100 |
+
* Scalability: TPU Pods (large clusters of TPUs) provide a scalable solution for
|
| 101 |
+
handling the growing complexity of large foundation models. You can distribute
|
| 102 |
+
training across multiple TPU devices for faster and more efficient processing.
|
| 103 |
+
* Cost-effectiveness: In many scenarios, TPUs can provide a more cost-effective
|
| 104 |
+
solution for training large models compared to CPU-based infrastructure,
|
| 105 |
+
especially when considering the time and resources saved due to faster
|
| 106 |
+
training.
|
| 107 |
+
* These advantages are aligned with
|
| 108 |
+
[Google's commitments to operate sustainably][sustainability].
|
| 109 |
+
|
| 110 |
+
### Software
|
| 111 |
+
|
| 112 |
+
Training was done using [JAX][jax] and [ML Pathways][ml-pathways].
|
| 113 |
+
|
| 114 |
+
JAX allows researchers to take advantage of the latest generation of hardware,
|
| 115 |
+
including TPUs, for faster and more efficient training of large models.
|
| 116 |
+
|
| 117 |
+
ML Pathways is Google's latest effort to build artificially intelligent systems
|
| 118 |
+
capable of generalizing across multiple tasks. This is specially suitable for
|
| 119 |
+
[foundation models][foundation-models], including large language models like
|
| 120 |
+
these ones.
|
| 121 |
+
|
| 122 |
+
Together, JAX and ML Pathways are used as described in the
|
| 123 |
+
[paper about the Gemini family of models][gemini-2-paper]; "the 'single
|
| 124 |
+
controller' programming model of Jax and Pathways allows a single Python
|
| 125 |
+
process to orchestrate the entire training run, dramatically simplifying the
|
| 126 |
+
development workflow."
|
| 127 |
+
|
| 128 |
+
## Evaluation
|
| 129 |
+
|
| 130 |
+
Model evaluation metrics and results.
|
| 131 |
+
|
| 132 |
+
### Benchmark Results
|
| 133 |
+
|
| 134 |
+
These models were evaluated against a large collection of different datasets and
|
| 135 |
+
metrics to cover different aspects of text generation:
|
| 136 |
+
|
| 137 |
+
| Benchmark | Metric | Gemma PT 9B | Gemma PT 27B |
|
| 138 |
+
| ------------------------------ | ------------- | ----------- | ------------ |
|
| 139 |
+
| [MMLU][mmlu] | 5-shot, top-1 | 71.3 | 75.2 |
|
| 140 |
+
| [HellaSwag][hellaswag] | 10-shot | 81.9 | 86.4 |
|
| 141 |
+
| [PIQA][piqa] | 0-shot | 81.7 | 83.2 |
|
| 142 |
+
| [SocialIQA][socialiqa] | 0-shot | 53.4 | 53.7 |
|
| 143 |
+
| [BoolQ][boolq] | 0-shot | 84.2 | 84.8 |
|
| 144 |
+
| [WinoGrande][winogrande] | partial score | 80.6 | 83.7 |
|
| 145 |
+
| [ARC-e][arc] | 0-shot | 88.0 | 88.6 |
|
| 146 |
+
| [ARC-c][arc] | 25-shot | 68.4 | 71.4 |
|
| 147 |
+
| [TriviaQA][triviaqa] | 5-shot | 76.6 | 83.7 |
|
| 148 |
+
| [Natural Questions][naturalq] | 5-shot | 29.2 | 34.5 |
|
| 149 |
+
| [HumanEval][humaneval] | pass@1 | 40.2 | 51.8 |
|
| 150 |
+
| [MBPP][mbpp] | 3-shot | 52.4 | 62.6 |
|
| 151 |
+
| [GSM8K][gsm8k] | 5-shot, maj@1 | 68.6 | 74.0 |
|
| 152 |
+
| [MATH][math] | 4-shot | 36.6 | 42.3 |
|
| 153 |
+
| [AGIEval][agieval] | 3-5-shot | 52.8 | 55.1 |
|
| 154 |
+
| [BIG-Bench][big-bench] | 3-shot, CoT | 68.2 | 74.9 |
|
| 155 |
+
| ------------------------------ | ------------- | ----------- | ------------ |
|
| 156 |
+
|
| 157 |
+
## Ethics and Safety
|
| 158 |
+
|
| 159 |
+
Ethics and safety evaluation approach and results.
|
| 160 |
+
|
| 161 |
+
### Evaluation Approach
|
| 162 |
+
|
| 163 |
+
Our evaluation methods include structured evaluations and internal red-teaming
|
| 164 |
+
testing of relevant content policies. Red-teaming was conducted by a number of
|
| 165 |
+
different teams, each with different goals and human evaluation metrics. These
|
| 166 |
+
models were evaluated against a number of different categories relevant to
|
| 167 |
+
ethics and safety, including:
|
| 168 |
+
|
| 169 |
+
* Text-to-Text Content Safety: Human evaluation on prompts covering safety
|
| 170 |
+
policies including child sexual abuse and exploitation, harassment, violence
|
| 171 |
+
and gore, and hate speech.
|
| 172 |
+
* Text-to-Text Representational Harms: Benchmark against relevant academic
|
| 173 |
+
datasets such as [WinoBias][winobias] and [BBQ Dataset][bbq].
|
| 174 |
+
* Memorization: Automated evaluation of memorization of training data, including
|
| 175 |
+
the risk of personally identifiable information exposure.
|
| 176 |
+
* Large-scale harm: Tests for "dangerous capabilities," such as chemical,
|
| 177 |
+
biological, radiological, and nuclear (CBRN) risks.
|
| 178 |
+
|
| 179 |
+
### Evaluation Results
|
| 180 |
+
|
| 181 |
+
The results of ethics and safety evaluations are within acceptable thresholds
|
| 182 |
+
for meeting [internal policies][safety-policies] for categories such as child
|
| 183 |
+
safety, content safety, representational harms, memorization, large-scale harms.
|
| 184 |
+
On top of robust internal evaluations, the results of well-known safety
|
| 185 |
+
benchmarks like BBQ, BOLD, Winogender, Winobias, RealToxicity, and TruthfulQA
|
| 186 |
+
are shown here.
|
| 187 |
+
|
| 188 |
+
#### Gemma 2.0
|
| 189 |
+
|
| 190 |
+
| Benchmark | Metric | Gemma 2 IT 9B | Gemma 2 IT 27B |
|
| 191 |
+
| ------------------------ | ------------- | --------------- | ---------------- |
|
| 192 |
+
| [RealToxicity][realtox] | average | 8.25 | 8.84 |
|
| 193 |
+
| [CrowS-Pairs][crows] | top-1 | 37.47 | 36.67 |
|
| 194 |
+
| [BBQ Ambig][bbq] | 1-shot, top-1 | 88.58 | 85.99 |
|
| 195 |
+
| [BBQ Disambig][bbq] | top-1 | 82.67 | 86.94 |
|
| 196 |
+
| [Winogender][winogender] | top-1 | 79.17 | 77.22 |
|
| 197 |
+
| [TruthfulQA][truthfulqa] | | 50.27 | 51.60 |
|
| 198 |
+
| [Winobias 1_2][winobias] | | 78.09 | 81.94 |
|
| 199 |
+
| [Winobias 2_2][winobias] | | 95.32 | 97.22 |
|
| 200 |
+
| [Toxigen][toxigen] | | 39.30 | 38.42 |
|
| 201 |
+
| ------------------------ | ------------- | --------------- | ---------------- |
|
| 202 |
+
|
| 203 |
+
## Usage and Limitations
|
| 204 |
+
|
| 205 |
+
These models have certain limitations that users should be aware of.
|
| 206 |
+
|
| 207 |
+
### Intended Usage
|
| 208 |
+
|
| 209 |
+
Open Large Language Models (LLMs) have a wide range of applications across
|
| 210 |
+
various industries and domains. The following list of potential uses is not
|
| 211 |
+
comprehensive. The purpose of this list is to provide contextual information
|
| 212 |
+
about the possible use-cases that the model creators considered as part of model
|
| 213 |
+
training and development.
|
| 214 |
+
|
| 215 |
+
* Content Creation and Communication
|
| 216 |
+
* Text Generation: These models can be used to generate creative text formats
|
| 217 |
+
such as poems, scripts, code, marketing copy, and email drafts.
|
| 218 |
+
* Chatbots and Conversational AI: Power conversational interfaces for customer
|
| 219 |
+
service, virtual assistants, or interactive applications.
|
| 220 |
+
* Text Summarization: Generate concise summaries of a text corpus, research
|
| 221 |
+
papers, or reports.
|
| 222 |
+
* Research and Education
|
| 223 |
+
* Natural Language Processing (NLP) Research: These models can serve as a
|
| 224 |
+
foundation for researchers to experiment with NLP techniques, develop
|
| 225 |
+
algorithms, and contribute to the advancement of the field.
|
| 226 |
+
* Language Learning Tools: Support interactive language learning experiences,
|
| 227 |
+
aiding in grammar correction or providing writing practice.
|
| 228 |
+
* Knowledge Exploration: Assist researchers in exploring large bodies of text
|
| 229 |
+
by generating summaries or answering questions about specific topics.
|
| 230 |
+
### Limitations
|
| 231 |
+
|
| 232 |
+
* Training Data
|
| 233 |
+
* The quality and diversity of the training data significantly influence the
|
| 234 |
+
model's capabilities. Biases or gaps in the training data can lead to
|
| 235 |
+
limitations in the model's responses.
|
| 236 |
+
* The scope of the training dataset determines the subject areas the model can
|
| 237 |
+
handle effectively.
|
| 238 |
+
* Context and Task Complexity
|
| 239 |
+
* LLMs are better at tasks that can be framed with clear prompts and
|
| 240 |
+
instructions. Open-ended or highly complex tasks might be challenging.
|
| 241 |
+
* A model's performance can be influenced by the amount of context provided
|
| 242 |
+
(longer context generally leads to better outputs, up to a certain point).
|
| 243 |
+
* Language Ambiguity and Nuance
|
| 244 |
+
* Natural language is inherently complex. LLMs might struggle to grasp subtle
|
| 245 |
+
nuances, sarcasm, or figurative language.
|
| 246 |
+
* Factual Accuracy
|
| 247 |
+
* LLMs generate responses based on information they learned from their
|
| 248 |
+
training datasets, but they are not knowledge bases. They may generate
|
| 249 |
+
incorrect or outdated factual statements.
|
| 250 |
+
* Common Sense
|
| 251 |
+
* LLMs rely on statistical patterns in language. They might lack the ability
|
| 252 |
+
to apply common sense reasoning in certain situations.
|
| 253 |
+
### Ethical Considerations and Risks
|
| 254 |
+
|
| 255 |
+
The development of large language models (LLMs) raises several ethical concerns.
|
| 256 |
+
In creating an open model, we have carefully considered the following:
|
| 257 |
+
|
| 258 |
+
* Bias and Fairness
|
| 259 |
+
* LLMs trained on large-scale, real-world text data can reflect socio-cultural
|
| 260 |
+
biases embedded in the training material. These models underwent careful
|
| 261 |
+
scrutiny, input data pre-processing described and posterior evaluations
|
| 262 |
+
reported in this card.
|
| 263 |
+
* Misinformation and Misuse
|
| 264 |
+
* LLMs can be misused to generate text that is false, misleading, or harmful.
|
| 265 |
+
* Guidelines are provided for responsible use with the model, see the
|
| 266 |
+
[Responsible Generative AI Toolkit][rai-toolkit].
|
| 267 |
+
* Transparency and Accountability:
|
| 268 |
+
* This model card summarizes details on the models' architecture,
|
| 269 |
+
capabilities, limitations, and evaluation processes.
|
| 270 |
+
* A responsibly developed open model offers the opportunity to share
|
| 271 |
+
innovation by making LLM technology accessible to developers and researchers
|
| 272 |
+
across the AI ecosystem.
|
| 273 |
+
Risks identified and mitigations:
|
| 274 |
+
|
| 275 |
+
* Perpetuation of biases: It's encouraged to perform continuous monitoring
|
| 276 |
+
(using evaluation metrics, human review) and the exploration of de-biasing
|
| 277 |
+
techniques during model training, fine-tuning, and other use cases.
|
| 278 |
+
* Generation of harmful content: Mechanisms and guidelines for content safety
|
| 279 |
+
are essential. Developers are encouraged to exercise caution and implement
|
| 280 |
+
appropriate content safety safeguards based on their specific product policies
|
| 281 |
+
and application use cases.
|
| 282 |
+
* Misuse for malicious purposes: Technical limitations and developer and
|
| 283 |
+
end-user education can help mitigate against malicious applications of LLMs.
|
| 284 |
+
Educational resources and reporting mechanisms for users to flag misuse are
|
| 285 |
+
provided. Prohibited uses of Gemma models are outlined in the
|
| 286 |
+
[Gemma Prohibited Use Policy][prohibited-use].
|
| 287 |
+
* Privacy violations: Models were trained on data filtered for removal of PII
|
| 288 |
+
(Personally Identifiable Information). Developers are encouraged to adhere to
|
| 289 |
+
privacy regulations with privacy-preserving techniques.
|
| 290 |
+
|
| 291 |
+
### Benefits
|
| 292 |
+
|
| 293 |
+
At the time of release, this family of models provides high-performance open
|
| 294 |
+
large language model implementations designed from the ground up for Responsible
|
| 295 |
+
AI development compared to similarly sized models.
|
| 296 |
+
|
| 297 |
+
Using the benchmark evaluation metrics described in this document, these models
|
| 298 |
+
have shown to provide superior performance to other, comparably-sized op
|