Ghana Assistant (Flan-T5-small)
Author: Ghana Open AI
Supported by Ghana NLP
A 77M-parameter model that powers Ghana Assistant: landmark-based spoken directions in Accra and Kumasi, and short answers about Ghana from retrieved news and research. The model never has to remember facts: the route plan comes from a road graph and the context sentences from a noun-phrase index; the model reads them and writes the reply.
Code, retrieval and deployment: GhanaNLP/ghana-assistant · Training data: ghananlpcommunity/ghana-assistant-data
Four skills, one model (choose with a prefix)
| Prefix | Input | Output |
|---|---|---|
intent: | the user's message | navigation or knowledge |
parse: | a navigation message | task: avoid | start: … | end: … | avoid: … |
directions: | Request: … + Route plan: … (from the road graph) | spoken, landmark-based directions |
answer: | Question: … + Context: 1. [2025-10] … | a short answer |
Use
The easiest way is the package, which also does routing and retrieval:
pip install git+https://github.com/GhanaNLP/ghana-assistant
ghana-assistant "How do I get from Kejetia Market to Bantama Market?"
Raw model (you supply the route plan or context yourself):
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tok = AutoTokenizer.from_pretrained("ghananlpcommunity/ghana-assistant-flan-t5-small")
model = AutoModelForSeq2SeqLM.from_pretrained("ghananlpcommunity/ghana-assistant-flan-t5-small")
x = tok("intent: How do I get from Kejetia Market to KNUST?", return_tensors="pt")
print(tok.decode(model.generate(**x, max_new_tokens=4)[0], skip_special_tokens=True)) # navigation
For answer: use num_beams=4, no_repeat_ngram_size=2, repetition_penalty=1.3; for the other prefixes plain greedy decoding.
Results (held-out data)
| Skill | Test | Result |
|---|---|---|
| Intent | 2,000 unseen messages | 100% |
| Directions | 200 routes in neighbourhoods never seen in training | 98.5% pass the fact-check (no invented roads, correct counted turns and sides, no distances) |
| Parse | 500 unseen navigation messages | 88.4% exactly right (task 100%, end 97%, start 94%) |
| Knowledge | GhanaQA questions | Weak: answers are fluent but often not supported by the retrieved context and sometimes wrong. Treat them as unverified. |
Runs on CPU: about 2–4 s for directions and about 1–2 s for knowledge answers.
Training
Full fine-tune of google/flan-t5-small, one pass over 2,042,327 examples (261k directions, 1.42M knowledge answers, 261k parse, 100k intent), learning rate 5e-4 with cosine decay, batch size 64, on one H200.
Limitations
- Directions cover Accra and Kumasi only, and only what OpenStreetMap contains; unknown places are reported rather than guessed.
- Knowledge answers are not reliable enough for important decisions (legal, health, financial).
- English only.
Licence
CC-BY-NC-4.0, following the most restrictive training data (GhanaQA). Navigation data is derived from OpenStreetMap (© OpenStreetMap contributors, ODbL). Built by Ghana Open AI, supported by Ghana NLP.