Fine-tuning language models
Adapting an open model to a low-resource language: building the dataset, training on a laptop, then checking the output with real speakers.
Most of my time on MangARTI went into the dataset and into fitting training onto a laptop GPU. These are the habits I’ve kept from it.
-
Decide the task before collecting data
A classifier and a translator need different data, different evaluation and a different interface. MangARTI changed task once, and the data had to change with it. Now I write down the exact input and output before anything else.
-
Build the dataset if there isn’t one
For a language with almost no resources, there was nothing to download. A strong general model drafted source sentences in bulk and native speakers wrote the target side. Each example is stored as an instruction, an input and an output in Alpaca-format JSONL, one example per line.
-
Pick a method that fits the GPU
On a laptop GPU, VRAM decides what’s possible. QLoRA keeps the base model frozen in 4-bit precision and trains only small low-rank adapters, which is what let me fine-tune an 8B model on a laptop. Gradient checkpointing and an 8-bit optimiser cut memory use further.
-
Test on sentences the model hasn’t seen
Training loss only tells me how well a model fits its training data. For MangARTI mini I wrote a separate set of 300 test sentences and score every run on it with chrF, BLEU and exact match. I still read the outputs too, because a score can’t tell me whether a sentence sounds like something a Manado speaker would say.
-
Check the data before the hyperparameters
Revising the dataset by hand, not changing the training settings, is what fixed MangARTI’s hallucinations. Now I look at the data first.
Finally, I write down where the model stops working: MangARTI’s model card says plainly that it translates single sentences and degrades on paragraphs.