Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,167 +1,276 @@
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
-
- uz
|
| 4 |
-
- en
|
|
|
|
|
|
|
| 5 |
tags:
|
| 6 |
-
- uzbek
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
pipeline_tag: text-generation
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
---
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
-
|
| 24 |
-
-
|
| 25 |
-
-
|
| 26 |
-
- **Hidden size**: 2560
|
| 27 |
-
- **Attention heads**: 32 (KV heads: 8)
|
| 28 |
-
- **Vocab size**: 180,000
|
| 29 |
-
- **Max position embeddings**: 40,960 (model config)
|
| 30 |
-
- **Generation defaults**
|
| 31 |
-
- `temperature=0.6`
|
| 32 |
-
- `top_p=0.95`
|
| 33 |
-
- `top_k=20`
|
| 34 |
|
| 35 |
-
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
We
|
| 49 |
|
| 50 |
-
|
| 51 |
-
- Collected Uzbek- and English-language text.
|
| 52 |
-
- Cleaned and normalized text (deduplication/format normalization).
|
| 53 |
-
- Tokenized into a mixed Uzbek/English stream.
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
| 61 |
-
- Exported weights to `safetensors` shards + index.
|
| 62 |
-
- Uploaded to Hugging Face.
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
-
- **Secondary**: English chat and general text generation.
|
| 68 |
|
| 69 |
-
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
-
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
```python
|
| 86 |
-
import torch
|
| 87 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 88 |
|
| 89 |
-
|
| 90 |
|
| 91 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
| 92 |
model = AutoModelForCausalLM.from_pretrained(
|
| 93 |
-
|
| 94 |
-
torch_dtype=
|
| 95 |
device_map="auto",
|
| 96 |
-
trust_remote_code=True
|
| 97 |
)
|
| 98 |
|
| 99 |
-
prompt = "
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
)
|
| 111 |
|
| 112 |
-
|
|
|
|
| 113 |
```
|
| 114 |
|
| 115 |
-
###
|
| 116 |
-
|
| 117 |
-
This repository includes a `chat_template.jinja`. Some environments may not automatically load it into the tokenizer; if `tokenizer.chat_template` is empty, you can set it manually:
|
| 118 |
|
| 119 |
```python
|
| 120 |
-
|
| 121 |
-
|
|
|
|
| 122 |
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
|
| 126 |
|
| 127 |
-
|
| 128 |
-
tokenizer.chat_template = Path("chat_template.jinja").read_text(encoding="utf-8")
|
| 129 |
|
| 130 |
-
|
| 131 |
-
{"role": "system", "content": "You are a helpful assistant."},
|
| 132 |
-
{"role": "user", "content": "Uzbek tilida menga salom ber."},
|
| 133 |
-
]
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
-
|
|
|
|
|
|
|
| 140 |
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
-
|
| 144 |
-
- "Quyidagi matnni xulosa qil: ..."
|
| 145 |
-
- "Menga Python'da fayl o'qish misolini ko'rsat."
|
| 146 |
-
- "Inglizchadan o'zbekchaga tarjima qil: ..."
|
| 147 |
|
| 148 |
-
|
| 149 |
-
- "Explain gradient checkpointing in simple terms."
|
| 150 |
-
- "Summarize this document in bullet points: ..."
|
| 151 |
|
| 152 |
-
|
| 153 |
|
| 154 |
-
|
| 155 |
|
| 156 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
-
|
| 159 |
|
| 160 |
```bibtex
|
| 161 |
-
@misc{
|
| 162 |
-
title
|
| 163 |
-
author
|
| 164 |
-
|
| 165 |
-
|
|
|
|
| 166 |
}
|
| 167 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
+
- uz
|
| 4 |
+
- en
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
base_model: Qwen/Qwen3-4B
|
| 7 |
tags:
|
| 8 |
+
- uzbek
|
| 9 |
+
- qwen3
|
| 10 |
+
- language-model
|
| 11 |
+
- text-generation
|
| 12 |
+
- nlp
|
| 13 |
+
- central-asia
|
| 14 |
+
- low-resource
|
| 15 |
+
- tokenizer-optimization
|
| 16 |
+
datasets:
|
| 17 |
+
- behbudiy/alpaca-cleaned-uz
|
| 18 |
+
- NeuronUz/uzbek-spelling-mcq
|
| 19 |
pipeline_tag: text-generation
|
| 20 |
+
model-index:
|
| 21 |
+
- name: NeuronAI-Uzbek
|
| 22 |
+
results:
|
| 23 |
+
- task:
|
| 24 |
+
type: text-generation
|
| 25 |
+
name: Uzbek Language Understanding
|
| 26 |
+
dataset:
|
| 27 |
+
name: UzLiB Benchmark
|
| 28 |
+
type: uzlib
|
| 29 |
+
metrics:
|
| 30 |
+
- type: accuracy
|
| 31 |
+
value: 0.662
|
| 32 |
+
name: Overall Accuracy
|
| 33 |
---
|
| 34 |
|
| 35 |
+
<div align="center">
|
| 36 |
|
| 37 |
+
# πΊπΏ NeuronAI-Uzbek
|
| 38 |
|
| 39 |
+
### The Most Advanced Open-Source Language Model for Uzbek
|
| 40 |
|
| 41 |
+
[](https://huggingface.co/NeuronUz/NeuronAI-Uzbek)
|
| 42 |
+
[](https://opensource.org/licenses/Apache-2.0)
|
| 43 |
+
[](https://huggingface.co/Qwen/Qwen3-4B)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
**π 4th Place Globally | π₯ 1st Place in Uzbekistan on UzLiB Benchmark**
|
| 46 |
|
| 47 |
+
*Outperforming GPT-4o, Claude 3.5 Sonnet, and Gemini 2.5 Flash on Uzbek language tasks*
|
| 48 |
|
| 49 |
+
</div>
|
| 50 |
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## π Key Results
|
| 54 |
+
|
| 55 |
+
<div align="center">
|
| 56 |
+
|
| 57 |
+
| Achievement | Value |
|
| 58 |
+
|-------------|-------|
|
| 59 |
+
| **UzLiB Overall Score** | **0.662** |
|
| 60 |
+
| **Global Ranking** | **#4** |
|
| 61 |
+
| **Regional Ranking** | **#1 in Uzbekistan** |
|
| 62 |
+
| **Tokenizer Efficiency Improvement** | **+22.5%** vs Qwen3-4B |
|
| 63 |
+
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
---
|
| 67 |
+
|
| 68 |
+
## π UzLiB Benchmark Performance
|
| 69 |
+
|
| 70 |
+
NeuronAI-Uzbek achieves exceptional performance on the [UzLiB Benchmark](https://github.com/declansam/UzLiB), the comprehensive evaluation suite for Uzbek language understanding.
|
| 71 |
+
|
| 72 |
+
### Leaderboard Position
|
| 73 |
+
|
| 74 |
+
| Rank | Model | Organization | All | Correct Word | Meaning | Meaning in Context | Fill-in |
|
| 75 |
+
|:----:|-------|--------------|:---:|:------------:|:-------:|:------------------:|:-------:|
|
| 76 |
+
| 1 | Gemini 3 Pro Preview | Google | 0.826 | 0.822 | 0.864 | 0.875 | 0.731 |
|
| 77 |
+
| 2 | Gemini 3 Flash Preview | Google | 0.795 | 0.794 | 0.852 | 0.708 | 0.692 |
|
| 78 |
+
| 3 | Gemini 2.5 Pro | Google | 0.691 | 0.680 | 0.763 | 0.778 | 0.558 |
|
| 79 |
+
| **4** | **NeuronAI-Uzbek (4B)** | **NeuronAI** | **0.662** | **0.718** | **0.466** | **0.333** | **0.385** |
|
| 80 |
+
| 5 | Claude 3.7 Sonnet | Anthropic | 0.651 | 0.643 | 0.725 | 0.708 | 0.481 |
|
| 81 |
+
| 6 | Claude 3.5 Sonnet | Anthropic | 0.636 | 0.644 | 0.598 | 0.722 | 0.462 |
|
| 82 |
+
| 7 | GPT-4o | OpenAI | 0.632 | 0.638 | 0.606 | 0.653 | 0.558 |
|
| 83 |
+
| 8 | Gemini 2.5 Flash | Google | 0.626 | 0.641 | 0.555 | 0.639 | 0.481 |
|
| 84 |
+
| 9 | GPT-5 | OpenAI | 0.616 | 0.632 | 0.576 | 0.542 | 0.423 |
|
| 85 |
+
| - | Human Voters* | - | 0.589 | 0.605 | 0.525 | 0.525 | 0.509 |
|
| 86 |
+
|
| 87 |
+
> **Note**: NeuronAI-Uzbek is the **smallest model** in the top 10, with only **4B parameters**, while competing against models with 100B+ parameters.
|
| 88 |
+
|
| 89 |
+
### Performance Comparison vs Original Qwen3-4B
|
| 90 |
|
| 91 |
+
| Metric | Qwen3-4B (Original) | NeuronAI-Uzbek | Improvement |
|
| 92 |
+
|--------|:-------------------:|:--------------:|:-----------:|
|
| 93 |
+
| **Overall (All)** | 0.345 | **0.662** | **+91.9%** |
|
| 94 |
+
| Correct Word | 0.351 | 0.718 | +104.6% |
|
| 95 |
+
| Meaning | 0.309 | 0.466 | +50.8% |
|
| 96 |
+
| Meaning in Context | 0.347 | 0.333 | -4.0% |
|
| 97 |
+
| Fill-in | 0.327 | 0.385 | +17.7% |
|
| 98 |
|
| 99 |
+
---
|
| 100 |
+
|
| 101 |
+
## π€ Tokenizer Efficiency
|
| 102 |
|
| 103 |
+
We optimized the tokenizer specifically for Uzbek, achieving significantly better tokenization efficiency (lower fertility rate = fewer tokens per word = faster inference and lower costs).
|
| 104 |
|
| 105 |
+
### Fertility Rate Comparison
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
+
| Model | Fertility Rate | Std Dev | Vocab Size | Improvement vs Qwen3 |
|
| 108 |
+
|-------|:--------------:|:-------:|:----------:|:--------------------:|
|
| 109 |
+
| **NeuronAI-Uzbek (Ours)** π | **2.67** | 0.15 | 180,000 | **+22.5%** |
|
| 110 |
+
| Gemma 2-9B | 3.15 | 0.22 | 256,000 | +8.3% |
|
| 111 |
+
| LLaMA 3.1-8B | 3.32 | 0.22 | 128,256 | +3.7% |
|
| 112 |
+
| DeepSeek-V3 | 3.32 | 0.21 | 128,815 | +3.4% |
|
| 113 |
+
| Qwen3-4B (Original) | 3.44 | 0.22 | 151,669 | - |
|
| 114 |
|
| 115 |
+
> **Fertility Rate**: Average number of tokens per word. Lower is better for efficiency.
|
| 116 |
|
| 117 |
+
### What This Means
|
|
|
|
|
|
|
| 118 |
|
| 119 |
+
- **22.5% fewer tokens** needed to represent Uzbek text
|
| 120 |
+
- **Faster inference** due to shorter sequences
|
| 121 |
+
- **Lower API costs** when deployed
|
| 122 |
+
- **Better context utilization** - fit more content in the same context window
|
| 123 |
+
|
| 124 |
+
---
|
| 125 |
|
| 126 |
+
## π οΈ Model Details
|
|
|
|
| 127 |
|
| 128 |
+
### Architecture
|
| 129 |
|
| 130 |
+
| Property | Value |
|
| 131 |
+
|----------|-------|
|
| 132 |
+
| **Base Model** | Qwen3-4B |
|
| 133 |
+
| **Parameters** | 4 Billion |
|
| 134 |
+
| **Vocabulary Size** | 180,000 tokens |
|
| 135 |
+
| **Context Length** | 32,768 tokens |
|
| 136 |
+
| **Architecture** | Transformer (Decoder-only) |
|
| 137 |
+
| **Precision** | BFloat16 |
|
| 138 |
|
| 139 |
+
### Training Methodology
|
| 140 |
|
| 141 |
+
1. **Tokenizer Surgery**: Extended vocabulary with 40,000 Uzbek-optimized tokens
|
| 142 |
+
2. **Embedding Initialization**: Semantic initialization using subword composition
|
| 143 |
+
3. **Continual Pretraining**: Trained on 22GB Uzbek text corpus
|
| 144 |
+
4. **Instruction Fine-tuning**: Aligned using Uzbek and English instruction datasets
|
| 145 |
|
| 146 |
+
### Training Data
|
| 147 |
+
|
| 148 |
+
| Dataset | Type | Purpose |
|
| 149 |
+
|---------|------|---------|
|
| 150 |
+
| Uzbek Web Corpus | Pretraining | Language modeling |
|
| 151 |
+
| behbudiy/alpaca-cleaned-uz | SFT | Uzbek instructions |
|
| 152 |
+
| NeuronUz/uzbek-spelling-mcq | SFT | Benchmark-targeted training |
|
| 153 |
+
| vicgalle/alpaca-gpt4 | SFT | English capability retention |
|
| 154 |
+
|
| 155 |
+
---
|
| 156 |
|
| 157 |
+
## π Quick Start
|
| 158 |
+
|
| 159 |
+
### Installation
|
| 160 |
+
|
| 161 |
+
```bash
|
| 162 |
+
pip install transformers torch
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
### Basic Usage
|
| 166 |
|
| 167 |
```python
|
|
|
|
| 168 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 169 |
|
| 170 |
+
model_name = "NeuronUz/NeuronAI-Uzbek"
|
| 171 |
|
| 172 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
| 173 |
model = AutoModelForCausalLM.from_pretrained(
|
| 174 |
+
model_name,
|
| 175 |
+
torch_dtype="auto",
|
| 176 |
device_map="auto",
|
| 177 |
+
trust_remote_code=True
|
| 178 |
)
|
| 179 |
|
| 180 |
+
prompt = "O'zbekiston haqida qisqacha ma'lumot bering."
|
| 181 |
+
|
| 182 |
+
messages = [
|
| 183 |
+
{"role": "user", "content": prompt}
|
| 184 |
+
]
|
| 185 |
+
|
| 186 |
+
text = tokenizer.apply_chat_template(
|
| 187 |
+
messages,
|
| 188 |
+
tokenize=False,
|
| 189 |
+
add_generation_prompt=True
|
| 190 |
+
)
|
| 191 |
|
| 192 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 193 |
+
outputs = model.generate(
|
| 194 |
+
**inputs,
|
| 195 |
+
max_new_tokens=512,
|
| 196 |
+
temperature=0.7,
|
| 197 |
+
top_p=0.9,
|
| 198 |
+
do_sample=True
|
| 199 |
+
)
|
|
|
|
| 200 |
|
| 201 |
+
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
|
| 202 |
+
print(response)
|
| 203 |
```
|
| 204 |
|
| 205 |
+
### With Thinking Mode (Chain-of-Thought)
|
|
|
|
|
|
|
| 206 |
|
| 207 |
```python
|
| 208 |
+
messages = [
|
| 209 |
+
{"role": "user", "content": "5 ta 3 ga bo'linuvchi 100 dan kichik natural sonlarni toping."}
|
| 210 |
+
]
|
| 211 |
|
| 212 |
+
text = tokenizer.apply_chat_template(
|
| 213 |
+
messages,
|
| 214 |
+
tokenize=False,
|
| 215 |
+
add_generation_prompt=True,
|
| 216 |
+
enable_thinking=True # Enable step-by-step reasoning
|
| 217 |
+
)
|
| 218 |
+
```
|
| 219 |
|
| 220 |
+
---
|
| 221 |
|
| 222 |
+
## π Use Cases
|
|
|
|
| 223 |
|
| 224 |
+
NeuronAI-Uzbek excels at:
|
|
|
|
|
|
|
|
|
|
| 225 |
|
| 226 |
+
- **π Text Generation**: Creative writing, content creation in Uzbek
|
| 227 |
+
- **β Question Answering**: Answering questions about Uzbek culture, history, and general knowledge
|
| 228 |
+
- **π Reading Comprehension**: Understanding and analyzing Uzbek texts
|
| 229 |
+
- **π€ Grammar & Spelling**: Uzbek language correctness tasks
|
| 230 |
+
- **π Translation Assistance**: Uzbek-English language tasks
|
| 231 |
+
- **π¬ Conversational AI**: Building Uzbek chatbots and assistants
|
| 232 |
|
| 233 |
+
---
|
| 234 |
+
|
| 235 |
+
## β οΈ Limitations
|
| 236 |
|
| 237 |
+
- **Knowledge Cutoff**: Training data has a knowledge cutoff date
|
| 238 |
+
- **Hallucinations**: May generate plausible-sounding but incorrect information
|
| 239 |
+
- **Bias**: May reflect biases present in training data
|
| 240 |
+
- **Not for Critical Applications**: Should not be used for medical, legal, or safety-critical applications without human oversight
|
| 241 |
|
| 242 |
+
---
|
|
|
|
|
|
|
|
|
|
| 243 |
|
| 244 |
+
## π License
|
|
|
|
|
|
|
| 245 |
|
| 246 |
+
This model is released under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0).
|
| 247 |
|
| 248 |
+
---
|
| 249 |
|
| 250 |
+
## π Acknowledgments
|
| 251 |
+
|
| 252 |
+
- **Qwen Team** at Alibaba for the excellent Qwen3-4B base model
|
| 253 |
+
- **UzLiB Benchmark** creators for the comprehensive evaluation framework
|
| 254 |
+
- **Uzbek NLP Community** for datasets and linguistic resources
|
| 255 |
+
|
| 256 |
+
---
|
| 257 |
|
| 258 |
+
## π Citation
|
| 259 |
|
| 260 |
```bibtex
|
| 261 |
+
@misc{neuronai-uzbek-2025,
|
| 262 |
+
title={NeuronAI-Uzbek: An Optimized Language Model for Uzbek},
|
| 263 |
+
author={NeuronAI Team},
|
| 264 |
+
year={2025},
|
| 265 |
+
publisher={Hugging Face},
|
| 266 |
+
url={https://huggingface.co/NeuronUz/NeuronAI-Uzbek}
|
| 267 |
}
|
| 268 |
+
```
|
| 269 |
+
|
| 270 |
+
---
|
| 271 |
+
|
| 272 |
+
<div align="center">
|
| 273 |
+
|
| 274 |
+
**Built with β€οΈ in Uzbekistan by [NeuronAI](https://github.com/NeuronUz)**
|
| 275 |
+
|
| 276 |
+
</div>
|