kmamaroziqov commited on
Commit
47ca47a
·
verified ·
1 Parent(s): f2f6697

Benchmarks: replace alloma-3B/1B with Llama-3.1-8B-Instruct-Uz and Mistral-7B-Instruct-Uz

Browse files

Both behbudiy Uzbek instruct models evaluated on the same strict 8-task COMET-primary suite. Regenerated overall and per-task charts. Notes the 3% invalid-output gate failures (TUMLU 5.71% both; Mistral sentiment 4.59%).

README.md CHANGED
@@ -130,6 +130,95 @@ curl http://localhost:8000/v1/chat/completions \
130
  }'
131
  ```
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  ## Benchmarks
134
 
135
  All five model result sets below cover the same full eight-task suite.
@@ -140,23 +229,28 @@ invalid-output gate.
140
 
141
  ![Per-task comparison](assets/tasks_comparison.png)
142
 
143
- | Benchmark | Metric | Weight | **NeuronAI-4B** | Qwen3.5-4B | alloma-8B | alloma-3B | alloma-1B |
144
  | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: |
145
- | UzLiB | accuracy | 0.20 | **61.20%** | 40.30% | 42.40% | 32.08% | 23.32% |
146
- | TUMLU-Uzbek | accuracy | 0.20 | **45.00%** | 40.43% | 20.71% | 27.71% | 22.00% |
147
- | FLORES+ en→uz | COMET | 0.15 | **0.8965** | 0.8555 | 0.8779 | 0.8673 | 0.7383 |
148
- | Uzbek news | accuracy | 0.10 | **79.15%** | 67.34% | 57.77% | 13.60% | 25.41% |
149
- | MMLU English | accuracy | 0.10 | 64.06% | **72.66%** | 53.47% | 38.73% | 21.98% |
150
- | MMLU Uzbek | accuracy | 0.10 | **57.01%** | 52.58% | 40.04% | 32.74% | 21.11% |
151
- | FLORES+ uz→en | COMET | 0.05 | **0.8763** | 0.8618 | 0.8713 | 0.7954 | 0.7636 |
152
- | Uzbek sentiment | accuracy | 0.05 | **95.75%** | 84.82% | 79.94% | 38.85% | 79.54% |
153
- | **Normalized weighted score** | | 1.00 | **0.6724** | 0.5978 | 0.5187 | 0.4147 | 0.3661 |
154
-
155
- Alloma runs used the `APST` apostrophe preprocessing required by their model
156
- cards; NeuronAI and stock Qwen did not. The alloma-8B column combines its full
157
- model-card-protocol evaluation with separately archived full UzLiB,
158
- TUMLU-Uzbek, and MMLU-Uzbek runs. Exact source files, scores, and run IDs are
159
- included in [`benchmark_results.json`](benchmark_results.json).
 
 
 
 
 
160
 
161
  ### Run the benchmarks on your computer
162
 
 
130
  }'
131
  ```
132
 
133
+ ### Classification
134
+
135
+ For classification, the model works best as a constrained label picker: give the
136
+ label set in the prompt, ask for the label only, decode greedily, and cap
137
+ `max_new_tokens`. This is exactly the protocol used for the sentiment and news
138
+ benchmark scores below.
139
+
140
+ ```python
141
+ import re
142
+ import torch
143
+ from transformers import AutoModelForCausalLM, AutoTokenizer
144
+
145
+ model_id = "NeuronUz/NeuronAI-4B"
146
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
147
+ model = AutoModelForCausalLM.from_pretrained(
148
+ model_id,
149
+ dtype=torch.bfloat16,
150
+ device_map={"": 0},
151
+ ).eval()
152
+
153
+ LABELS = [
154
+ "Siyosat", "Iqtisodiyot", "Texnologiya", "Sport", "Madaniyat",
155
+ "Salomatlik", "Oila va Jamiyat", "Ta'lim", "Ekologiya", "Xorijiy Yangiliklar",
156
+ ]
157
+
158
+ PROMPT = """Quyidagi o‘zbekcha yangilikni bitta toifaga ajrating. Faqat toifa raqamini yozing.
159
+
160
+ {labels}
161
+
162
+ Matn: {text}
163
+
164
+ Javob:"""
165
+
166
+
167
+ def classify(text: str) -> str:
168
+ prompt = PROMPT.format(
169
+ labels="\n".join(f"{i} - {name}" for i, name in enumerate(LABELS)),
170
+ text=text[:4000],
171
+ )
172
+ inputs = tokenizer.apply_chat_template(
173
+ [{"role": "user", "content": prompt}],
174
+ add_generation_prompt=True,
175
+ enable_thinking=False,
176
+ return_tensors="pt",
177
+ return_dict=True,
178
+ ).to(model.device)
179
+
180
+ with torch.inference_mode():
181
+ output = model.generate(
182
+ **inputs,
183
+ max_new_tokens=8,
184
+ do_sample=False, # greedy: labels must be deterministic
185
+ )
186
+
187
+ raw = tokenizer.decode(
188
+ output[0, inputs["input_ids"].shape[1]:],
189
+ skip_special_tokens=True,
190
+ ).strip()
191
+ match = re.search(r"\d+", raw)
192
+ return LABELS[int(match.group())] if match and int(match.group()) < len(LABELS) else raw
193
+
194
+
195
+ print(classify(
196
+ "O‘zbekiston Markaziy banki asosiy stavkani o‘zgarishsiz qoldirdi."
197
+ )) # -> Iqtisodiyot
198
+ ```
199
+
200
+ Binary sentiment uses the same shape with a two-label set:
201
+
202
+ ```python
203
+ SENTIMENT_PROMPT = (
204
+ "Quyidagi o‘zbekcha matnning kayfiyatini aniqlang: 'Ijobiy' yoki 'Salbiy'. "
205
+ "Faqat bitta yorliqni yozing.\n\nMatn: {text}\n\nYorliq:"
206
+ )
207
+ ```
208
+
209
+ Notes that matter for accuracy:
210
+
211
+ - **Greedy decoding** (`do_sample=False`). The sampling preset in Quick start is
212
+ for open-ended chat; it adds label noise here.
213
+ - **`enable_thinking=False`** — a thinking block spends the token budget before
214
+ the label appears.
215
+ - **Small `max_new_tokens`** (8 is enough) plus a regex/prefix parser on the
216
+ output, so a stray word never becomes an invalid prediction.
217
+ - **Numbered labels** for many-class tasks: one digit is easier to emit and
218
+ parse than a multi-word category name.
219
+ - Keep prompt + text inside the 4,096-token serving limit; truncate long
220
+ articles (`text[:4000]` above).
221
+
222
  ## Benchmarks
223
 
224
  All five model result sets below cover the same full eight-task suite.
 
229
 
230
  ![Per-task comparison](assets/tasks_comparison.png)
231
 
232
+ | Benchmark | Metric | Weight | **NeuronAI-4B** | Qwen3.5-4B | alloma-8B | Llama-3.1-8B-Instruct-Uz | Mistral-7B-Instruct-Uz |
233
  | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: |
234
+ | UzLiB | accuracy | 0.20 | **61.20%** | 40.30% | 42.40% | 31.65% | 32.78% |
235
+ | TUMLU-Uzbek | accuracy | 0.20 | **45.00%** | 40.43% | 20.71% | 32.00% | 33.71% |
236
+ | FLORES+ en→uz | COMET | 0.15 | **0.8965** | 0.8555 | 0.8779 | 0.8667 | 0.8859 |
237
+ | Uzbek news | accuracy | 0.10 | **79.15%** | 67.34% | 57.77% | 60.34% | 62.09% |
238
+ | MMLU English | accuracy | 0.10 | 64.06% | **72.66%** | 53.47% | 47.58% | 29.50% |
239
+ | MMLU Uzbek | accuracy | 0.10 | **57.01%** | 52.58% | 40.04% | 38.72% | 35.06% |
240
+ | FLORES+ uz→en | COMET | 0.05 | **0.8763** | 0.8618 | 0.8713 | 0.7765 | 0.7826 |
241
+ | Uzbek sentiment | accuracy | 0.05 | **95.75%** | 84.82% | 79.94% | 82.59% | 80.83% |
242
+ | **Normalized weighted score** | | 1.00 | **0.6724** | 0.5978 | 0.5187 | 0.5095 | 0.4969 |
243
+
244
+ The alloma-8B run used the `APST` apostrophe preprocessing required by its model
245
+ card, and its column combines the full model-card-protocol evaluation with
246
+ separately archived full UzLiB, TUMLU-Uzbek, and MMLU-Uzbek runs. NeuronAI-4B,
247
+ stock Qwen, and both `behbudiy` Uzbek instruct models were evaluated by the same
248
+ strict COMET-primary suite without APST preprocessing. On the two `behbudiy`
249
+ models the suite's 3% invalid-output gate was exceeded on TUMLU-Uzbek (5.71% for
250
+ both) and, for Mistral-7B-Instruct-Uz, on sentiment (4.59%); those are
251
+ answer-format parse failures, so the affected task scores are a floor rather
252
+ than a ceiling. Exact source files, scores, and run IDs are included in
253
+ [`benchmark_results.json`](benchmark_results.json).
254
 
255
  ### Run the benchmarks on your computer
256
 
assets/overall_score.png CHANGED
assets/tasks_comparison.png CHANGED
benchmark_results.json CHANGED
@@ -103,55 +103,55 @@
103
  },
104
  "normalized_weighted_score": 0.5186512896503792
105
  },
106
- "alloma-3B": {
107
- "run_id": "alloma_3B_apst_full_20260815_142714",
108
- "suite_id": "public_uzbek_full_vllm_apst",
109
  "tasks": {
110
- "uzlib_slice_full": 0.32079527135948416,
111
- "tumlu_uzbek_full": 0.27714285714285714,
112
- "flores_en_uz_full": 0.8673252673692642,
113
- "news_full": 0.1359802000618748,
114
- "mmlu_english_full": 0.3872667711152257,
115
- "mmlu_uz_full": 0.32744623273038026,
116
- "flores_uz_en_full": 0.7954316840740269,
117
- "sentiment_binary_full": 0.3885
118
  },
119
  "invalid_rate": {
120
- "uzlib_slice_full": 0.0010746910263299302,
121
- "tumlu_uzbek_full": 0.28714285714285714,
122
  "flores_en_uz_full": null,
123
- "news_full": 7.218727441476746e-05,
124
- "mmlu_english_full": 0.06900726392251816,
125
- "mmlu_uz_full": 0.07726819541375872,
126
  "flores_uz_en_full": null,
127
- "sentiment_binary_full": 0.4405
128
  },
129
- "normalized_weighted_score": 0.41468665305295505
130
  },
131
- "alloma-1B": {
132
- "run_id": "alloma_1B_apst_full_20260811_114037",
133
- "suite_id": "public_uzbek_full_vllm_apst",
134
  "tasks": {
135
- "uzlib_slice_full": 0.23320795271359485,
136
- "tumlu_uzbek_full": 0.22,
137
- "flores_en_uz_full": 0.7383331350348018,
138
- "news_full": 0.2541404558110756,
139
- "mmlu_english_full": 0.21976926363765845,
140
- "mmlu_uz_full": 0.21108104258652613,
141
- "flores_uz_en_full": 0.7636193416348852,
142
- "sentiment_binary_full": 0.7954
143
  },
144
  "invalid_rate": {
145
- "uzlib_slice_full": 0.04567436861902203,
146
- "tumlu_uzbek_full": 0.36714285714285716,
147
  "flores_en_uz_full": null,
148
- "news_full": 0.0003506239043002991,
149
- "mmlu_english_full": 0.09393248824953711,
150
- "mmlu_uz_full": 0.17882068081469876,
151
  "flores_uz_en_full": null,
152
- "sentiment_binary_full": 0.0063
153
  },
154
- "normalized_weighted_score": 0.3661490569296942
155
  }
156
  },
157
  "checkpoints": {
 
103
  },
104
  "normalized_weighted_score": 0.5186512896503792
105
  },
106
+ "Llama-3.1-8B-Instruct-Uz": {
107
+ "run_id": "strict_full_llama31_8b_instruct_uz",
108
+ "suite_id": "public_uzbek_full_comet_vllm_v2",
109
  "tasks": {
110
+ "uzlib_slice_full": 0.31649650725416445,
111
+ "tumlu_uzbek_full": 0.32,
112
+ "flores_en_uz_full": 0.8666636186669038,
113
+ "news_full": 0.603372176961947,
114
+ "mmlu_english_full": 0.47578692493946734,
115
+ "mmlu_uz_full": 0.38719555618857715,
116
+ "flores_uz_en_full": 0.7764609643717557,
117
+ "sentiment_binary_full": 0.8259
118
  },
119
  "invalid_rate": {
120
+ "uzlib_slice_full": 0.0,
121
+ "tumlu_uzbek_full": 0.05714285714285714,
122
  "flores_en_uz_full": null,
123
+ "news_full": 2.0624935547076414e-05,
124
+ "mmlu_english_full": 0.0037031761857285288,
125
+ "mmlu_uz_full": 0.009471585244267198,
126
  "flores_uz_en_full": null,
127
+ "sentiment_binary_full": 0.0045
128
  },
129
+ "normalized_weighted_score": 0.5095287981878477
130
  },
131
+ "Mistral-7B-Instruct-Uz": {
132
+ "run_id": "strict_full_mistral7b_instruct_uz",
133
+ "suite_id": "public_uzbek_full_comet_vllm_v2",
134
  "tasks": {
135
+ "uzlib_slice_full": 0.3277807630306287,
136
+ "tumlu_uzbek_full": 0.33714285714285713,
137
+ "flores_en_uz_full": 0.8859170079972982,
138
+ "news_full": 0.6209343095802825,
139
+ "mmlu_english_full": 0.294972226178607,
140
+ "mmlu_uz_full": 0.3505910838911836,
141
+ "flores_uz_en_full": 0.7826120569790223,
142
+ "sentiment_binary_full": 0.8083
143
  },
144
  "invalid_rate": {
145
+ "uzlib_slice_full": 0.011284255776464266,
146
+ "tumlu_uzbek_full": 0.05714285714285714,
147
  "flores_en_uz_full": null,
148
+ "news_full": 0.0,
149
+ "mmlu_english_full": 0.025708588520153824,
150
+ "mmlu_uz_full": 0.01167924797037459,
151
  "flores_uz_en_full": null,
152
+ "sentiment_binary_full": 0.0459
153
  },
154
+ "normalized_weighted_score": 0.4969133053139477
155
  }
156
  },
157
  "checkpoints": {