nicholasKluge commited on
Commit
8eaa63b
1 Parent(s): 668ee65

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +61 -80
README.md CHANGED
@@ -37,7 +37,7 @@ co2_eq_emissions:
37
 
38
  ## Model Summary
39
 
40
- Given the lack of available monolingual foundational models in non-English languages and the fact that some of the most used and downloaded models by the community are those small enough to allow individual researchers and hobbyists to use them in low-resource environments, we developed the TeenyTinyLlama: _a pair of small foundational models trained in Brazilian Portuguese._
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 behavior, functionality, and limitations of large language models. Checkpoints saved during training are intended to provide a controlled setting for performing scientific experiments. You may also further fine-tune and adapt TeenyTinyLlama-460m for deployment, as long as your use is in accordance with the Apache 2.0 license. If you decide to use pre-trained TeenyTinyLlama-460m as a basis for your fine-tuned model, please conduct your own risk and bias assessment.
 
 
 
 
 
 
 
 
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 (BR). Other languages might challenge its comprehension, leading to potential misinterpretations or errors in response.
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
- | Steps | Evaluation Loss | Perplexity | Total Energy Consumption | Emissions |
161
- |-----------|-----------------|------------|--------------------------|---------------|
162
- | 100,000 | 3.02 | 20.49 | 9.40 kWh | 3.34 KgCO2eq |
163
- | 200,000 | 2.82 | 16.90 | 18.82 kWh | 6.70 KgCO2eq |
164
- | 300,000 | 2.73 | 15.43 | 28.59 kWh | 10.16 KgCO2eq |
165
- | 400,000 | 2.68 | 14.64 | 38.20 kWh | 13.57 KgCO2eq |
166
- | 500,000 | 2.64 | 14.08 | 48.04 kWh | 17.07 KgCO2eq |
167
- | 600,000 | 2.61 | 13.61 | 57.74 kWh | 20.52 KgCO2eq |
168
- | 700,000 | 2.58 | 13.25 | 67.32 kWh | 23.92 KgCO2eq |
169
- | 800,000 | 2.55 | 12.87 | 76.84 kWh | 27.30 KgCO2eq |
170
- | 900,000 | 2.53 | 12.57 | 86.40 kWh | 30.70 KgCO2eq |
171
- | 1,000,000 | 2.50 | 12.27 | 96.19 kWh | 34.18 KgCO2eq |
172
- | 1,100,000 | 2.48 | 11.96 | 106.06 kWh | 37.70 KgCO2eq |
173
- | 1,200,000 | 2.46 | 11.77 | 115.69 kWh | 41.11 KgCO2eq |
174
- | 1,300,000 | 2.50 | 12.20 | 125.49 kWh | 44,59 KgCO2eq |
175
- | 1,400,000 | 2.44 | 11.54 | 134.96 kWh | 44,59 KgCO2eq |
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/)). Thanks to [Laiviet](https://github.com/laiviet/lm-evaluation-harness) for translating some of the tasks in the LM-Evaluation-Harness. The results of models marked with an "*" were extracted from the [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
180
-
181
- | Models | Average | [ARC](https://arxiv.org/abs/1803.05457) | [Hellaswag](https://arxiv.org/abs/1905.07830) | [MMLU](https://arxiv.org/abs/2009.03300) | [TruthfulQA](https://arxiv.org/abs/2109.07958) |
182
- |-------------------------------------------------------------------------------------|---------|-----------------------------------------|-----------------------------------------------|------------------------------------------|------------------------------------------------|
183
- | [Pythia-410m](https://huggingface.co/EleutherAI/pythia-410m-deduped) | 33.26 | 24.83* | 41.29* | 25.99* | 40.95* |
184
- | [TeenyTinyLlama-460m](https://huggingface.co/nicholasKluge/TeenyTinyLlama-460m) | 33.01 | 29.40 | 33.00 | 28.55 | 41.10 |
185
- | [Bloom-560m](https://huggingface.co/bigscience/bloom-560m) | 32.13 | 24.74* | 37.15* | 24.22* | 42.44* |
186
- | [Xglm-564M](https://huggingface.co/facebook/xglm-564M) | 31.97 | 25.56 | 34.64* | 25.18* | 42.53 |
187
- | [OPT-350m](https://huggingface.co/facebook/opt-350m) | 31.78 | 23.55* | 36.73* | 26.02* | 40.83* |
188
- | [TeenyTinyLlama-160m](https://huggingface.co/nicholasKluge/TeenyTinyLlama-160m) | 31.16 | 26.15 | 29.29 | 28.11 | 41.12 |
189
- | [Pythia-160m](https://huggingface.co/EleutherAI/pythia-160m-deduped) | 31.16 | 24.06* | 31.39* | 24.86* | 44.34* |
190
- | [OPT-125m](https://huggingface.co/facebook/opt-125m) | 30.80 | 22.87* | 31.47* | 26.02* | 42.87* |
191
- | [GPortuguese-2](https://huggingface.co/pierreguillou/gpt2-small-portuguese) | 30.22 | 22.48 | 29.62 | 27.36 | 41.44 |
192
- | [Gpt2-small](https://huggingface.co/gpt2) | 29.97 | 21.48* | 31.60* | 25.79* | 40.65* |
193
- | [Multilingual GPT](https://huggingface.co/ai-forever/mGPT) | 29.45 | 24.79 | 26.37* | 25.17* | 41.50 |
194
 
195
  ## Fine-Tuning Comparisons
196
 
197
- | Models | Average | [IMDB](https://huggingface.co/datasets/christykoh/imdb_pt) | [FaQuAD-NLI](https://huggingface.co/datasets/ruanchaves/faquad-nli) | [HateBr](https://huggingface.co/datasets/ruanchaves/hatebr) | [Assin2](https://huggingface.co/datasets/assin2) | [AgNews](https://huggingface.co/datasets/maritaca-ai/ag_news_pt) |
198
- |---------------------------------------------------------------------------------------------|---------|------------------------------------------------------------|---------------------------------------------------------------------|-------------------------------------------------------------|--------------------------------------------------|------------------------------------------------------------------|
199
- | [Bert-large-portuguese-cased](https://huggingface.co/neuralmind/bert-base-portuguese-cased) | 92.09 | 93.58 | 92.26 | 91.57 | 88.97 | 94.11 |
200
- | [Bert-base-portuguese-cased](https://huggingface.co/neuralmind/bert-base-portuguese-cased) | 91.64 | 92.22 | 93.07 | 91.28 | 87.45 | 94.19 |
201
- | [TeenyTinyLlama-460m](https://huggingface.co/nicholasKluge/TeenyTinyLlama-460m) | 91.19 | 91.64 | 91.18 | 92.28 | 86.43 | 94.42 |
202
- | [TeenyTinyLlama-160m](https://huggingface.co/nicholasKluge/TeenyTinyLlama-160m) | 90.33 | 91.14 | 90.00 | 90.71 | 85.78 | 94.05 |
 
 
 
 
203
 
204
  ## Cite as 🤗
205
 
206
  ```latex
207
 
208
- @misc{nicholas22llama,
209
- doi = {10.5281/zenodo.6989727},
210
- url = {https://huggingface.co/nicholasKluge/TeenyTinyLlama-460m},
211
- author = {Nicholas Kluge Corrêa},
212
- title = {TeenyTinyLlama},
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
  ```