Views
No views yet
ytu-ce-cosmos/Turkish-Llama-8b-Instruct-v0.1, specialised for K–12 STEM and coding education in Turkish (Arduino, Scratch, mBlock, robotics, Python, electronics, algorithms). Trained on the eding-stem-tr-instruct-1k dataset.1 0 20 40 60 80 100
2BLEU base ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 4.8
3 FT ███████████████████░░░░░░░░░░░░░░░░░░░░░ 46.9 ▲ ~10x
4ROUGE-L base █████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 12.1
5 FT █████████████████████████░░░░░░░░░░░░░░░ 61.4 ▲ ~5x
6BERTScore base █████████████████████░░░░░░░░░░░░░░░░░░░ 51.7
7 FT █████████████████████████████████░░░░░░░ 81.4 ▲ +29.7| Metric | 🔴 Base (zero-shot) | 🟢 Fine-tuned |
|---|---|---|
| BLEU | 4.81 | 46.94 |
| ROUGE-L | 12.05 | 61.38 |
| BERTScore-F1 (tr) | 51.70 | 81.43 |
Note: A large part of the BLEU/ROUGE gain reflects the model learning the dataset's concise answer format (the base model is correct but verbose). The BERTScore (semantic) gain shows genuine content-similarity improvement. Read the result as strong alignment to the target instructional style + a semantic-quality gain.
| Base model | ytu-ce-cosmos/Turkish-Llama-8b-Instruct-v0.1 (Llama-3, 8B) |
| Method | QLoRA (4-bit NF4 + double quant) + NEFTune |
| LoRA | r=16, alpha=32, dropout 0.05, all linear layers (q/k/v/o/gate/up/down_proj) |
| Trainable params | 41,943,040 / 8,030,261,248 (0.52% → 99.48% reduction) |
| Effective batch | 16 · seq len 512 (T4) / 1024 (L4·A100) |
| Optimizer | paged_adamw_32bit, LR 2e-4 cosine, 3 epochs |
| Hardware | single GPU (T4 / L4 / A100), auto fp16·bf16 |
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
3from peft import PeftModel
4
5BASE = "ytu-ce-cosmos/Turkish-Llama-8b-Instruct-v0.1"
6ADAPTER = "alimkacar/Turkish-Llama-8B-STEM-QLoRA"
7
8bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",
9 bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_use_double_quant=True)
10model = AutoModelForCausalLM.from_pretrained(BASE, quantization_config=bnb, device_map="auto")
11model = PeftModel.from_pretrained(model, ADAPTER)
12tok = AutoTokenizer.from_pretrained(ADAPTER)
13
14messages = [
15 {"role": "system", "content": "Sen bir Türkçe K-12 STEM ve kodlama eğitimi asistanısın. "
16 "Cevaplarını Türkçe ver, kodda her satırı açıkla."},
17 {"role": "user", "content": "Arduino ile servo motor nasıl kontrol edilir?"},
18]
19ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
20eot = tok.convert_tokens_to_ids("<|eot_id|>")
21out = model.generate(ids, max_new_tokens=400, do_sample=True, temperature=0.7,
22 top_p=0.9, eos_token_id=[tok.eos_token_id, eot])
23print(tok.decode(out[0][ids.shape[-1]:], skip_special_tokens=True))1@misc{eding-stem-tr-2026,
2 title = {Eding STEM TR: Turkish K-12 STEM Instruction Dataset & QLoRA Fine-tuning},
3 author = {Alim Kacar},
4 year = {2026},
5 note = {Eding Internship project}
6}alimkacar/stem-tr-instruct-1k · Base: ytu-ce-cosmos/Turkish-Llama-8b-Instruct-v0.1 (Llama-3 license).