In Feb–Apr 2024, I researched how AI could actually be useful to Tanzanian secondary-school teachers for my master's thesis at KTH. Together with the Tanzania AI Community, I visited three schools in Dar es Salaam, interviewed teachers and observed lessons.
There were three main findings: WhatsApp was already the default digital tool, continuous assessment meant teachers spent a lot of time writing exercises, and any useful material had to follow the national competency-based curriculum.
So I decided to build my teaching assistant inside WhatsApp.
building twiga
I built Twiga around this, initially focusing on geography exercise generation. A smaller Llama model rewrote short teacher messages for retrieval, then hybrid semantic and keyword search found relevant passages and example exercises in Tanzanian Institute of Education textbooks. A cross-encoder reranked the results before Llama 3 70B generated the final material.
To check whether each extra step earned its complexity, I compared seven model and pipeline setups using automatic metrics, multi-dimension grading, pairwise surveys and an ablation study. The selected RAG pipeline retrieved relevant source material for 89% of the evaluation prompts and was substantially more grounded than the controls without retrieval. I then connected it to WhatsApp and trialled it with some Tanzanian teachers.
from thesis to product
I open-sourced the research code and then moved the production bot into the community repository. The first production architecture was deliberately simple: Meta's WhatsApp API fed a FastAPI service, with Postgres and pgvector holding conversations and curriculum material and open models handling the generation.
Twiga has since grown from one exercise generator into an agent that can search the curriculum, create lesson plans and NECTA-style exams, and solve equations. The beta is free for Tanzanian teachers and has now onboarded more than 500 of them.
award and community
In September 2024, Twiga won a Meta Llama Impact Innovation Award worth $50k. We gave the award to the Tanzania AI Community to turn the thesis prototype into a maintained public tool.
In May 2025, we signed a three-year MOU with the Tanzania Institute of Education, giving Twiga access to the official secondary-school curriculum and support for evaluation and research. KTH AI Society kept leading parts of the development, and Aalto AI Society joined in 2026. The team is now around 20 people across three countries.