Downloads · 30 days
74
17% of all-time downloads
Fallovski/smallm-wolof
smallm-wolof is a text generation model from Fallovski. Use it when you need the model to write or continue text. The card lists the license as mit.
A 16.5M-parameter sparse Mixture-of-Experts language model trained from scratch on Wolof, a Senegalese language with very limited digital resources. This is a research/proof-of-concept project, not a production model…
Downloads · 30 days
74
17% of all-time downloads
All-time downloads
439
Public
Parameters
16.5M
67 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors65.9 MB · 99%
From the Hugging Face model README
A 16.5M-parameter sparse Mixture-of-Experts language model trained from scratch on Wolof, a Senegalese language with very limited digital resources. This is a research/proof-of-concept project, not a production model — see Limitations before using it for anything beyond experimentation.
Wolof has no dedicated open reasoning/generative LLM despite being spoken by ~10M+ people across Senegal, Mauritania, and Gambia. Existing multilingual LLMs (Gemini, GPT-4o, Gemma, Qwen) are all weak in Wolof because it represents a tiny fraction of their training data. This project explores what a from-scratch, Wolof-first small model can achieve when the whole pipeline — tokenizer, architecture, data, training recipe — is designed around the constraints of a genuinely low-resource language, instead of Wolof being an afterthought in a 100+-language mix.
| Parameters | 16.5M |
| Layers | 8 |
| Hidden size | 320 |
| Attention | Grouped-Query Attention (8 heads, 2 KV heads) + RoPE |
| Feed-forward | Sparse MoE, 4 experts, top-2 routing, SwiGLU |
| Vocab size | 8,192 (dedicated BPE tokenizer, not reused from another model) |
| Context length | 512 tokens |
| Embeddings | Tied input/output |
Design choices, and why:
~9.7M tokens, unified from multiple sources and deduplicated (exact + near-duplicate via SimHash): Wikipedia (Wolof), FineWeb2, MADLAD-400, SMOL-doc, plus smaller lexicon/instruction sources (Jolof, Aya, Gatitos). GSM8K (7,473 grade-school math problems), machine-translated to Wolof and quality-checked, is folded directly into the pretraining mix rather than kept as a separate SFT stage — at this parameter budget, a strict CPT-then-SFT split wastes capacity; mixing lets the model see the reasoning pattern throughout training.
Recipe: 18 epochs (chosen per data-constrained scaling literature: repeating data up to ~4 epochs is nearly free, meaningful gains extend to ~16, returns vanish around 40), AdamW, cosine LR schedule with warmup, bf16 mixed precision. Final validation loss: 3.48 (perplexity ≈32.5). Train/val loss divergence after epoch ~13 indicates mild overfitting, consistent with the token budget being well below what this parameter count would ideally need.
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("Fallovski/smallm-wolof", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("Fallovski/smallm-wolof")
inputs = tokenizer("Sama xarit", return_tensors="pt")
output = model.generate(
**inputs,
max_new_tokens=100,
do_sample=True,
temperature=0.85,
top_k=40,
repetition_penalty=1.3, # important: without this the model loops on short/common prompts
)
print(tokenizer.decode(output[0], skip_special_tokens=True))
trust_remote_code=True is required — this is a custom architecture, not a
standard transformers model class.
Read this before drawing conclusions from the model's output.
#### answer" formatting) convincingly,
but arithmetic in generated reasoning chains is frequently wrong — it
has learned the form of reasoning, not reliable calculation.repetition_penalty >= 1.3;
even then, some prompts still degrade after a few dozen tokens.modeling_smallm_wolof.py / configuration_smallm_wolof.py — custom
architecture code (loaded via trust_remote_code=True)model.safetensors — trained weightstokenizer.json — dedicated BPE tokenizerIf you build on this, please note it is a research/educational project, not a peer-reviewed publication. No formal citation is required, but a link back to this repository is appreciated.