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

Downloads last month

-

Downloads are not tracked for this model. How to track
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for rntdev/dykan

Adapter
(232)
this model

Papers for rntdev/dykan