Instructions to use rntdev/dykan with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use rntdev/dykan with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("rntdev/dykan") config = load_config("rntdev/dykan") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Dykan: Ukrainian Gemma 4 E4B and E2B
Ukrainian fine-tunes of google/gemma-4-E4B-it and google/gemma-4-E2B-it for Dykan, an offline school assistant for students in Ukraine. The models explain and solve school and ZNO/NMT tasks in Ukrainian, can think step by step before answering, and carry out multi-step requests with whatever tools the app declares (homework, grades, timetable, messages, reminders).
Code, data pipeline and evals: https://github.com/rntdev1/dykan
Files
| Folder | What | Size |
|---|---|---|
e4b/lora/ |
LoRA adapter for google/gemma-4-E4B-it (full precision with the base model) |
532 MB |
e4b/mlx-4bit/ |
E4B merged and quantized to 4-bit for MLX, with the vision encoder | 4.8 GB |
e2b/lora/ |
LoRA adapter for google/gemma-4-E2B-it |
92 MB |
e2b/mlx-4bit/ |
E2B merged and quantized to 4-bit for MLX, with the vision encoder | 3.3 GB |
Results
Held-out ZNO/NMT exams 2020–2024 (1,111 text tasks, answer only, greedy) and 130 multi-step tool episodes on a simulated school backend, scored on the end state of the backend. Full precision (bf16); the 4-bit builds have not been evaluated separately.
| Gemma 4 E4B | Dykan E4B | Gemma 4 E2B | Dykan E2B | |
|---|---|---|---|---|
| Exams, all subjects | 43.6% | 50.3% | 32.8% | 39.3% |
| Ukrainian language and literature | 36.7% | 41.6% | 26.5% | 32.4% |
| History of Ukraine | 47.5% | 55.1% | 33.5% | 44.3% |
| Geography | 71.2% | 82.1% | 60.3% | 64.7% |
| Maths | 27.1% | 33.9% | 22.0% | 22.9% |
| Tool tasks completed | 83.8% | 97.7% | 53.1% | 95.4% |
| Tool tasks, tools under never-seen names | 73.8% | 97.7% | 53.8% | 96.2% |
| Tool tasks, calendar in the system prompt | — | 100% | — | 98.5% |
For comparison on the same exam set: MamayLM 4B v1.0 36.8%, MamayLM 12B v2.0 56.4% (both Gemma 3).
Training
- LoRA on the attention and MLP projections of the language model (rank 64 for E4B, rank 16 for E2B; at rank 64 E2B's exam answers collapsed). Vision and audio encoders, embeddings and output layer are unchanged.
- One shuffled pass over two copies of an instruction set (about 62,600 examples) plus 36,000 school-relevant articles from Ukrainian Wikipedia (39.8M words):
- pre-2020 ZNO/NMT tasks with official answer keys, and worked solutions verified against the key and fact-checked;
- curriculum tasks, explanations, tutoring dialogues and general chat generated by Gemma 4 31B on our own GPUs and filtered by answer checks, blind re-solving, fact checks and a clean-Ukrainian filter;
- 4,415 worked solutions in thinking form (the working in Gemma's thinking channel, then a short answer);
- tool episodes on a simulated school backend, half of them under randomly renamed tools, plus episodes with tools invented for other domains.
- Exam forms from 2020 onward were held out, and all training text was filtered against them for near-duplicates. No commercial-API outputs were used.
Use
Give the model today's date, the time and a short calendar in the system prompt; without them it gets weekday arithmetic wrong. Tools are declared with the standard Gemma 4 chat template; tool results go back as tool_responses on the assistant message.
Transformers (full precision):
from peft import PeftModel
from transformers import AutoModelForMultimodalLM, AutoProcessor
base = "google/gemma-4-E4B-it" # or google/gemma-4-E2B-it with subfolder="e2b/lora"
processor = AutoProcessor.from_pretrained(base)
model = AutoModelForMultimodalLM.from_pretrained(base, dtype="bfloat16", device_map="auto")
model = PeftModel.from_pretrained(model, "rntdev/dykan", subfolder="e4b/lora").merge_and_unload()
messages = [
{"role": "system", "content": "Ти — Дикань, шкільний асистент. Відповідай українською, коротко й по суті. "
"Сьогодні понеділок, 16 листопада 2026 року (2026-11-16), зараз 15:30."},
{"role": "user", "content": "У трикутнику дві сторони 5 см і 8 см, кут між ними 60°. Знайди третю сторону."},
]
inputs = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=True, return_dict=True,
return_tensors="pt", enable_thinking=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=600, do_sample=False)
print(processor.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=False))
With enable_thinking=True the model writes its working between <|channel>thought and <channel|>, then a short answer; with False it answers directly, explaining as it goes.
MLX on a Mac (4-bit, offline):
hf download rntdev/dykan --include "e4b/mlx-4bit/*" --local-dir dykan
git clone https://github.com/rntdev1/dykan dykan-code && cd dykan-code
uv run --extra mac python -m demo.chat --model ../dykan/e4b/mlx-4bit # /think toggles thinking; image paths attach pictures
Limitations
- Knowledge ends before early 2025, and the model can state wrong facts confidently, including inside its thinking. Check important facts, dates and rules against a textbook.
- Not trained on images: picture understanding is that of the base model.
- E2B is much weaker than E4B (39% vs 50% on exams); prefer E4B where the device allows it.
- Exam scores are answer-only.
- The 4-bit builds and on-phone runtimes have not been evaluated. Stock Gemma 4 E2B showed looping and garbled Ukrainian in one phone runtime that did not occur in full precision.
Data and licence
Apache 2.0, like the base models. Training included Ukrainian Wikipedia text (CC BY-SA). ZNO/NMT exam tasks belong to the Ukrainian Center for Educational Quality Assessment (UCEQA, testportal.gov.ua); they were used for training and evaluation and are not redistributed. The training data is not released because it contains them.
References
- Gemma 4 Technical Report, arXiv:2607.02770
- ZNO-Eval, arXiv:2501.06715;
NLPForUA/zno-eval - MamayLM (INSAIT), huggingface.co/INSAIT-Institute; BgGPT 1.0, arXiv:2412.10893
Quantized