Qal
Why Qal
A few paragraphs in Tigrinya once took me more than an HOUR to write.
I kept hesitating over characters I’d known since childhood, because I hadn’t written in them for years. Like most of us, I text in Tigrinya with English letters (“Kemey hadirka?” instead of “ከመይ ሓዲርካ፧”) because it feels faster in the moment.
And that habit makes sense once you look at the tools. Tigrinya is spoken by over 7 million people across Eritrea, Ethiopia and the diaspora, and its digital tools are still catching up.
Researchers, linguists and developers have pushed them forward for years with keyboards, translation, datasets and research (Qal stands on all of that work).
For long-form writing, though, the gaps are still there:
- limited autocomplete
- minimal spell-check
- limited voice typing
So Qal starts right where I got stuck that day, with typing. It’s a real-time autocomplete system powered by a small Tigrinya-first language model I trained from scratch on limited data.
What I Built
Getting there meant building every layer of the system from scratch, starting with the one thing Tigrinya has least of, which is data.
I collected a 70M+ token dataset across 2.4M sentences, then built pipelines to clean, normalize, filter and deduplicate it.
With the data in place, I trained custom BPE tokenizers at 8K, 16K and 32K vocabularies and weighed each one on coverage, sequence length and efficiency.
Then I moved on to the model itself. I built and trained GPT-2 style transformers from scratch, from 2M to 69M parameters, with a training pipeline that runs on one GPU or several. The final model (8 layers, 12 heads, 768 dimensions, 8K vocab) reached a perplexity of 16.36 (lower is better).
To make it feel like real autocomplete, I built an inference API with FastAPI and Server-Sent Events, so suggestions stream in as you type.
And once it worked, I released it on Hugging Face:
- five model tiers, from 5.8M to 69.4M parameters
- the pretraining data behind them
It runs end to end, from raw text to suggestions you can try in the demo.
Key Technical Decisions
With so little public Tigrinya text to learn from, I couldn’t just copy the design settings of models built for high-resource languages like English. Model size, vocabulary size, context length and training setup all had to be chosen around Tigrinya’s data constraints.
The biggest surprise came from tokenization. Larger vocabularies compressed the text better, but smaller vocabularies performed better in training, so the final model uses 8K instead of 16K or 32K.
With 8K, the model had less to memorize, fewer rare tokens to learn, and a better chance of using the data well.
That points to the bigger lesson of the whole project. Settings built for high-resource languages don’t always carry over to low-resource ones like Tigrinya.
The Journey
I’m sharing the whole build in Building Qal, a 7-part technical series with one part for each stage:
- Why Qal
- Data collection and cleaning
- Tokenization design
- Model architecture, split into the GPT-2 style model and how scaling laws shaped its design
- Training experiments and results
- Inference and deployment
- Lessons learned
Each part covers the decisions I made, the mistakes along the way, and the parts that were harder than expected (there were a few).
If you want to dig in yourself, the code is on GitHub, and all five tiers and the dataset are on Hugging Face, so you can inspect them, improve them, or build something better.
Stack
Here’s everything Qal runs on:
- Python and PyTorch
- a GPT-2 style transformer
- Hugging Face Tokenizers
- single-GPU and multi-GPU training
- FastAPI and Server-Sent Events for inference
- a Mac Studio locally and Modal in the cloud