kmamaroziqov commited on
Commit
074e8be
·
verified ·
1 Parent(s): 65de582

Adapt model card to NeuronAI-4B style

Browse files
Files changed (1) hide show
  1. README.md +111 -150
README.md CHANGED
@@ -16,149 +16,39 @@ tags:
16
  - lora
17
  ---
18
 
19
- # NeuronAI 2B
20
 
21
- `NeuronUz/NeuronAI-2B` is an Uzbek-first, text-only Qwen3.5 2B
22
- assistant model with English capability retained. The published weights are a
23
- merged checkpoint: no adapter is required at inference time.
 
24
 
25
- This release updates the repository to the best overall checkpoint from the
26
- 2026-08-18 LoRA r64 checkpoint sweep (`checkpoint-4749`, one SFT epoch). It
27
- replaces the previous full-parameter SFT checkpoint.
28
 
29
- ## Model lineage
30
 
31
- 1. `Qwen/Qwen3.5-2B-Base`
32
- 2. Uzbek tokenizer retrofit (same vocabulary size) and embedding re-initialization
33
- 3. Uzbek continued pretraining
34
- 4. Annealing
35
- 5. Assistant-only supervised fine-tuning with LoRA r64
36
- 6. LoRA merged into the base weights for deployment
37
-
38
- The model is called **NeuronAI 2B** in its identity training examples.
39
-
40
- ## Evaluation
41
-
42
- The four retained checkpoints were evaluated on the same strict eight-task
43
- public suite using full test splits, greedy vLLM decoding, and COMET-primary
44
- translation scoring. Checkpoint 4749 achieved the best normalized weighted
45
- score. All format-scored tasks had a 0% invalid-output rate.
46
-
47
- | Benchmark | Metric | Checkpoint 4749 |
48
- | --- | --- | ---: |
49
- | UzLiB | accuracy | 0.49597 |
50
- | TUMLU-Uzbek | accuracy | 0.32571 |
51
- | FLORES+ en→uz | COMET | 0.87615 |
52
- | FLORES+ en→uz | BLEU | 12.00 |
53
- | Uzbek news classification | accuracy | 0.78549 |
54
- | MMLU (English) | accuracy | 0.54066 |
55
- | MMLU (Uzbek) | accuracy | 0.46852 |
56
- | FLORES+ uz→en | COMET | 0.85347 |
57
- | FLORES+ uz→en | BLEU | 27.21 |
58
- | Uzbek sentiment (binary) | accuracy | 0.95500 |
59
- | **Normalized weighted score** | COMET-primary | **0.59542** |
60
-
61
- Suite weights were UzLiB 0.20, TUMLU 0.20, en→uz COMET 0.15, news 0.10,
62
- MMLU-en 0.10, MMLU-uz 0.10, uz→en COMET 0.05, and sentiment 0.05, normalized
63
- over their total weight of 0.95.
64
-
65
- Checkpoint 1188 scored higher on UzLiB (0.54326), but checkpoint 4749 was
66
- selected because it was stronger overall, particularly in translation,
67
- classification, and sentiment.
68
-
69
- ## Tokenizer fertility
70
-
71
- The Uzbek tokenizer work in this model is a **retrofit, not an extension**: the
72
- vocabulary stays at Qwen3.5's 248,044 entries, and Uzbek merges replace low-value
73
- slots rather than being appended. The embedding matrix
74
- therefore does not grow, and the parameter count is unchanged from the base
75
- model -- the gain is purely in how Uzbek text segments.
76
-
77
- ![Uzbek tokenizer fertility on uz-crawl](assets/fertility_uzcrawl.png)
78
-
79
- | Tokenizer | Vocabulary | Tokens per word (uz-crawl) |
80
- | --- | ---: | ---: |
81
- | NeuronAI-2B | 248,044 | **2.407** |
82
- | Qwen3.5-2B (stock) | 248,044 | 3.426 |
83
-
84
- Measured on 20,000 documents (4.8M whitespace words) reservoir-sampled with seed 42
85
- from uz-crawl (tahrirchi web crawl), keeping documents of at least 250 characters.
86
- Stock Qwen3.5 needs **1.42x** as many tokens for the same Uzbek text, so the retrofit
87
- is worth about **30%** of the context window, the prefill cost, and the decode steps
88
- on Uzbek input.
89
-
90
- Caveat: uz-crawl is part of the Uzbek continued-pretraining corpus, so it is
91
- in-domain for the tokenizer that was fitted on it. The fertility gap on unseen
92
- Uzbek web text is expected to be somewhat smaller.
93
-
94
- ## Comparison with other models
95
-
96
- ![Uzbek public benchmark suite, weighted score](assets/weighted_score.png)
97
-
98
- Compared against the two open Uzbek instruction models in this size class
99
- (`alloma-1B-Instruct` and `alloma-3B-Instruct`, both Llama-3.2 fine-tunes) and
100
- against the stock base model, `Qwen/Qwen3.5-2B`.
101
-
102
- ![Uzbek public benchmark suite, per task](assets/suite_by_task.png)
103
-
104
- | Benchmark | Metric | Weight | NeuronAI-2B | Qwen3.5-2B | alloma-3B | alloma-1B |
105
- | --- | --- | ---: | ---: | ---: | ---: | ---: |
106
- | uzlib (uz MCQ) | accuracy | 0.20 | 0.4960 | 0.2869 | 0.3208 | 0.2332 |
107
- | TUMLU-uz | accuracy | 0.20 | 0.3257 | 0.3129 | 0.2771 | 0.2200 |
108
- | FLORES en->uz (COMET) | COMET | 0.15 | 0.8762 | 0.7010 | 0.8673 | 0.7383 |
109
- | News classification | accuracy | 0.10 | 0.7855 | 0.3675 | 0.1360 | 0.2541 |
110
- | MMLU (en) | accuracy | 0.10 | 0.5407 | 0.5239 | 0.3873 | 0.2198 |
111
- | MMLU-uz | accuracy | 0.10 | 0.4685 | 0.3710 | 0.3274 | 0.2111 |
112
- | FLORES uz->en (COMET) | COMET | 0.05 | 0.8535 | 0.8072 | 0.7954 | 0.7636 |
113
- | Sentiment (binary) | accuracy | 0.05 | 0.9550 | 0.7687 | 0.3885 | 0.7954 |
114
- | **Weighted score** | | 0.95 | **0.5657** | **0.4301** | **0.3940** | **0.3478** |
115
-
116
- **On score comparability.** These four runs were produced by three different
117
- suite revisions. The alloma runs used the APST suite variant, stock Qwen used the
118
- plain variant, and NeuronAI-2B used the COMET-primary variant; the first two weight
119
- translation by BLEU and the third by COMET, so their archived weighted scores are
120
- not on one scale. Every run passed `--compute-comet`, so the table above recomputes
121
- all four from the per-task outputs under a single weighting (the COMET-primary
122
- weights, translation scored by COMET). The NeuronAI-2B weighted score therefore
123
- reads 0.5657 here versus 0.5954 in the section above, which normalizes over the 0.95 total weight; the ranking is unaffected.
124
-
125
- Both alloma models were evaluated with the apostrophe-to-`APST` substitution their
126
- model card requires. Their runs tripped the suite's invalid-output gate on several
127
- MCQ tasks (alloma-1B on uzlib and TUMLU, alloma-3B on TUMLU and MMLU-en), meaning
128
- part of their MCQ gap is format compliance rather than knowledge.
129
-
130
- NeuronAI-2B leads the weighted score and every one of the eight tasks, including
131
- against alloma-3B at over half again its parameter count. The margin is narrowest
132
- on FLORES+ en->uz (0.8762 against alloma-3B's 0.8673) and on TUMLU-Uzbek, which is
133
- the weakest task for every model tested, ours included -- at 0.3257 it is close
134
- enough to the 0.25 four-way chance level to treat as unsolved at this scale.
135
-
136
- ## Training
137
 
138
- One epoch of assistant-only LoRA fine-tuning (rank 64, alpha 128) on 152,152
139
- Uzbek-first examples, using a 2,048-token context and effective batch size 32.
140
- The adapter was merged into the Uzbek CPT + anneal checkpoint for release.
141
-
142
- ## Usage
143
 
144
  ```python
145
  import torch
146
  from transformers import AutoModelForCausalLM, AutoTokenizer
147
 
148
  model_id = "NeuronUz/NeuronAI-2B"
149
-
150
  tokenizer = AutoTokenizer.from_pretrained(model_id)
151
  model = AutoModelForCausalLM.from_pretrained(
152
  model_id,
153
  dtype=torch.bfloat16,
154
  device_map="cuda:0",
155
- )
156
 
157
  messages = [
158
- {"role": "system", "content": "Siz foydali AI yordamchisiz."},
159
- {"role": "user", "content": "O'zbekiston haqida qisqacha ma'lumot bering."},
160
  ]
161
-
162
  inputs = tokenizer.apply_chat_template(
163
  messages,
164
  add_generation_prompt=True,
@@ -168,42 +58,113 @@ inputs = tokenizer.apply_chat_template(
168
  ).to(model.device)
169
 
170
  with torch.inference_mode():
171
- output = model.generate(**inputs, max_new_tokens=512, do_sample=False)
172
 
173
  reply = tokenizer.decode(
174
- output[0][inputs["input_ids"].shape[-1]:],
175
  skip_special_tokens=True,
176
  ).strip()
177
  print(reply)
178
  ```
179
 
180
- The model emits `<|im_end|>` and the generation metadata registers both
181
- `<|im_end|>` and `<|endoftext|>` as end-of-sequence tokens.
182
 
183
- ### vLLM
184
 
185
- ```python
186
- from vllm import LLM, SamplingParams
187
-
188
- llm = LLM(
189
- model="NeuronUz/NeuronAI-2B",
190
- max_model_len=4096,
191
- )
192
- params = SamplingParams(temperature=0.0, max_tokens=512)
 
193
 
194
- messages = [
195
- {"role": "system", "content": "Siz foydali AI yordamchisiz."},
196
- {"role": "user", "content": "O'zbekiston haqida qisqacha ma'lumot bering."},
197
- ]
198
- print(llm.chat(messages, params)[0].outputs[0].text)
199
  ```
200
 
201
- ## Notes and limitations
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
 
203
- - Use a Transformers/vLLM release with Qwen3.5 support.
204
- - Keep the hybrid Qwen3.5 model on one device unless the serving stack has been
205
- validated for multi-device Gated-DeltaNet inference.
206
- - TUMLU-Uzbek remains close to the 0.25 random baseline, so specialist factual
207
- knowledge should be independently verified.
208
- - The model may produce inaccurate, biased, or fabricated information and has
209
- not been comprehensively evaluated for safety or high-stakes use.
 
16
  - lora
17
  ---
18
 
19
+ # NeuronAI-2B
20
 
21
+ **NeuronAI-2B** is an Uzbek-first, bilingual assistant model built from
22
+ Qwen3.5-2B-Base. It combines an Uzbek tokenizer retrofit, continued pretraining,
23
+ annealing, and assistant-only supervised fine-tuning. The published weights are
24
+ fully merged—no LoRA adapter is needed.
25
 
26
+ ![Strict eight-task benchmark comparison](assets/weighted_score.png)
 
 
27
 
28
+ ## Quick start
29
 
30
+ Install a recent Transformers build with Qwen3.5 support:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
+ ```bash
33
+ pip install -U "transformers>=5.1" accelerate torch
34
+ ```
 
 
35
 
36
  ```python
37
  import torch
38
  from transformers import AutoModelForCausalLM, AutoTokenizer
39
 
40
  model_id = "NeuronUz/NeuronAI-2B"
 
41
  tokenizer = AutoTokenizer.from_pretrained(model_id)
42
  model = AutoModelForCausalLM.from_pretrained(
43
  model_id,
44
  dtype=torch.bfloat16,
45
  device_map="cuda:0",
46
+ ).eval()
47
 
48
  messages = [
49
+ {"role": "system", "content": "Siz foydali va aniq AI yordamchisiz."},
50
+ {"role": "user", "content": "Alisher Navoiy haqida qisqacha aytib bering."},
51
  ]
 
52
  inputs = tokenizer.apply_chat_template(
53
  messages,
54
  add_generation_prompt=True,
 
58
  ).to(model.device)
59
 
60
  with torch.inference_mode():
61
+ output = model.generate(**inputs, max_new_tokens=256, do_sample=False)
62
 
63
  reply = tokenizer.decode(
64
+ output[0, inputs["input_ids"].shape[1]:],
65
  skip_special_tokens=True,
66
  ).strip()
67
  print(reply)
68
  ```
69
 
70
+ The generation metadata already registers `<|im_end|>` and `<|endoftext|>` as
71
+ end-of-sequence tokens.
72
 
73
+ ### Serve with vLLM
74
 
75
+ ```bash
76
+ pip install -U vllm
77
+ vllm serve NeuronUz/NeuronAI-2B \
78
+ --dtype bfloat16 \
79
+ --max-model-len 4096 \
80
+ --language-model-only \
81
+ --mamba-block-size 16 \
82
+ --mamba-cache-mode align
83
+ ```
84
 
85
+ ```bash
86
+ curl http://localhost:8000/v1/chat/completions \
87
+ -H "Content-Type: application/json" \
88
+ -d '{"model":"NeuronUz/NeuronAI-2B","messages":[{"role":"user","content":"O‘zbekiston haqida uchta fakt ayting."}]}'
 
89
  ```
90
 
91
+ ## Benchmarks
92
+
93
+ The results below are recomputed from archived full-suite runs using the same
94
+ eight tasks, COMET-primary scoring, and normalized task weights. Classification
95
+ and multiple-choice tasks use accuracy; FLORES+ translation uses COMET. All
96
+ format-scored NeuronAI-2B tasks had a 0% invalid-output rate.
97
+
98
+ ![Per-task comparison](assets/suite_by_task.png)
99
+
100
+ | Benchmark | Metric | Weight | **NeuronAI-2B** | Qwen3.5-2B | alloma-3B | alloma-1B |
101
+ | --- | --- | ---: | ---: | ---: | ---: | ---: |
102
+ | UzLiB | accuracy | 0.20 | **49.60%** | 28.69% | 32.08% | 23.32% |
103
+ | TUMLU-Uzbek | accuracy | 0.20 | **32.57%** | 31.29% | 27.71% | 22.00% |
104
+ | FLORES+ en→uz | COMET | 0.15 | **0.8762** | 0.7010 | 0.8673 | 0.7383 |
105
+ | Uzbek news | accuracy | 0.10 | **78.55%** | 36.75% | 13.60% | 25.41% |
106
+ | MMLU English | accuracy | 0.10 | **54.07%** | 52.39% | 38.73% | 21.98% |
107
+ | MMLU Uzbek | accuracy | 0.10 | **46.85%** | 37.10% | 32.74% | 21.11% |
108
+ | FLORES+ uz→en | COMET | 0.05 | **0.8535** | 0.8072 | 0.7954 | 0.7636 |
109
+ | Uzbek sentiment | accuracy | 0.05 | **95.50%** | 76.87% | 38.85% | 79.54% |
110
+ | **Normalized weighted score** | | 1.00 | **0.5954** | 0.4528 | 0.4147 | 0.3661 |
111
+
112
+ The archived runs came from three suite revisions, but every run computed COMET,
113
+ allowing the table to use one scoring method. Alloma runs used the `APST`
114
+ apostrophe preprocessing required by their model cards.
115
+
116
+ ## Uzbek tokenizer efficiency
117
+
118
+ The tokenizer is an in-place retrofit rather than a vocabulary extension:
119
+ Uzbek merges replace low-value slots while the 248,044-token vocabulary and
120
+ parameter count remain unchanged.
121
+
122
+ ![Uzbek tokenizer fertility](assets/fertility_uzcrawl.png)
123
+
124
+ | Tokenizer | Vocabulary | Tokens per word |
125
+ | --- | ---: | ---: |
126
+ | NeuronAI-2B | 248,044 | **2.407** |
127
+ | Qwen3.5-2B | 248,044 | 3.426 |
128
+
129
+ This measurement used 20,000 documents (4.8M whitespace words) sampled with
130
+ seed 42 from `uz-crawl`. The retrofit uses about 30% fewer tokens on this
131
+ in-domain Uzbek text. Fertility measures tokenization efficiency, not model
132
+ quality or measured inference speed.
133
+
134
+ ## Model lineage and training
135
+
136
+ 1. `Qwen/Qwen3.5-2B-Base`
137
+ 2. Uzbek tokenizer retrofit with embedding re-initialization
138
+ 3. Uzbek continued pretraining
139
+ 4. Instruction-data annealing
140
+ 5. Assistant-only SFT with LoRA r64
141
+ 6. LoRA merged into the model weights
142
+
143
+ One epoch of assistant-only LoRA fine-tuning (rank 64, alpha 128) on 152,152
144
+ Uzbek-first examples, using a 2,048-token context and effective batch size 32.
145
+ Training data is not distributed with this model repository.
146
+
147
+ ## Intended use
148
+
149
+ Good fits include Uzbek research, education, prototyping, translation
150
+ experiments, writing assistance, retrieval-augmented generation, and
151
+ local/offline applications.
152
+
153
+ ## Limitations
154
+
155
+ - TUMLU-Uzbek remains close to the 0.25 random baseline and should not be
156
+ treated as solved.
157
+ - The model can hallucinate, repeat biases in its data, or produce unsafe or
158
+ outdated content. It has not been comprehensively safety-evaluated.
159
+ - Do not rely on it without expert review for medical, legal, financial, public
160
+ safety, or other high-stakes decisions.
161
+ - SFT used sequences up to 2,048 tokens; serving at longer inherited context
162
+ lengths has not been validated here.
163
+ - Use a recent Transformers or vLLM release with Qwen3.5 support. Keep the
164
+ hybrid model on one device unless multi-device Gated-DeltaNet inference has
165
+ been validated in your serving stack.
166
+
167
+ ## License
168
 
169
+ NeuronAI-2B is released under the
170
+ [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).