EduGanda-Gemma-4-E2B-v5 (edu-ganda-gemma-e2b-v5)

The final model of Crane AI Labs' Proposal 2 work (Fab AI Foundation, funded by the Gates Foundation): an offline Luganda assistant for Primary 1 to 3 teachers that plans lessons, drills phonics, sets and marks assessments and drafts messages to parents, sized to run on a phone.

v5 is a SLERP merge, at weight 0.5, of two Crane Gemma-4-E2B checkpoints (built 2 September 2026):

  • v5-Polished (internal a065_polished_v2), the teaching model: pedagogy fine-tuning, then reinforcement learning against loops, for exact numeracy and for translation; and
  • v4 (EduGanda-Gemma-4-E2B-v4), from the dictionary-trained language line, which brings its Luganda vocabulary and instruction-style training.

Results (guard-free, greedy)

Measure v5 v5-Polished v4 Gemma-4-E2B (base)
Judge (Gemini 3.7 Flash, mean of three passes, full-length answers): all instructions followed, 25-task teacher bank 74.7% 65.3% 64.0% 81.3%
Judge: task quality, 0 to 10 6.13 5.43 4.95 7.53
Judge: Luganda written, of the 6 tasks that ask for Luganda 5 5 6 5
Judge: Luganda quality, 0 to 10 (requested Luganda missing = 0) 2.67 0.50 3.90 0.28
Instruction adherence, 220 program-checked prompts 72.3% 70.5% 63.6% 59.1%
Numeracy, 150 held-out problems 72.0% 68.7% 73.3% 48.7%
Translation, MAFAND-MT test (1,500 sentences), chrF++ Luganda→English 48.4 47.8 48.9 17.6
Translation, MAFAND-MT, chrF++ English→Luganda 41.9 41.5 44.1 14.6
Loops without a guard, 60 essay / 60 drill prompts 10.0% / 28.3% 5.0% / 33.3% 13.3% / 41.7% 70.0% / 16.7%
Fab AI Foundation LLPK, Luganda / English 76 / 90 79 / 88 12 / 73 62 / 91

Limitations

  • Luganda content errors remain on a minority of tasks (a wrong gloss, a false phonics rule, English where Luganda was asked for), and the judged quality of its Luganda is low (2.67 of 10). The untuned base scores higher on the judge's instruction and task measures with long, mostly English answers, but its Luganda is judged near zero. Review Luganda content before use with learners.
  • Short answers under a "be concise" system prompt. v5 follows the system prompt closely; ask for the complete artifact (lesson, song, passage) rather than a concise answer.
  • Loops without a guard on some drill prompts; use the repetition guard below.

Serving settings

  • Stop tokens: use the model's own generation_config (eos_token_id = [1, 106, 50], which includes <turn|>, id 106, the Gemma-4 end of turn). Do not pass the Gemma-3 <end_of_turn> token; it does not exist in the Gemma-4 vocabulary.
  • Repetition guard: repetition_penalty=1.0 with no_repeat_ngram_size=4. In a sweep on v5 this held loops at zero with 68.3% numeracy and 70.8% instruction adherence, against 60.8% and 63.3% for the older 1.15 / 3 guard.
  • The chat template already inserts <bos>; tokenise the templated text with add_special_tokens=False so it is not added twice.
  • Greedy decoding recommended.

Usage

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

MODEL = "CraneAILabs/edu-ganda-gemma-e2b-v5"
tok = AutoTokenizer.from_pretrained(MODEL)
model = AutoModelForCausalLM.from_pretrained(MODEL, torch_dtype=torch.bfloat16, device_map="auto").eval()

def chat(prompt, max_new_tokens=512):
    text = tok.apply_chat_template([{"role": "user", "content": prompt}],
                                   add_generation_prompt=True, tokenize=False)
    inputs = tok(text, return_tensors="pt", add_special_tokens=False).to(model.device)  # template has <bos>
    out = model.generate(**inputs, max_new_tokens=max_new_tokens, do_sample=False,
                         repetition_penalty=1.0, no_repeat_ngram_size=4)  # stop tokens come from generation_config
    return tok.decode(out[0, inputs.input_ids.shape[1]:], skip_special_tokens=True).strip()

print(chat("Nnyonnyola engeri y'okunaaba engalo mu Luganda."))

Experimental research checkpoint. Review Luganda content before use with learners.

Technical note (benign)

On load, transformers may report self_attn.k_proj, v_proj and k_norm for language-model layers 15 to 34 as unused or missing in the v4 parent; Gemma-4-E2B's last 20 layers share keys and values with earlier layers and never read their own. The merge keeps v5-Polished's values for those tensors and for the untied output head, which is why v5 has 5.53 billion parameters against v4's 5.10.

Gotcha: stop tokens

Gemma-4 ends a turn with <turn|> (token 106). Do not pass Gemma-3's <end_of_turn> as a stop token: it does not exist in the Gemma-4 vocabulary, so generation will not stop at the end of the answer and the model keeps writing unrelated text. Leave eos_token_id unset (the checkpoint's generation_config already stops on [1, 106, 50]), or include 106 if you pass your own list.

Downloads last month
56
Safetensors
Model size
6B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support