nicholasKluge
commited on
Commit
•
8eaa63b
1
Parent(s):
668ee65
Update README.md
Browse files
README.md
CHANGED
@@ -37,7 +37,7 @@ co2_eq_emissions:
|
|
37 |
|
38 |
## Model Summary
|
39 |
|
40 |
-
|
41 |
|
42 |
## Details
|
43 |
|
@@ -65,41 +65,17 @@ This repository has the [source code](https://github.com/Nkluge-correa/TeenyTiny
|
|
65 |
|
66 |
Check out the training logs in [Weights and Biases](https://api.wandb.ai/links/nkluge-correa/vws4g032).
|
67 |
|
68 |
-
## Training Set-up
|
69 |
-
|
70 |
-
These are the main arguments used in the training of this model:
|
71 |
-
|
72 |
-
| Arguments | Value |
|
73 |
-
|-------------------------------|--------------------------------------|
|
74 |
-
| vocabulary size | 32000 |
|
75 |
-
| hidden dimension size | 1024 |
|
76 |
-
| intermediate dimension size | 4096 |
|
77 |
-
| context length | 2048 |
|
78 |
-
| nº attention heads | 16 |
|
79 |
-
| nº hidden layers | 24 |
|
80 |
-
| nº key value heads | 16 |
|
81 |
-
| nº training samples | 3033690 |
|
82 |
-
| nº validation samples | 30000 |
|
83 |
-
| nº epochs | 1.5 |
|
84 |
-
| evaluation steps | 100000 |
|
85 |
-
| train batch size | 2 |
|
86 |
-
| eval batch size | 4 |
|
87 |
-
| gradient accumulation steps | 2 |
|
88 |
-
| optimizer | torch.optim.AdamW |
|
89 |
-
| learning rate | 0.0003 |
|
90 |
-
| adam epsilon | 0.00000001 |
|
91 |
-
| weight decay | 0.01 |
|
92 |
-
| scheduler type | "cosine" |
|
93 |
-
| warmup steps | 10000 |
|
94 |
-
| gradient checkpointing | false |
|
95 |
-
| seed | 42 |
|
96 |
-
| mixed precision | 'no' |
|
97 |
-
| torch dtype | "float32" |
|
98 |
-
| tf32 | true |
|
99 |
-
|
100 |
## Intended Uses
|
101 |
|
102 |
-
The primary intended use of TeenyTinyLlama is to research the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
## Basic usage
|
105 |
|
@@ -145,74 +121,79 @@ for i, completion in enumerate(completions):
|
|
145 |
|
146 |
## Limitations
|
147 |
|
|
|
|
|
148 |
- **Hallucinations:** This model can produce content that can be mistaken for truth but is, in fact, misleading or entirely false, i.e., hallucination.
|
149 |
|
150 |
- **Biases and Toxicity:** This model inherits the social and historical stereotypes from the data used to train it. Given these biases, the model can produce toxic content, i.e., harmful, offensive, or detrimental to individuals, groups, or communities.
|
151 |
|
152 |
- **Unreliable Code:** The model may produce incorrect code snippets and statements. These code generations should not be treated as suggestions or accurate solutions.
|
153 |
|
154 |
-
- **Language Limitations:** The model is primarily designed to understand standard Portuguese
|
155 |
|
156 |
- **Repetition and Verbosity:** The model may get stuck on repetition loops (especially if the repetition penalty during generations is set to a meager value) or produce verbose responses unrelated to the prompt it was given.
|
157 |
|
|
|
|
|
158 |
## Evaluations
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
|
163 |
-
|
164 |
-
|
|
165 |
-
|
|
166 |
-
|
|
167 |
-
|
|
168 |
-
|
|
169 |
-
|
|
170 |
-
|
|
171 |
-
|
|
172 |
-
|
|
173 |
-
|
|
174 |
-
|
|
175 |
-
|
|
176 |
|
177 |
## Benchmarks
|
178 |
|
179 |
-
Evaluations on benchmarks were performed using the [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) (by [EleutherAI](https://www.eleuther.ai/)).
|
180 |
-
|
181 |
-
|
|
182 |
-
|
183 |
-
|
|
184 |
-
|
|
185 |
-
|
|
186 |
-
|
|
187 |
-
|
|
188 |
-
|
|
189 |
-
|
|
190 |
-
|
|
191 |
-
|
|
192 |
-
|
|
193 |
-
|
|
194 |
|
195 |
## Fine-Tuning Comparisons
|
196 |
|
197 |
-
|
198 |
-
|
199 |
-
|
|
200 |
-
|
201 |
-
|
|
202 |
-
|
|
|
|
|
|
|
|
|
|
203 |
|
204 |
## Cite as 🤗
|
205 |
|
206 |
```latex
|
207 |
|
208 |
-
@misc{
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
year = {2023},
|
214 |
-
publisher = {HuggingFace},
|
215 |
-
journal = {HuggingFace repository},
|
216 |
}
|
217 |
|
218 |
```
|
|
|
37 |
|
38 |
## Model Summary
|
39 |
|
40 |
+
Large language models (LLMs) have significantly advanced natural language processing, but their progress has yet to be equal across languages. While most LLMs are trained in high-resource languages like English, multilingual models generally underperform monolingual ones. Additionally, aspects of their multilingual foundation sometimes restrict the byproducts they produce, like computational demands and licensing regimes. Hence, we developed the _TeenyTinyLlama_ pair: two compact models for Brazilian Portuguese text generation.
|
41 |
|
42 |
## Details
|
43 |
|
|
|
65 |
|
66 |
Check out the training logs in [Weights and Biases](https://api.wandb.ai/links/nkluge-correa/vws4g032).
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
## Intended Uses
|
69 |
|
70 |
+
The primary intended use of TeenyTinyLlama is to research the challenges related to developing language models for low-resource languages. Checkpoints saved during training are intended to provide a controlled setting for performing scientific experiments. You may also further fine-tune and adapt TeenyTinyLlama for deployment, as long as your use is following the Apache 2.0 license. If you decide to use pre-trained TeenyTinyLlama as a basis for your fine-tuned model, please conduct your own risk and bias assessment.
|
71 |
+
|
72 |
+
## Out-of-scope Use
|
73 |
+
|
74 |
+
TeenyTinyLlama is not intended for deployment. It is not a product and should not be used for human-facing interactions.
|
75 |
+
|
76 |
+
TeenyTinyLlama models are Brazilian Portuguese language only and are not suitable for translation or generating text in other languages.
|
77 |
+
|
78 |
+
TeenyTinyLlama has not been fine-tuned for downstream contexts in which language models are commonly deployed.
|
79 |
|
80 |
## Basic usage
|
81 |
|
|
|
121 |
|
122 |
## Limitations
|
123 |
|
124 |
+
Like almost all other language models trained on large text datasets scraped from the web, the TTL pair exhibited behavior that does not make them an out-of-the-box solution to many real-world applications, especially those requiring factual, reliable, nontoxic text generation. Our models are all subject to the following:
|
125 |
+
|
126 |
- **Hallucinations:** This model can produce content that can be mistaken for truth but is, in fact, misleading or entirely false, i.e., hallucination.
|
127 |
|
128 |
- **Biases and Toxicity:** This model inherits the social and historical stereotypes from the data used to train it. Given these biases, the model can produce toxic content, i.e., harmful, offensive, or detrimental to individuals, groups, or communities.
|
129 |
|
130 |
- **Unreliable Code:** The model may produce incorrect code snippets and statements. These code generations should not be treated as suggestions or accurate solutions.
|
131 |
|
132 |
+
- **Language Limitations:** The model is primarily designed to understand standard Brazilian Portuguese. Other languages might challenge its comprehension, leading to potential misinterpretations or errors in response.
|
133 |
|
134 |
- **Repetition and Verbosity:** The model may get stuck on repetition loops (especially if the repetition penalty during generations is set to a meager value) or produce verbose responses unrelated to the prompt it was given.
|
135 |
|
136 |
+
Hence, even though our models are released with a permissive license, we urge users to perform their risk analysis on these models if intending to use them for real-world applications and also have humans moderating the outputs of these models in applications where they will interact with an audience, guaranteeing users are always aware they are interacting with a language model.
|
137 |
+
|
138 |
## Evaluations
|
139 |
|
140 |
+
During our training runs, both models showed consistent convergence. At no point did our evaluation curves show signs of overfitting or saturation. In the case of our 460m parameter model, we intentionally trained past the optimal point by approximately 75,000 steps to assess if there were any signs of saturation, but our evaluations consistently gave better results. We hypothesize that our models are under-trained but can improve if further trained to pass the Chinchilla optimal range.
|
141 |
+
|
142 |
+
| Processed Tokens | Perplexity | Energy Consumption (kWh) | Emissions (KgCO2eq) |
|
143 |
+
|------------------|------------|---------------------------|----------------------|
|
144 |
+
| 8.1M | 20.49 | 9.40 | 3.34 |
|
145 |
+
| 1.6B | 16.90 | 18.82 | 6.70 |
|
146 |
+
| 2.4B | 15.43 | 28.59 | 10.16 |
|
147 |
+
| 3.2B | 14.64 | 38.20 | 13.57 |
|
148 |
+
| 4.0B | 14.08 | 48.04 | 17.07 |
|
149 |
+
| 4.9B | 13.61 | 57.74 | 20.52 |
|
150 |
+
| 5.7B | 13.25 | 67.32 | 23.92 |
|
151 |
+
| 6.5B | 12.87 | 76.84 | 27.30 |
|
152 |
+
| 7.3B | 12.57 | 86.40 | 30.70 |
|
153 |
+
| 8.1B | 12.27 | 96.19 | 34.18 |
|
154 |
+
| 9.0B | 11.96 | 106.06 | 37.70 |
|
155 |
+
| 9.8B | 11.77 | 115.69 | 41.31 |
|
156 |
|
157 |
## Benchmarks
|
158 |
|
159 |
+
Evaluations on benchmarks were performed using the [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) (by [EleutherAI](https://www.eleuther.ai/)). [Laiviet](https://github.com/laiviet/lm-evaluation-harness) translated the tasks from the LM-Evaluation-Harness we used. The results of models marked with an "*" were extracted from the [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
|
160 |
+
|
161 |
+
| | **ARC** | **HellaSwag** | **MMLU** | **TruthfulQA** | **Average** |
|
162 |
+
|------------------|-----------|---------------|-----------|----------------|-------------|
|
163 |
+
| Pythia-410m | 24.83* | **41.29*** | 25.99* | 40.95* | 33.26 |
|
164 |
+
| **TTL-460m** | **29.40** | 33.00 | **28.55** | 41.10 | 33.01 |
|
165 |
+
| Bloom-560m | 24.74* | 37.15* | 24.22* | 42.44* | 32.13 |
|
166 |
+
| Xglm-564M | 25.56 | 34.64* | 25.18* | **42.53** | 31.97 |
|
167 |
+
| OPT-350m | 23.55* | 36.73* | 26.02* | 40.83* | 31.78 |
|
168 |
+
| **TTL-160m** | 26.15 | 29.29 | 28.11 | 41.12 | 31.16 |
|
169 |
+
| Pythia-160m | 24.06* | 31.39* | 24.86* | 44.34* | 31.16 |
|
170 |
+
| OPT-125m | 22.87* | 31.47* | 26.02* | 42.87* | 30.80 |
|
171 |
+
| GPorTuguese-2 | 22.48 | 29.62 | 27.36 | 41.44 | 30.22 |
|
172 |
+
| Gpt2-small | 21.48* | 31.60* | 25.79* | 40.65* | 29.97 |
|
173 |
+
| Multilingual GPT | 23.81 | 26.37* | 25.17* | 39.62 | 28.73 |
|
174 |
|
175 |
## Fine-Tuning Comparisons
|
176 |
|
177 |
+
To further evaluate the downstream capabilities of our models, we decided to employ a basic fine-tuning procedure for our TTL pair on a subset of tasks from the Poeta benchmark. We apply the same procedure for comparison purposes on both [BERTimbau](https://huggingface.co/neuralmind/bert-base-portuguese-cased) models, given that they are also LLM trained from scratch in Brazilian Portuguese and have a similar size range to our models. We used these comparisons to assess if our pre-training runs produced LLM capable of producing good results ("good" here means "close to BERTimbau") when utilized for downstream applications.
|
178 |
+
|
179 |
+
| Models | IMDB | FaQuAD-NLI | HateBr | Assin2 | AgNews | Average |
|
180 |
+
|-----------------|-----------|------------|-----------|-----------|-----------|---------|
|
181 |
+
| BERTimbau-large | **93.58** | 92.26 | 91.57 | **88.97** | 94.11 | 92.10 |
|
182 |
+
| BERTimbau-small | 92.22 | **93.07** | 91.28 | 87.45 | 94.19 | 91.64 |
|
183 |
+
| **TTL-460m** | 91.64 | 91.18 | **92.28** | 86.43 | **94.42** | 91.19 |
|
184 |
+
| **TTL-160m** | 91.14 | 90.00 | 90.71 | 85.78 | 94.05 | 90.34 |
|
185 |
+
|
186 |
+
All the shown results are the higher accuracy scores achieved on the respective task test sets after fine-tuning the models on the training sets. All fine-tuning runs used the same hyperparameters, and the code implementation can be found in the [model cards](https://huggingface.co/nicholasKluge/TeenyTinyLlama-460m-HateBR) of our fine-tuned models.
|
187 |
|
188 |
## Cite as 🤗
|
189 |
|
190 |
```latex
|
191 |
|
192 |
+
@misc{correa24ttllama,
|
193 |
+
title = {TeenyTinyLlama: a pair of open-source tiny language models trained in Brazilian Portuguese},
|
194 |
+
author = {Corr{\^e}a, Nicholas Kluge and Falk, Sophia and Fatimah, Shiza and Sen, Aniket and De Oliveira, Nythamar},
|
195 |
+
journal={arXiv},
|
196 |
+
year = {2024},
|
|
|
|
|
|
|
197 |
}
|
198 |
|
199 |
```
|