Downloads · 30 days
4
7% of all-time downloads
notingemiu/llama-3.2-3b-ukrainian-alpaca-lora
llama-3.2-3b-ukrainian-alpaca-lora is a machine learning model from notingemiu. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as llama3.2.
A LoRA adapter that fine-tunes Llama-3.2-3B-Instruct to follow instructions in Ukrainian — responding consistently in Ukrainian to questions and tasks, instead of defaulting to English or code-switching.
Downloads · 30 days
4
7% of all-time downloads
All-time downloads
56
Public
Repo size
115 MB
Likes
0
Public
Click a slice to open those files.
.safetensors97.3 MB · 85%
From the Hugging Face model README
A LoRA adapter that fine-tunes Llama-3.2-3B-Instruct to follow instructions in Ukrainian — responding consistently in Ukrainian to questions and tasks, instead of defaulting to English or code-switching.
Trained on the saillab/alpaca-ukrainian-cleaned dataset (a translation of Stanford Alpaca into Ukrainian) using Unsloth on a free Google Colab T4 GPU.
Input: A user question or instruction in Ukrainian. Output: An answer in Ukrainian, in an instruction-following assistant style.
This section is intentionally honest — both successes and failures are shown, because the failures are pedagogically more useful than the wins.
Q: Розкажи коротко про різницю між машинним навчанням та глибоким навчанням.
A:
Машинне навчання — це процес, який використовує алгоритми та підхід, щоб виявляти та навчати шаблонів у даних, без будь-якої конспікування або розуміння. Глибоке навчання — це тип машинного навчання, який використовує глибоку нейронну мережу (ГНН) для виявлення та навчання шаблонів у даних. ГНН складається з декількох шарів, які дозволяють моделі виявляти та навчати складніші шаблони, ніж традиційні алгоритми.
Structurally correct, terminology mostly accurate (one invented word — "конспікування"). Ukrainian is grammatical and natural.
Q: Напиши вірш про осінь у Карпатах, 4 рядки.
A:
В Карпатах осінь, як пала, Думає про те, що з'являється, Зими спати, та дожди стихають. Залижки заліза, золоті, Світло, що пронизує, і сніг, що хрустить під ногою.
No rhyme, structure deviates from the requested 4 lines, and includes nonsensical imagery ("залижки заліза"). Creative writing is a known weak spot of small models after light instruction tuning.
Q: Як приготувати борщ? Список основних інгредієнтів та послідовність дій.
A (excerpt):
Інгредієнти: 1. Тушон (барбарис) 2. Зелена капуста 3. Сіль 4. Чай 5. Угорський перець ... 8. Сок гrapeфруіта ... 21. Зброяна сметана ...
Severe hallucination. The model invents ingredients (grapefruit juice, "armed sour cream", chai, "rouletonny shar"), omits beetroot, occasionally code-switches into English ("grape"). The Ukrainian instruction-tuned base does not encode authentic Ukrainian cuisine knowledge — and 250 LoRA steps on translated Alpaca data does not teach it.
Q: Поясни простими словами, що таке RAG у контексті LLM.
A:
РAG означає «збережена гілка» у контексті Large Language Model (LLM). Це означає, що в моделі LLM є окрема гілка, яка збережена та не змінюється, коли модель створюється...
Completely wrong. RAG stands for Retrieval-Augmented Generation. The base Llama-3.2-3B does know RAG in English but the Ukrainian-tuned adapter pushes confident wrong answers in Ukrainian.
This adapter is a clean demonstration of one of the most important properties of LoRA fine-tuning:
LoRA changes the model's behavior (respond in Ukrainian, follow instruction format), but does not add new knowledge.
The model is now more compliant in Ukrainian — but on topics where Llama-3.2-3B never had reliable knowledge (Ukrainian cuisine specifics, recent technical terms in Ukrainian), it confidently produces wrong answers. The 2,000 training examples shifted the response distribution; they did not encyclopedically teach Ukrainian-language facts.
Production implication: for factual answers about a specific domain, this adapter must be combined with Retrieval-Augmented Generation (RAG) — retrieve relevant Ukrainian documents at inference time, supply them as context, and let the fine-tuned model phrase the answer. Fine-tuning alone is insufficient.
| Parameter | Value |
|---|---|
| Base model | unsloth/Llama-3.2-3B-Instruct |
| Method | LoRA (PEFT) via Unsloth |
| Dataset | saillab/alpaca-ukrainian-cleaned — 2,000 examples (random subset, seed=42) |
| Trainable params | 24.3M / 3.24B (0.75%) |
| LoRA config | r=16, alpha=16, dropout=0, target modules: Q/K/V/O + gate/up/down |
| Loss masking | train_on_responses_only — only assistant tokens contribute to loss |
| Optimizer | adamw_8bit, lr=2e-4, linear schedule, warmup 5 steps |
| Batch | per-device 2 × grad-accum 4 = effective 8 |
| Steps | 250 (= 1 epoch on 2,000 examples) |
| Hardware | Google Colab T4 (free) |
| Training time | ~10 minutes |
| Final loss | converged from ~2.0 to ~0.9 |
✅ Good for:
❌ Not appropriate for:
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
base = "unsloth/Llama-3.2-3B-Instruct"
adapter = "notingemiu/llama-3.2-3b-ukrainian-alpaca-lora"
tokenizer = AutoTokenizer.from_pretrained(adapter)
model = AutoModelForCausalLM.from_pretrained(
base, torch_dtype=torch.float16, device_map="auto"
)
model = PeftModel.from_pretrained(model, adapter)
SYSTEM_PROMPT = "Ти — корисний помічник, що відповідає українською мовою грамотно та чітко."
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "Що таке нейронна мережа? Поясни простими словами."},
]
inputs = tokenizer.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
out = model.generate(
input_ids=inputs, max_new_tokens=300, temperature=0.7, do_sample=True, top_p=0.9
)
print(tokenizer.decode(out[0], skip_special_tokens=True))
This adapter is paired with notingemiu/llama-3.2-3b-text2sql-lora — a text-to-SQL LoRA on the same base model. Together they form a small portfolio demonstrating two distinct LoRA use-cases: format/skill specialization (text-to-SQL) and language/style adaptation (Ukrainian instruction-following).
Built as part of a portfolio for AI/LLM Engineer roles. Feedback welcome.