Files changed (1) hide show
  1. README.md +397 -385
README.md CHANGED
@@ -1,385 +1,397 @@
1
- ---
2
- license: mit
3
- language:
4
- - pt
5
- base_model:
6
- - Qwen/Qwen2.5-0.5B-Instruct
7
- pipeline_tag: text-generation
8
- datasets:
9
- - adalbertojunior/openHermes_portuguese
10
- - cnmoro/smoltalk-555k-ptbr
11
- - cnmoro/RagMixPTBR-Legal-Alpaca-2M
12
- - adalbertojunior/dolphin-2.9-portuguese
13
- model-index:
14
- - name: Qwen2.5-0.5B-Portuguese-v2
15
- results:
16
- - task:
17
- type: text-generation
18
- name: Text Generation
19
- dataset:
20
- name: ENEM Challenge (No Images)
21
- type: eduagarcia/enem_challenge
22
- split: train
23
- args:
24
- num_few_shot: 3
25
- metrics:
26
- - type: acc
27
- value: 36.81
28
- name: accuracy
29
- source:
30
- url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
31
- name: Open Portuguese LLM Leaderboard
32
- - task:
33
- type: text-generation
34
- name: Text Generation
35
- dataset:
36
- name: BLUEX (No Images)
37
- type: eduagarcia-temp/BLUEX_without_images
38
- split: train
39
- args:
40
- num_few_shot: 3
41
- metrics:
42
- - type: acc
43
- value: 26.84
44
- name: accuracy
45
- source:
46
- url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
47
- name: Open Portuguese LLM Leaderboard
48
- - task:
49
- type: text-generation
50
- name: Text Generation
51
- dataset:
52
- name: OAB Exams
53
- type: eduagarcia/oab_exams
54
- split: train
55
- args:
56
- num_few_shot: 3
57
- metrics:
58
- - type: acc
59
- value: 30.62
60
- name: accuracy
61
- source:
62
- url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
63
- name: Open Portuguese LLM Leaderboard
64
- - task:
65
- type: text-generation
66
- name: Text Generation
67
- dataset:
68
- name: Assin2 RTE
69
- type: assin2
70
- split: test
71
- args:
72
- num_few_shot: 15
73
- metrics:
74
- - type: f1_macro
75
- value: 87.91
76
- name: f1-macro
77
- source:
78
- url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
79
- name: Open Portuguese LLM Leaderboard
80
- - task:
81
- type: text-generation
82
- name: Text Generation
83
- dataset:
84
- name: Assin2 STS
85
- type: eduagarcia/portuguese_benchmark
86
- split: test
87
- args:
88
- num_few_shot: 15
89
- metrics:
90
- - type: pearson
91
- value: 59.01
92
- name: pearson
93
- source:
94
- url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
95
- name: Open Portuguese LLM Leaderboard
96
- - task:
97
- type: text-generation
98
- name: Text Generation
99
- dataset:
100
- name: FaQuAD NLI
101
- type: ruanchaves/faquad-nli
102
- split: test
103
- args:
104
- num_few_shot: 15
105
- metrics:
106
- - type: f1_macro
107
- value: 43.97
108
- name: f1-macro
109
- source:
110
- url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
111
- name: Open Portuguese LLM Leaderboard
112
- - task:
113
- type: text-generation
114
- name: Text Generation
115
- dataset:
116
- name: HateBR Binary
117
- type: ruanchaves/hatebr
118
- split: test
119
- args:
120
- num_few_shot: 25
121
- metrics:
122
- - type: f1_macro
123
- value: 33.62
124
- name: f1-macro
125
- source:
126
- url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
127
- name: Open Portuguese LLM Leaderboard
128
- - task:
129
- type: text-generation
130
- name: Text Generation
131
- dataset:
132
- name: PT Hate Speech Binary
133
- type: hate_speech_portuguese
134
- split: test
135
- args:
136
- num_few_shot: 25
137
- metrics:
138
- - type: f1_macro
139
- value: 41.23
140
- name: f1-macro
141
- source:
142
- url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
143
- name: Open Portuguese LLM Leaderboard
144
- - task:
145
- type: text-generation
146
- name: Text Generation
147
- dataset:
148
- name: tweetSentBR
149
- type: eduagarcia/tweetsentbr_fewshot
150
- split: test
151
- args:
152
- num_few_shot: 25
153
- metrics:
154
- - type: f1_macro
155
- value: 52.33
156
- name: f1-macro
157
- source:
158
- url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
159
- name: Open Portuguese LLM Leaderboard
160
- ---
161
-
162
- Qwen2.5-0.5B finetuned for proficiency in Portuguese language and increased intelligence.
163
-
164
- ```text
165
- https://ollama.com/cnmoro/Qwen2.5-0.5B-Portuguese-v2
166
- ```
167
-
168
- ```python
169
- from transformers import AutoModelForCausalLM, AutoTokenizer
170
-
171
- model_name = "cnmoro/Qwen2.5-0.5B-Portuguese-v2"
172
-
173
- model = AutoModelForCausalLM.from_pretrained(
174
- model_name,
175
- torch_dtype="auto",
176
- device_map="auto"
177
- )
178
- tokenizer = AutoTokenizer.from_pretrained(model_name)
179
-
180
- prompt = "Escreva uma breve introdução sobre LLMs (Large Language Models) e suas aplicações."
181
-
182
- # System prompt is always injected and hardcoded automatically
183
- # for ideal performance in portuguese language.
184
- # No need to write it again.
185
- messages = [
186
- {"role": "user", "content": prompt}
187
- ]
188
- text = tokenizer.apply_chat_template(
189
- messages,
190
- tokenize=False,
191
- add_generation_prompt=True
192
- )
193
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
194
-
195
- generated_ids = model.generate(
196
- **model_inputs,
197
- max_new_tokens=512
198
- )
199
- generated_ids = [
200
- output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
201
- ]
202
-
203
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
204
- response
205
- # As Large Language Models (LLMs) são sistemas computacionais projetados para produzir
206
- # linguagem natural com alta precisão e fluência. Eles usam algoritmos avançados para compreender
207
- # e gerar texto, permitindo-lhes realizar tarefas como tradução de idiomas, geração de conteúdo
208
- # e processamento de linguagem natural.
209
- #
210
- # Os LLMs têm sido amplamente utilizados na área da inteligência artificial e do aprendizado
211
- # de máquina há vários anos. Alguns dos principais usos de LLMs incluem:
212
- #
213
- # 1. Tradução automática: Os LLMs podem traduzir textos entre diferentes idiomas, tornando-os
214
- # úteis em setores onde a comunicação internacional é crítica, como negócios internacionais,
215
- # diplomacia ou relações públicas.
216
- #
217
- # 2. Geração de conteúdo: os LLMs podem criar conteúdo altamente personalizado e adaptado às
218
- # necessidades específicas de seus usuários, tornando-os ideais para criação de sites, aplicativos
219
- # móveis ou plataformas de mídia social.
220
- #
221
- # 3. Processamento de Linguagem Natural: Os LLMs podem ser treinados para reconhecer e compreender
222
- # padrões de linguagem, permitindo-lhes compreender melhor as intenções humanas e responder adequadamente.
223
- #
224
- # 4. Análise de sentimento: Os LLMs podem analisar dados de texto e identificar sentimentos, ajudando
225
- # a entender como as pessoas se sentem em relação a determinadas questões ou questões sociais.
226
- #
227
- # No geral, os LLMs estão se tornando cada vez mais importantes à medida que a tecnologia continua a
228
- # avançar. À medida que continuamos a usar LLMs em nossas vidas diárias, podemos esperar ver ainda
229
- # mais desenvolvimentos interessantes no futuro.
230
- ```
231
-
232
- ## Overall Results
233
-
234
- | Task | Metric | Value | StdErr |
235
- |---------------------------|---------------|---------|---------|
236
- | ASSIN2 RTE | F1 Macro | 0.4486 | 0.0067 |
237
- | ASSIN2 RTE | Accuracy | 0.5560 | 0.0071 |
238
- | ASSIN2 STS | Pearson | 0.4091 | 0.0104 |
239
- | ASSIN2 STS | MSE | 5.6395 | N/A |
240
- | BluEX | Accuracy | 0.2503 | 0.0094 |
241
- | ENEM Challenge | Accuracy | 0.3128 | 0.0071 |
242
- | FAQUAD NLI | F1 Macro | 0.4611 | 0.0094 |
243
- | FAQUAD NLI | Accuracy | 0.7877 | 0.0113 |
244
- | HateBR Offensive (Binary) | F1 Macro | 0.3439 | 0.0049 |
245
- | HateBR Offensive (Binary) | Accuracy | 0.4857 | 0.0095 |
246
- | OAB Exams | Accuracy | 0.3062 | 0.0057 |
247
- | Portuguese Hate Speech (Binary) | F1 Macro | 0.4119 | 0.0038 |
248
- | Portuguese Hate Speech (Binary) | Accuracy | 0.7004 | 0.0111 |
249
- | TweetSentBR | F1 Macro | 0.5055 | 0.0078 |
250
- | TweetSentBR | Accuracy | 0.5697 | 0.0078 |
251
-
252
- ## Detailed Results by Task
253
-
254
- ### ASSIN2 RTE
255
-
256
- | Metric | Value | StdErr |
257
- |-------------|---------|---------|
258
- | F1 Macro | 0.4486 | 0.0067 |
259
- | Accuracy | 0.5560 | 0.0071 |
260
-
261
- ### ASSIN2 STS
262
-
263
- | Metric | Value | StdErr |
264
- |-------------|---------|---------|
265
- | Pearson | 0.4091 | 0.0104 |
266
- | MSE | 5.6395 | N/A |
267
-
268
- ### BluEX
269
-
270
- | Exam ID | Metric | Value | StdErr |
271
- |-------------------|----------|---------|---------|
272
- | All | Accuracy | 0.2503 | 0.0094 |
273
- | USP_2018 | Accuracy | 0.2037 | 0.0315 |
274
- | UNICAMP_2018 | Accuracy | 0.1852 | 0.0306 |
275
- | UNICAMP_2021_1 | Accuracy | 0.0870 | 0.0240 |
276
- | USP_2020 | Accuracy | 0.2143 | 0.0317 |
277
- | USP_2023 | Accuracy | 0.2045 | 0.0350 |
278
- | UNICAMP_2019 | Accuracy | 0.2600 | 0.0358 |
279
- | USP_2019 | Accuracy | 0.1500 | 0.0326 |
280
- | UNICAMP_2020 | Accuracy | 0.2182 | 0.0321 |
281
- | UNICAMP_2021_2 | Accuracy | 0.2941 | 0.0367 |
282
- | UNICAMP_2023 | Accuracy | 0.4186 | 0.0433 |
283
- | UNICAMP_2024 | Accuracy | 0.3111 | 0.0398 |
284
- | USP_2024 | Accuracy | 0.2683 | 0.0398 |
285
- | USP_2021 | Accuracy | 0.3269 | 0.0375 |
286
- | UNICAMP_2022 | Accuracy | 0.3590 | 0.0444 |
287
- | USP_2022 | Accuracy | 0.2857 | 0.0370 |
288
-
289
- ### ENEM Challenge
290
-
291
- | Exam ID | Metric | Value | StdErr |
292
- |-----------|----------|---------|---------|
293
- | All | Accuracy | 0.3128 | 0.0071 |
294
- | 2017 | Accuracy | 0.2845 | 0.0241 |
295
- | 2016 | Accuracy | 0.2479 | 0.0226 |
296
- | 2016_2 | Accuracy | 0.2846 | 0.0235 |
297
- | 2022 | Accuracy | 0.3534 | 0.0240 |
298
- | 2012 | Accuracy | 0.3362 | 0.0253 |
299
- | 2011 | Accuracy | 0.3333 | 0.0251 |
300
- | 2010 | Accuracy | 0.3846 | 0.0260 |
301
- | 2014 | Accuracy | 0.3211 | 0.0259 |
302
- | 2009 | Accuracy | 0.2696 | 0.0239 |
303
- | 2015 | Accuracy | 0.2521 | 0.0229 |
304
- | 2023 | Accuracy | 0.3481 | 0.0236 |
305
- | 2013 | Accuracy | 0.3333 | 0.0261 |
306
-
307
- ### FAQUAD NLI
308
-
309
- | Metric | Value | StdErr |
310
- |-------------|---------|---------|
311
- | F1 Macro | 0.4611 | 0.0094 |
312
- | Accuracy | 0.7877 | 0.0113 |
313
-
314
- ### HateBR Offensive (Binary)
315
-
316
- | Metric | Value | StdErr |
317
- |-------------|---------|---------|
318
- | F1 Macro | 0.3439 | 0.0049 |
319
- | Accuracy | 0.4857 | 0.0095 |
320
-
321
- ### OAB Exams
322
-
323
- | Exam ID | Metric | Value | StdErr |
324
- |-------------|----------|---------|---------|
325
- | All | Accuracy | 0.3062 | 0.0057 |
326
- | 2011-05 | Accuracy | 0.3375 | 0.0304 |
327
- | 2012-06a | Accuracy | 0.2625 | 0.0285 |
328
- | 2010-02 | Accuracy | 0.3700 | 0.0279 |
329
- | 2017-22 | Accuracy | 0.3500 | 0.0309 |
330
- | 2016-20 | Accuracy | 0.3125 | 0.0300 |
331
- | 2011-03 | Accuracy | 0.2626 | 0.0255 |
332
- | 2015-17 | Accuracy | 0.3205 | 0.0304 |
333
- | 2017-23 | Accuracy | 0.2875 | 0.0292 |
334
- | 2018-25 | Accuracy | 0.3625 | 0.0311 |
335
- | 2016-19 | Accuracy | 0.2436 | 0.0281 |
336
- | 2017-24 | Accuracy | 0.1625 | 0.0238 |
337
- | 2015-16 | Accuracy | 0.3125 | 0.0300 |
338
- | 2011-04 | Accuracy | 0.3250 | 0.0301 |
339
- | 2012-07 | Accuracy | 0.3500 | 0.0307 |
340
- | 2012-06 | Accuracy | 0.1875 | 0.0253 |
341
- | 2012-09 | Accuracy | 0.2468 | 0.0284 |
342
- | 2013-12 | Accuracy | 0.3625 | 0.0311 |
343
- | 2013-11 | Accuracy | 0.3000 | 0.0295 |
344
- | 2010-01 | Accuracy | 0.3412 | 0.0296 |
345
- | 2015-18 | Accuracy | 0.2875 | 0.0292 |
346
- | 2014-13 | Accuracy | 0.3500 | 0.0308 |
347
- | 2013-10 | Accuracy | 0.3125 | 0.0300 |
348
- | 2016-20a | Accuracy | 0.2500 | 0.0279 |
349
- | 2014-14 | Accuracy | 0.3125 | 0.0301 |
350
- | 2012-08 | Accuracy | 0.3000 | 0.0296 |
351
- | 2016-21 | Accuracy | 0.3375 | 0.0304 |
352
- | 2014-15 | Accuracy | 0.4103 | 0.0321 |
353
-
354
- ### Portuguese Hate Speech (Binary)
355
-
356
- | Metric | Value | StdErr |
357
- |-------------|---------|---------|
358
- | F1 Macro | 0.4119 | 0.0038 |
359
- | Accuracy | 0.7004 | 0.0111 |
360
-
361
- ### TweetSentBR
362
-
363
- | Metric | Value | StdErr |
364
- |-------------|---------|---------|
365
- | F1 Macro | 0.5055 | 0.0078 |
366
- | Accuracy | 0.5697 | 0.0078 |
367
-
368
-
369
- # Open Portuguese LLM Leaderboard Evaluation Results
370
-
371
- Detailed results can be found [here](https://huggingface.co/datasets/eduagarcia-temp/llm_pt_leaderboard_raw_results/tree/main/cnmoro/Qwen2.5-0.5B-Portuguese-v2) and on the [🚀 Open Portuguese LLM Leaderboard](https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard)
372
-
373
- | Metric | Value |
374
- |--------------------------|---------|
375
- |Average |**45.81**|
376
- |ENEM Challenge (No Images)| 36.81|
377
- |BLUEX (No Images) | 26.84|
378
- |OAB Exams | 30.62|
379
- |Assin2 RTE | 87.91|
380
- |Assin2 STS | 59.01|
381
- |FaQuAD NLI | 43.97|
382
- |HateBR Binary | 33.62|
383
- |PT Hate Speech Binary | 41.23|
384
- |tweetSentBR | 52.33|
385
-
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - zho
5
+ - eng
6
+ - fra
7
+ - spa
8
+ - por
9
+ - deu
10
+ - ita
11
+ - rus
12
+ - jpn
13
+ - kor
14
+ - vie
15
+ - tha
16
+ - ara
17
+ base_model:
18
+ - Qwen/Qwen2.5-0.5B-Instruct
19
+ pipeline_tag: text-generation
20
+ datasets:
21
+ - adalbertojunior/openHermes_portuguese
22
+ - cnmoro/smoltalk-555k-ptbr
23
+ - cnmoro/RagMixPTBR-Legal-Alpaca-2M
24
+ - adalbertojunior/dolphin-2.9-portuguese
25
+ model-index:
26
+ - name: Qwen2.5-0.5B-Portuguese-v2
27
+ results:
28
+ - task:
29
+ type: text-generation
30
+ name: Text Generation
31
+ dataset:
32
+ name: ENEM Challenge (No Images)
33
+ type: eduagarcia/enem_challenge
34
+ split: train
35
+ args:
36
+ num_few_shot: 3
37
+ metrics:
38
+ - type: acc
39
+ value: 36.81
40
+ name: accuracy
41
+ source:
42
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
43
+ name: Open Portuguese LLM Leaderboard
44
+ - task:
45
+ type: text-generation
46
+ name: Text Generation
47
+ dataset:
48
+ name: BLUEX (No Images)
49
+ type: eduagarcia-temp/BLUEX_without_images
50
+ split: train
51
+ args:
52
+ num_few_shot: 3
53
+ metrics:
54
+ - type: acc
55
+ value: 26.84
56
+ name: accuracy
57
+ source:
58
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
59
+ name: Open Portuguese LLM Leaderboard
60
+ - task:
61
+ type: text-generation
62
+ name: Text Generation
63
+ dataset:
64
+ name: OAB Exams
65
+ type: eduagarcia/oab_exams
66
+ split: train
67
+ args:
68
+ num_few_shot: 3
69
+ metrics:
70
+ - type: acc
71
+ value: 30.62
72
+ name: accuracy
73
+ source:
74
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
75
+ name: Open Portuguese LLM Leaderboard
76
+ - task:
77
+ type: text-generation
78
+ name: Text Generation
79
+ dataset:
80
+ name: Assin2 RTE
81
+ type: assin2
82
+ split: test
83
+ args:
84
+ num_few_shot: 15
85
+ metrics:
86
+ - type: f1_macro
87
+ value: 87.91
88
+ name: f1-macro
89
+ source:
90
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
91
+ name: Open Portuguese LLM Leaderboard
92
+ - task:
93
+ type: text-generation
94
+ name: Text Generation
95
+ dataset:
96
+ name: Assin2 STS
97
+ type: eduagarcia/portuguese_benchmark
98
+ split: test
99
+ args:
100
+ num_few_shot: 15
101
+ metrics:
102
+ - type: pearson
103
+ value: 59.01
104
+ name: pearson
105
+ source:
106
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
107
+ name: Open Portuguese LLM Leaderboard
108
+ - task:
109
+ type: text-generation
110
+ name: Text Generation
111
+ dataset:
112
+ name: FaQuAD NLI
113
+ type: ruanchaves/faquad-nli
114
+ split: test
115
+ args:
116
+ num_few_shot: 15
117
+ metrics:
118
+ - type: f1_macro
119
+ value: 43.97
120
+ name: f1-macro
121
+ source:
122
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
123
+ name: Open Portuguese LLM Leaderboard
124
+ - task:
125
+ type: text-generation
126
+ name: Text Generation
127
+ dataset:
128
+ name: HateBR Binary
129
+ type: ruanchaves/hatebr
130
+ split: test
131
+ args:
132
+ num_few_shot: 25
133
+ metrics:
134
+ - type: f1_macro
135
+ value: 33.62
136
+ name: f1-macro
137
+ source:
138
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
139
+ name: Open Portuguese LLM Leaderboard
140
+ - task:
141
+ type: text-generation
142
+ name: Text Generation
143
+ dataset:
144
+ name: PT Hate Speech Binary
145
+ type: hate_speech_portuguese
146
+ split: test
147
+ args:
148
+ num_few_shot: 25
149
+ metrics:
150
+ - type: f1_macro
151
+ value: 41.23
152
+ name: f1-macro
153
+ source:
154
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
155
+ name: Open Portuguese LLM Leaderboard
156
+ - task:
157
+ type: text-generation
158
+ name: Text Generation
159
+ dataset:
160
+ name: tweetSentBR
161
+ type: eduagarcia/tweetsentbr_fewshot
162
+ split: test
163
+ args:
164
+ num_few_shot: 25
165
+ metrics:
166
+ - type: f1_macro
167
+ value: 52.33
168
+ name: f1-macro
169
+ source:
170
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=cnmoro/Qwen2.5-0.5B-Portuguese-v2
171
+ name: Open Portuguese LLM Leaderboard
172
+ ---
173
+
174
+ Qwen2.5-0.5B finetuned for proficiency in Portuguese language and increased intelligence.
175
+
176
+ ```text
177
+ https://ollama.com/cnmoro/Qwen2.5-0.5B-Portuguese-v2
178
+ ```
179
+
180
+ ```python
181
+ from transformers import AutoModelForCausalLM, AutoTokenizer
182
+
183
+ model_name = "cnmoro/Qwen2.5-0.5B-Portuguese-v2"
184
+
185
+ model = AutoModelForCausalLM.from_pretrained(
186
+ model_name,
187
+ torch_dtype="auto",
188
+ device_map="auto"
189
+ )
190
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
191
+
192
+ prompt = "Escreva uma breve introdução sobre LLMs (Large Language Models) e suas aplicações."
193
+
194
+ # System prompt is always injected and hardcoded automatically
195
+ # for ideal performance in portuguese language.
196
+ # No need to write it again.
197
+ messages = [
198
+ {"role": "user", "content": prompt}
199
+ ]
200
+ text = tokenizer.apply_chat_template(
201
+ messages,
202
+ tokenize=False,
203
+ add_generation_prompt=True
204
+ )
205
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
206
+
207
+ generated_ids = model.generate(
208
+ **model_inputs,
209
+ max_new_tokens=512
210
+ )
211
+ generated_ids = [
212
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
213
+ ]
214
+
215
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
216
+ response
217
+ # As Large Language Models (LLMs) são sistemas computacionais projetados para produzir
218
+ # linguagem natural com alta precisão e fluência. Eles usam algoritmos avançados para compreender
219
+ # e gerar texto, permitindo-lhes realizar tarefas como tradução de idiomas, geração de conteúdo
220
+ # e processamento de linguagem natural.
221
+ #
222
+ # Os LLMs têm sido amplamente utilizados na área da inteligência artificial e do aprendizado
223
+ # de máquina há vários anos. Alguns dos principais usos de LLMs incluem:
224
+ #
225
+ # 1. Tradução automática: Os LLMs podem traduzir textos entre diferentes idiomas, tornando-os
226
+ # úteis em setores onde a comunicação internacional é crítica, como negócios internacionais,
227
+ # diplomacia ou relações públicas.
228
+ #
229
+ # 2. Geração de conteúdo: os LLMs podem criar conteúdo altamente personalizado e adaptado às
230
+ # necessidades específicas de seus usuários, tornando-os ideais para criação de sites, aplicativos
231
+ # móveis ou plataformas de mídia social.
232
+ #
233
+ # 3. Processamento de Linguagem Natural: Os LLMs podem ser treinados para reconhecer e compreender
234
+ # padrões de linguagem, permitindo-lhes compreender melhor as intenções humanas e responder adequadamente.
235
+ #
236
+ # 4. Análise de sentimento: Os LLMs podem analisar dados de texto e identificar sentimentos, ajudando
237
+ # a entender como as pessoas se sentem em relação a determinadas questões ou questões sociais.
238
+ #
239
+ # No geral, os LLMs estão se tornando cada vez mais importantes à medida que a tecnologia continua a
240
+ # avançar. À medida que continuamos a usar LLMs em nossas vidas diárias, podemos esperar ver ainda
241
+ # mais desenvolvimentos interessantes no futuro.
242
+ ```
243
+
244
+ ## Overall Results
245
+
246
+ | Task | Metric | Value | StdErr |
247
+ |---------------------------|---------------|---------|---------|
248
+ | ASSIN2 RTE | F1 Macro | 0.4486 | 0.0067 |
249
+ | ASSIN2 RTE | Accuracy | 0.5560 | 0.0071 |
250
+ | ASSIN2 STS | Pearson | 0.4091 | 0.0104 |
251
+ | ASSIN2 STS | MSE | 5.6395 | N/A |
252
+ | BluEX | Accuracy | 0.2503 | 0.0094 |
253
+ | ENEM Challenge | Accuracy | 0.3128 | 0.0071 |
254
+ | FAQUAD NLI | F1 Macro | 0.4611 | 0.0094 |
255
+ | FAQUAD NLI | Accuracy | 0.7877 | 0.0113 |
256
+ | HateBR Offensive (Binary) | F1 Macro | 0.3439 | 0.0049 |
257
+ | HateBR Offensive (Binary) | Accuracy | 0.4857 | 0.0095 |
258
+ | OAB Exams | Accuracy | 0.3062 | 0.0057 |
259
+ | Portuguese Hate Speech (Binary) | F1 Macro | 0.4119 | 0.0038 |
260
+ | Portuguese Hate Speech (Binary) | Accuracy | 0.7004 | 0.0111 |
261
+ | TweetSentBR | F1 Macro | 0.5055 | 0.0078 |
262
+ | TweetSentBR | Accuracy | 0.5697 | 0.0078 |
263
+
264
+ ## Detailed Results by Task
265
+
266
+ ### ASSIN2 RTE
267
+
268
+ | Metric | Value | StdErr |
269
+ |-------------|---------|---------|
270
+ | F1 Macro | 0.4486 | 0.0067 |
271
+ | Accuracy | 0.5560 | 0.0071 |
272
+
273
+ ### ASSIN2 STS
274
+
275
+ | Metric | Value | StdErr |
276
+ |-------------|---------|---------|
277
+ | Pearson | 0.4091 | 0.0104 |
278
+ | MSE | 5.6395 | N/A |
279
+
280
+ ### BluEX
281
+
282
+ | Exam ID | Metric | Value | StdErr |
283
+ |-------------------|----------|---------|---------|
284
+ | All | Accuracy | 0.2503 | 0.0094 |
285
+ | USP_2018 | Accuracy | 0.2037 | 0.0315 |
286
+ | UNICAMP_2018 | Accuracy | 0.1852 | 0.0306 |
287
+ | UNICAMP_2021_1 | Accuracy | 0.0870 | 0.0240 |
288
+ | USP_2020 | Accuracy | 0.2143 | 0.0317 |
289
+ | USP_2023 | Accuracy | 0.2045 | 0.0350 |
290
+ | UNICAMP_2019 | Accuracy | 0.2600 | 0.0358 |
291
+ | USP_2019 | Accuracy | 0.1500 | 0.0326 |
292
+ | UNICAMP_2020 | Accuracy | 0.2182 | 0.0321 |
293
+ | UNICAMP_2021_2 | Accuracy | 0.2941 | 0.0367 |
294
+ | UNICAMP_2023 | Accuracy | 0.4186 | 0.0433 |
295
+ | UNICAMP_2024 | Accuracy | 0.3111 | 0.0398 |
296
+ | USP_2024 | Accuracy | 0.2683 | 0.0398 |
297
+ | USP_2021 | Accuracy | 0.3269 | 0.0375 |
298
+ | UNICAMP_2022 | Accuracy | 0.3590 | 0.0444 |
299
+ | USP_2022 | Accuracy | 0.2857 | 0.0370 |
300
+
301
+ ### ENEM Challenge
302
+
303
+ | Exam ID | Metric | Value | StdErr |
304
+ |-----------|----------|---------|---------|
305
+ | All | Accuracy | 0.3128 | 0.0071 |
306
+ | 2017 | Accuracy | 0.2845 | 0.0241 |
307
+ | 2016 | Accuracy | 0.2479 | 0.0226 |
308
+ | 2016_2 | Accuracy | 0.2846 | 0.0235 |
309
+ | 2022 | Accuracy | 0.3534 | 0.0240 |
310
+ | 2012 | Accuracy | 0.3362 | 0.0253 |
311
+ | 2011 | Accuracy | 0.3333 | 0.0251 |
312
+ | 2010 | Accuracy | 0.3846 | 0.0260 |
313
+ | 2014 | Accuracy | 0.3211 | 0.0259 |
314
+ | 2009 | Accuracy | 0.2696 | 0.0239 |
315
+ | 2015 | Accuracy | 0.2521 | 0.0229 |
316
+ | 2023 | Accuracy | 0.3481 | 0.0236 |
317
+ | 2013 | Accuracy | 0.3333 | 0.0261 |
318
+
319
+ ### FAQUAD NLI
320
+
321
+ | Metric | Value | StdErr |
322
+ |-------------|---------|---------|
323
+ | F1 Macro | 0.4611 | 0.0094 |
324
+ | Accuracy | 0.7877 | 0.0113 |
325
+
326
+ ### HateBR Offensive (Binary)
327
+
328
+ | Metric | Value | StdErr |
329
+ |-------------|---------|---------|
330
+ | F1 Macro | 0.3439 | 0.0049 |
331
+ | Accuracy | 0.4857 | 0.0095 |
332
+
333
+ ### OAB Exams
334
+
335
+ | Exam ID | Metric | Value | StdErr |
336
+ |-------------|----------|---------|---------|
337
+ | All | Accuracy | 0.3062 | 0.0057 |
338
+ | 2011-05 | Accuracy | 0.3375 | 0.0304 |
339
+ | 2012-06a | Accuracy | 0.2625 | 0.0285 |
340
+ | 2010-02 | Accuracy | 0.3700 | 0.0279 |
341
+ | 2017-22 | Accuracy | 0.3500 | 0.0309 |
342
+ | 2016-20 | Accuracy | 0.3125 | 0.0300 |
343
+ | 2011-03 | Accuracy | 0.2626 | 0.0255 |
344
+ | 2015-17 | Accuracy | 0.3205 | 0.0304 |
345
+ | 2017-23 | Accuracy | 0.2875 | 0.0292 |
346
+ | 2018-25 | Accuracy | 0.3625 | 0.0311 |
347
+ | 2016-19 | Accuracy | 0.2436 | 0.0281 |
348
+ | 2017-24 | Accuracy | 0.1625 | 0.0238 |
349
+ | 2015-16 | Accuracy | 0.3125 | 0.0300 |
350
+ | 2011-04 | Accuracy | 0.3250 | 0.0301 |
351
+ | 2012-07 | Accuracy | 0.3500 | 0.0307 |
352
+ | 2012-06 | Accuracy | 0.1875 | 0.0253 |
353
+ | 2012-09 | Accuracy | 0.2468 | 0.0284 |
354
+ | 2013-12 | Accuracy | 0.3625 | 0.0311 |
355
+ | 2013-11 | Accuracy | 0.3000 | 0.0295 |
356
+ | 2010-01 | Accuracy | 0.3412 | 0.0296 |
357
+ | 2015-18 | Accuracy | 0.2875 | 0.0292 |
358
+ | 2014-13 | Accuracy | 0.3500 | 0.0308 |
359
+ | 2013-10 | Accuracy | 0.3125 | 0.0300 |
360
+ | 2016-20a | Accuracy | 0.2500 | 0.0279 |
361
+ | 2014-14 | Accuracy | 0.3125 | 0.0301 |
362
+ | 2012-08 | Accuracy | 0.3000 | 0.0296 |
363
+ | 2016-21 | Accuracy | 0.3375 | 0.0304 |
364
+ | 2014-15 | Accuracy | 0.4103 | 0.0321 |
365
+
366
+ ### Portuguese Hate Speech (Binary)
367
+
368
+ | Metric | Value | StdErr |
369
+ |-------------|---------|---------|
370
+ | F1 Macro | 0.4119 | 0.0038 |
371
+ | Accuracy | 0.7004 | 0.0111 |
372
+
373
+ ### TweetSentBR
374
+
375
+ | Metric | Value | StdErr |
376
+ |-------------|---------|---------|
377
+ | F1 Macro | 0.5055 | 0.0078 |
378
+ | Accuracy | 0.5697 | 0.0078 |
379
+
380
+
381
+ # Open Portuguese LLM Leaderboard Evaluation Results
382
+
383
+ Detailed results can be found [here](https://huggingface.co/datasets/eduagarcia-temp/llm_pt_leaderboard_raw_results/tree/main/cnmoro/Qwen2.5-0.5B-Portuguese-v2) and on the [🚀 Open Portuguese LLM Leaderboard](https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard)
384
+
385
+ | Metric | Value |
386
+ |--------------------------|---------|
387
+ |Average |**45.81**|
388
+ |ENEM Challenge (No Images)| 36.81|
389
+ |BLUEX (No Images) | 26.84|
390
+ |OAB Exams | 30.62|
391
+ |Assin2 RTE | 87.91|
392
+ |Assin2 STS | 59.01|
393
+ |FaQuAD NLI | 43.97|
394
+ |HateBR Binary | 33.62|
395
+ |PT Hate Speech Binary | 41.23|
396
+ |tweetSentBR | 52.33|
397
+