Hekima: An Offline Multilingual Math, Reasoning & Science Tutor

Inspiration

Millions of African students prepare for high-stakes exams (WAEC, JAMB) with little access to step-by-step tutoring; and most AI tutors need the cloud, ignore local languages, and can't run on a ₦100k–170k budget laptop. We built Hekima (Swahili for "wisdom"): a small model that reasons out loud, offline, in the learner's own language.

What we learned

QLoRA fine-tuning on a compact multilingual base can teach genuine multi-step reasoning without a 70B model. GGUF/Q4_K_M quantization makes a 3.3B-class model run fully on CPU. Designing fair evaluations across five languages, especially low-resource Igbo taught us how fragile English-centric benchmarks are.

How we built it

  • Base: Tiny-Aya, fine-tuned with QLoRA on a Colab T4.
  • Data: masakhane/afrimgsm, masakhane/afrimmlu, cais/mmlu (STEM), openai/gsm8k, worldboss/waec-integrated-science-2007, honourjesus/nllb-hausa-waec-translations, plus curated bilingual step-by-step pairs.
  • Quantized to GGUF Q4_K_M and served offline via llama.cpp.
  • Cross-disciplinary pairing: education (load-bearing) — exam practice is one deployment, not the only one.

Worked example the model produces (Yoruba/English):

$$E = 2 + 0.5 + 2 = 4.5\ \text{kWh}$$

Challenges

Non-English mathematical reasoning, scarce Igbo data (we added a 20-question WAEC eval + 14 curated pairs), keeping the model small enough for a budget laptop, and building a fully offline, reproducible pipeline.

Built With

  • afrigms
  • colab
  • gguf
  • hugging-face
  • llama.cpp
  • lora
  • python
  • pytorch
  • qlora
  • tiny-aya-global
Share this project:

Updates