nicholasKluge commited on
Commit
0f2cb9f
1 Parent(s): ae972ab

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +62 -80
README.md CHANGED
@@ -39,7 +39,7 @@ co2_eq_emissions:
39
 
40
  **Note: This model is a quantized version of [TeenyTinyLlama-460m](https://huggingface.co/nicholasKluge/TeenyTinyLlama-460m). Quantization was performed using [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), allowing this version to be 80% lighter, 20% faster, and with almost no performance loss. A GPU is required to run the AWQ-quantized models.**
41
 
42
- 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._
43
 
44
  ## Details
45
 
@@ -74,43 +74,19 @@ This repository has the [source code](https://github.com/Nkluge-correa/TeenyTiny
74
 
75
  Check out the training logs in [Weights and Biases](https://api.wandb.ai/links/nkluge-correa/vws4g032).
76
 
77
- ## Training Set-up
78
-
79
- These are the main arguments used in the training of this model:
80
-
81
- | Arguments | Value |
82
- |-------------------------------|--------------------------------------|
83
- | vocabulary size | 32000 |
84
- | hidden dimension size | 1024 |
85
- | intermediate dimension size | 4096 |
86
- | context length | 2048 |
87
- | nº attention heads | 16 |
88
- | nº hidden layers | 24 |
89
- | nº key value heads | 16 |
90
- | nº training samples | 3033690 |
91
- | nº validation samples | 30000 |
92
- | nº epochs | 1.5 |
93
- | evaluation steps | 100000 |
94
- | train batch size | 2 |
95
- | eval batch size | 4 |
96
- | gradient accumulation steps | 2 |
97
- | optimizer | torch.optim.AdamW |
98
- | learning rate | 0.0003 |
99
- | adam epsilon | 0.00000001 |
100
- | weight decay | 0.01 |
101
- | scheduler type | "cosine" |
102
- | warmup steps | 10000 |
103
- | gradient checkpointing | false |
104
- | seed | 42 |
105
- | mixed precision | 'no' |
106
- | torch dtype | "float32" |
107
- | tf32 | true |
108
-
109
  ## Intended Uses
110
 
111
- 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.
 
 
 
 
 
 
 
 
112
 
113
- ## Basic Usage
114
 
115
  **Note: Using quantized models required the installation of `autoawq==0.1.7`. A GPU is required to run the AWQ-quantized models.**
116
 
@@ -160,73 +136,79 @@ for i, completion in enumerate(completions):
160
 
161
  ## Limitations
162
 
 
 
163
  - **Hallucinations:** This model can produce content that can be mistaken for truth but is, in fact, misleading or entirely false, i.e., hallucination.
164
 
165
  - **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.
166
 
167
  - **Unreliable Code:** The model may produce incorrect code snippets and statements. These code generations should not be treated as suggestions or accurate solutions.
168
 
169
- - **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.
170
 
171
  - **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.
172
 
 
 
173
  ## Evaluations
174
 
175
- | Steps | Evaluation Loss | Perplexity | Total Energy Consumption | Emissions |
176
- |-----------|-----------------|------------|--------------------------|---------------|
177
- | 100,000 | 3.02 | 20.49 | 9.40 kWh | 3.34 KgCO2eq |
178
- | 200,000 | 2.82 | 16.90 | 18.82 kWh | 6.70 KgCO2eq |
179
- | 300,000 | 2.73 | 15.43 | 28.59 kWh | 10.16 KgCO2eq |
180
- | 400,000 | 2.68 | 14.64 | 38.20 kWh | 13.57 KgCO2eq |
181
- | 500,000 | 2.64 | 14.08 | 48.04 kWh | 17.07 KgCO2eq |
182
- | 600,000 | 2.61 | 13.61 | 57.74 kWh | 20.52 KgCO2eq |
183
- | 700,000 | 2.58 | 13.25 | 67.32 kWh | 23.92 KgCO2eq |
184
- | 800,000 | 2.55 | 12.87 | 76.84 kWh | 27.30 KgCO2eq |
185
- | 900,000 | 2.53 | 12.57 | 86.40 kWh | 30.70 KgCO2eq |
186
- | 1,000,000 | 2.50 | 12.27 | 96.19 kWh | 34.18 KgCO2eq |
187
- | 1,100,000 | 2.48 | 11.96 | 106.06 kWh | 37.70 KgCO2eq |
188
- | 1,200,000 | 2.46 | 11.77 | 115.69 kWh | 41.11 KgCO2eq |
189
- | 1,300,000 | 2.50 | 12.20 | 125.49 kWh | 44,59 KgCO2eq |
 
190
 
191
  ## Benchmarks
192
 
193
- 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).
194
-
195
- | 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) |
196
- |-------------------------------------------------------------------------------------|---------|-----------------------------------------|-----------------------------------------------|------------------------------------------|------------------------------------------------|
197
- | [Pythia-410m](https://huggingface.co/EleutherAI/pythia-410m-deduped) | 33.26 | 24.83* | 41.29* | 25.99* | 40.95* |
198
- | [TeenyTinyLlama-460m](https://huggingface.co/nicholasKluge/TeenyTinyLlama-460m) | 33.01 | 29.40 | 33.00 | 28.55 | 41.10 |
199
- | [Bloom-560m](https://huggingface.co/bigscience/bloom-560m) | 32.13 | 24.74* | 37.15* | 24.22* | 42.44* |
200
- | [Xglm-564M](https://huggingface.co/facebook/xglm-564M) | 31.97 | 25.56 | 34.64* | 25.18* | 42.53 |
201
- | [OPT-350m](https://huggingface.co/facebook/opt-350m) | 31.78 | 23.55* | 36.73* | 26.02* | 40.83* |
202
- | [TeenyTinyLlama-160m](https://huggingface.co/nicholasKluge/TeenyTinyLlama-160m) | 31.16 | 26.15 | 29.29 | 28.11 | 41.12 |
203
- | [Pythia-160m](https://huggingface.co/EleutherAI/pythia-160m-deduped) | 31.16 | 24.06* | 31.39* | 24.86* | 44.34* |
204
- | [OPT-125m](https://huggingface.co/facebook/opt-125m) | 30.80 | 22.87* | 31.47* | 26.02* | 42.87* |
205
- | [GPortuguese-2](https://huggingface.co/pierreguillou/gpt2-small-portuguese) | 30.22 | 22.48 | 29.62 | 27.36 | 41.44 |
206
- | [Gpt2-small](https://huggingface.co/gpt2) | 29.97 | 21.48* | 31.60* | 25.79* | 40.65* |
207
- | [Multilingual GPT](https://huggingface.co/ai-forever/mGPT) | 29.45 | 24.79 | 26.37* | 25.17* | 41.50 |
208
 
209
  ## Fine-Tuning Comparisons
210
 
211
- | 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) |
212
- |---------------------------------------------------------------------------------------------|---------|------------------------------------------------------------|---------------------------------------------------------------------|-------------------------------------------------------------|--------------------------------------------------|------------------------------------------------------------------|
213
- | [Bert-large-portuguese-cased](https://huggingface.co/neuralmind/bert-base-portuguese-cased) | 92.09 | 93.58 | 92.26 | 91.57 | 88.97 | 94.11 |
214
- | [Bert-base-portuguese-cased](https://huggingface.co/neuralmind/bert-base-portuguese-cased) | 91.64 | 92.22 | 93.07 | 91.28 | 87.45 | 94.19 |
215
- | [TeenyTinyLlama-460m](https://huggingface.co/nicholasKluge/TeenyTinyLlama-460m) | 91.19 | 91.64 | 91.18 | 92.28 | 86.43 | 94.42 |
216
- | [TeenyTinyLlama-160m](https://huggingface.co/nicholasKluge/TeenyTinyLlama-160m) | 90.33 | 91.14 | 90.00 | 90.71 | 85.78 | 94.05 |
 
 
 
 
217
 
218
  ## Cite as 🤗
219
 
220
  ```latex
221
 
222
- @misc{nicholas22llama,
223
- doi = {10.5281/zenodo.6989727},
224
- url = {https://huggingface.co/nicholasKluge/TeenyTinyLlama-460m},
225
- author = {Nicholas Kluge Corrêa},
226
- title = {TeenyTinyLlama},
227
- year = {2023},
228
- publisher = {HuggingFace},
229
- journal = {HuggingFace repository},
230
  }
231
 
232
  ```
 
39
 
40
  **Note: This model is a quantized version of [TeenyTinyLlama-460m](https://huggingface.co/nicholasKluge/TeenyTinyLlama-460m). Quantization was performed using [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), allowing this version to be 80% lighter, 20% faster, and with almost no performance loss. A GPU is required to run the AWQ-quantized models.**
41
 
42
+ 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.
43
 
44
  ## Details
45
 
 
74
 
75
  Check out the training logs in [Weights and Biases](https://api.wandb.ai/links/nkluge-correa/vws4g032).
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  ## Intended Uses
78
 
79
+ 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.
80
+
81
+ ## Out-of-scope Use
82
+
83
+ TeenyTinyLlama is not intended for deployment. It is not a product and should not be used for human-facing interactions.
84
+
85
+ TeenyTinyLlama models are Brazilian Portuguese language only and are not suitable for translation or generating text in other languages.
86
+
87
+ TeenyTinyLlama has not been fine-tuned for downstream contexts in which language models are commonly deployed.
88
 
89
+ ## Basic usage
90
 
91
  **Note: Using quantized models required the installation of `autoawq==0.1.7`. A GPU is required to run the AWQ-quantized models.**
92
 
 
136
 
137
  ## Limitations
138
 
139
+ 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:
140
+
141
  - **Hallucinations:** This model can produce content that can be mistaken for truth but is, in fact, misleading or entirely false, i.e., hallucination.
142
 
143
  - **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.
144
 
145
  - **Unreliable Code:** The model may produce incorrect code snippets and statements. These code generations should not be treated as suggestions or accurate solutions.
146
 
147
+ - **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.
148
 
149
  - **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.
150
 
151
+ 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.
152
+
153
  ## Evaluations
154
 
155
+ 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.
156
+
157
+ | Processed Tokens | Perplexity | Energy Consumption (kWh) | Emissions (KgCO2eq) |
158
+ |------------------|------------|---------------------------|----------------------|
159
+ | 8.1M | 20.49 | 9.40 | 3.34 |
160
+ | 1.6B | 16.90 | 18.82 | 6.70 |
161
+ | 2.4B | 15.43 | 28.59 | 10.16 |
162
+ | 3.2B | 14.64 | 38.20 | 13.57 |
163
+ | 4.0B | 14.08 | 48.04 | 17.07 |
164
+ | 4.9B | 13.61 | 57.74 | 20.52 |
165
+ | 5.7B | 13.25 | 67.32 | 23.92 |
166
+ | 6.5B | 12.87 | 76.84 | 27.30 |
167
+ | 7.3B | 12.57 | 86.40 | 30.70 |
168
+ | 8.1B | 12.27 | 96.19 | 34.18 |
169
+ | 9.0B | 11.96 | 106.06 | 37.70 |
170
+ | 9.8B | 11.77 | 115.69 | 41.31 |
171
 
172
  ## Benchmarks
173
 
174
+ 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).
175
+
176
+ | | **ARC** | **HellaSwag** | **MMLU** | **TruthfulQA** | **Average** |
177
+ |------------------|-----------|---------------|-----------|----------------|-------------|
178
+ | Pythia-410m | 24.83* | **41.29*** | 25.99* | 40.95* | 33.26 |
179
+ | **TTL-460m** | **29.40** | 33.00 | **28.55** | 41.10 | 33.01 |
180
+ | Bloom-560m | 24.74* | 37.15* | 24.22* | 42.44* | 32.13 |
181
+ | Xglm-564M | 25.56 | 34.64* | 25.18* | **42.53** | 31.97 |
182
+ | OPT-350m | 23.55* | 36.73* | 26.02* | 40.83* | 31.78 |
183
+ | **TTL-160m** | 26.15 | 29.29 | 28.11 | 41.12 | 31.16 |
184
+ | Pythia-160m | 24.06* | 31.39* | 24.86* | 44.34* | 31.16 |
185
+ | OPT-125m | 22.87* | 31.47* | 26.02* | 42.87* | 30.80 |
186
+ | GPorTuguese-2 | 22.48 | 29.62 | 27.36 | 41.44 | 30.22 |
187
+ | Gpt2-small | 21.48* | 31.60* | 25.79* | 40.65* | 29.97 |
188
+ | Multilingual GPT | 23.81 | 26.37* | 25.17* | 39.62 | 28.73 |
189
 
190
  ## Fine-Tuning Comparisons
191
 
192
+ 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.
193
+
194
+ | Models | IMDB | FaQuAD-NLI | HateBr | Assin2 | AgNews | Average |
195
+ |-----------------|-----------|------------|-----------|-----------|-----------|---------|
196
+ | BERTimbau-large | **93.58** | 92.26 | 91.57 | **88.97** | 94.11 | 92.10 |
197
+ | BERTimbau-small | 92.22 | **93.07** | 91.28 | 87.45 | 94.19 | 91.64 |
198
+ | **TTL-460m** | 91.64 | 91.18 | **92.28** | 86.43 | **94.42** | 91.19 |
199
+ | **TTL-160m** | 91.14 | 90.00 | 90.71 | 85.78 | 94.05 | 90.34 |
200
+
201
+ 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.
202
 
203
  ## Cite as 🤗
204
 
205
  ```latex
206
 
207
+ @misc{correa24ttllama,
208
+ title = {TeenyTinyLlama: a pair of open-source tiny language models trained in Brazilian Portuguese},
209
+ author = {Corr{\^e}a, Nicholas Kluge and Falk, Sophia and Fatimah, Shiza and Sen, Aniket and De Oliveira, Nythamar},
210
+ journal={arXiv},
211
+ year = {2024},
 
 
 
212
  }
213
 
214
  ```