Downloads · 30 days
365
7% of all-time downloads
regnant-io/kw5-109M-instruct
kw5-109M-instruct is a text generation model from regnant-io. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A 109.5M-parameter Swahili instruction model, LoRA fine-tuned from kw5-109M. It writes fluent Swahili in answer form. It does not read passages, does not decline questions it cannot answer, and gets facts wrong often.…
Downloads · 30 days
365
7% of all-time downloads
All-time downloads
5K
Public
Parameters
110M
439 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors219 MB · 98%
From the Hugging Face model README
A 109.5M-parameter Swahili instruction model, LoRA fine-tuned from kw5-109M. It writes fluent Swahili in answer form. It does not read passages, does not decline questions it cannot answer, and gets facts wrong often. The measurements are below.
The newer kw5-149M-instruct-r2 is better at reading and at declining.
Built by Regnant.
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("regnant-io/kw5-109M-instruct")
tok = AutoTokenizer.from_pretrained("regnant-io/kw5-109M-instruct")
messages = [{"role": "user", "content": "Orodhesha majina ya miji mitano ya Tanzania."}]
prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# add_special_tokens=False: the template already emits <s>.
inputs = tok(prompt, return_tensors="pt", add_special_tokens=False)
out = model.generate(**inputs, max_new_tokens=256)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Output with torch.manual_seed(0) on CPU:
1. Dar es salaam
2. Dodoma
3. Morogoro
4. Tanga
5. Kilimanjaro
6. Arusha
7. Moshi
8. Zanzibar
9. Pwani
10. Jiji la Nairobi
Asked for five, it gave ten. Kilimanjaro and Pwani are regions, and Nairobi is in Kenya.
The shipped generation_config.json samples at temperature 0.2, top-p 0.9,
repetition penalty 1.3.
<s>[INST] {user} [/INST] {assistant}</s>[INST] {user2} [/INST] {assistant2}</s>
with an optional system block inside the first [INST] only:
<s>[INST] <<SYS>>
{system}
<</SYS>>
{user} [/INST]
apply_chat_template produces exactly this. If you build prompts by hand:
add_special_tokens=False. The template already emits <s>.<|system|>, <|user|> or <|assistant|> (ids 4 to 6). They
never appeared in pretraining and LoRA left embed_tokens frozen, so those
rows are untrained and prompting with them returns noise.Keep prompt plus reply under 1024 tokens. The base model was trained at 1024 and its loss rises sharply past that point (see the base card).
The same 924-item Swahili suite is run on every KW5 instruct model, greedy, in each model's own chat format. Percent correct:
| what is measured | n | this model | kw5-149M-instruct | kw5-149M-instruct-r2 |
|---|---|---|---|---|
| answer a question from a real passage | 250 | 2.4 | 39.2 | 43.2 |
| pick the right one of two facts in a passage | 48 | 2.1 | 27.1 | 54.2 |
| say the passage does not contain the answer | 60 | 15.0 | 5.0 | 33.3 |
| decline a question nobody could answer | 40 | 2.5 | 42.5 | 55.0 |
| answer (not decline) an easy question | 30 | 100 | 86.7 | 90.0 |
| ...and get it right | 30 | 20.0 | 56.7 | 56.7 |
| follow-up question in a conversation | 8 | 12.5 | 12.5 | 37.5 |
| remember and correct across turns | 12 | 0.0 | 41.7 | 33.3 |
| list exactly N items | 16 | 43.8 | 12.5 | 43.8 |
| arithmetic | 128 | 2.3 | 0.8 | 2.3 |
| word problems / AfriMGSM | 24 / 100 | 0 / 0 | 0 / 1 | 0 / 0 |
| TruthfulQA MC1 (chance 27.7) | 200 | 29.0 | 29.5 | 30.5 |
Passages come from TyDiQA-GoldP (Swahili dev) and Swahili Wikipedia; a reading answer counts if it contains the gold span or reaches token F1 0.5. The reading prompts are short (median 146 tokens), so the low score is not a context-length effect: the model answers from memory and ignores the passage.
| Parameters | 109.5M (tied input and output embeddings) |
| Architecture | Llama-compatible decoder-only transformer |
| Layers / hidden / FFN | 12 / 768 / 2048 |
| Attention | 12 query heads, 12 key-value heads (standard multi-head attention) |
| Position encoding | RoPE, theta 10,000, trained at 1024 tokens |
| Vocabulary | 32,000 SentencePiece BPE |
| Precision | FP16 |
| Base | kw5-109M, step 6,150 |
| Method | LoRA, merged into the base weights |
| Rank / alpha | 16 / 32 |
| Adapted modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Frozen | embed_tokens and lm_head (tied), all norms |
| Data | about 107,000 Swahili instruction and conversation examples, loss on assistant turns only |
| Hardware | 1 NVIDIA T4 |
The rank and module list were recovered from the published weights: the singular values of (merged minus base) cut off after 16 for every adapted projection, and every other tensor matches the base bit for bit.
The data combines regnant-io/swahili-instruction-22k (Apache 2.0) and Benjamin-png/swahili-instruction-mix, which is published under CC BY-NC 4.0. Only 137 of the 107,150 examples teach the model to say it does not know, which is consistent with the 2.5% above.
@misc{kw5_109m_instruct_2026,
title = {KW5 109M Instruct: a Swahili instruction model},
author = {Regnant},
year = {2026},
url = {https://huggingface.co/regnant-io/kw5-109M-instruct}
}
Apache 2.0 for the weights; see the note on training data licences above.