stukenov's picture
docs: add examples, finish model card
6e74f8a verified
|
Raw
History Blame Contribute Delete
4.29 kB
---
license: apache-2.0
language:
- kk
library_name: transformers
pipeline_tag: text-generation
tags:
- kazakh
- kazakh-language
- qwen2
- morpheme-bpe
- til-core
- tilqazyna
- instruct
- sft
base_model: TilQazyna/Til-Core-0.5B
datasets:
- AmanMussa/kazakh-instruction-v2
---
# Til Core 0.5B Instruct
**Til Core 0.5B Instruct** is the instruction-tuned variant of [**Til Core 0.5B**](https://huggingface.co/TilQazyna/Til-Core-0.5B) — a 498M-parameter Qwen2 Kazakh model with a 256K morpheme-aware vocabulary. It was supervised-fine-tuned (SFT) on Kazakh instruction data to follow instructions in Kazakh.
> Experiment `exp053`. Part of the Til Core program (TilQazyna).
## Training (SFT)
| | |
|---|---|
| Base | `TilQazyna/Til-Core-0.5B` (from-scratch, 256K morphbpe) |
| Data | [`AmanMussa/kazakh-instruction-v2`](https://huggingface.co/datasets/AmanMussa/kazakh-instruction-v2) — 52,201 Kazakh instruction examples (Alpaca format) |
| Format | Alpaca (Kazakh template), completion-only loss masking |
| Epochs | 3 (612 steps, global batch 256) |
| Optimizer | AdamW, lr 2e-5 cosine, warmup 3%, wd 0.01, grad-clip 1.0, bf16 |
| Hardware | 8 × NVIDIA H200 |
| Final train loss | 3.12 |
## Prompt format (Alpaca, Kazakh)
```
### Нұсқаулық:
{instruction}
### Жауап:
```
or with input:
```
### Нұсқаулық:
{instruction}
### Кіріс:
{input}
### Жауап:
```
## Usage
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "TilQazyna/Til-Core-0.5B-Instruct"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto").eval()
prompt = "### Нұсқаулық:\nДені сау болу үшін үш кеңес беріңіз.\n\n### Жауап:\n"
ids = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**ids, max_new_tokens=120, do_sample=True,
temperature=0.7, top_p=0.9, repetition_penalty=1.2)
print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
```
## Examples
Real generations (temperature 0.7, top_p 0.9, repetition_penalty 1.2):
**Tips (list following):**
```
### Нұсқаулық: Дені сау болу үшін үш кеңес беріңіз.
→ 1. Үнемі жаттығу жасаңыз және сіздің денеңізді босаңсытыңыз.
2. Қажетсіз, тым көп тамақ жеуге болмайды.
3. Тұрақты жаттығулар жасауды бастаңыз және үнемі үзіліс жасаңыз.
```
**Short writing:**
```
### Нұсқаулық: Көктем мезгілі туралы қысқаша жаз.
→ Көктемде жердің жылуы, құстардың үні және адамдар өздерінің ерекше
мерекесі үшін қуанды. Олар жаңбыр жауып, күн батқанда, өздерімен
бірге жаңа жапырақтар мен гүлдерді әкелді.
```
**Explanation:**
```
### Нұсқаулық: Достық деген не? Қысқаша түсіндір.
→ Дос — бұл достарына, олармен бірге жаңа адамдардың пайда болуына
және олардың арасындағы қарым-қатынасты дамытуға мүмкіндік беретін
ерекше тұлға. Ол әрқашан бір-бірінің достығын қолдайды...
```
The model reliably **follows the format and writes fluent Kazakh**; it is weaker on precise/factual tasks (see Limitations).
## Limitations
- **498M params** — follows instructions and writes fluent Kazakh, but **factual accuracy is weak** (it can hallucinate facts, e.g. wrong capitals). Use for fluency / format / as an SFT baseline, not as a knowledge source.
- SFT only (no RLHF/DPO); no safety alignment.
- Single-turn Alpaca format; not a multi-turn chat model.
## Reproducibility
seed 42 · base `TilQazyna/Til-Core-0.5B` · data `AmanMussa/kazakh-instruction-v2`@`c641407` · `transformers==5.10.2`, `torch==2.11.0+cu128` · config `exp053` · `torchrun --nproc_per_node=8 -m slm.train_sft --config configs/experiments/exp053_sft_til_core_05b.yaml`.