Text Generation
Transformers
Safetensors
Kazakh
qwen2
kazakh
kazakh-language
morpheme-bpe
til-core
tilqazyna
instruct
sft
text-generation-inference
Instructions to use TilQazyna/Til-Core-0.5B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TilQazyna/Til-Core-0.5B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TilQazyna/Til-Core-0.5B-Instruct", device_map="auto")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TilQazyna/Til-Core-0.5B-Instruct") model = AutoModelForCausalLM.from_pretrained("TilQazyna/Til-Core-0.5B-Instruct", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TilQazyna/Til-Core-0.5B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TilQazyna/Til-Core-0.5B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TilQazyna/Til-Core-0.5B-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TilQazyna/Til-Core-0.5B-Instruct
- SGLang
How to use TilQazyna/Til-Core-0.5B-Instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "TilQazyna/Til-Core-0.5B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TilQazyna/Til-Core-0.5B-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "TilQazyna/Til-Core-0.5B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TilQazyna/Til-Core-0.5B-Instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TilQazyna/Til-Core-0.5B-Instruct with Docker Model Runner:
docker model run hf.co/TilQazyna/Til-Core-0.5B-Instruct
| 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`. | |