Tutorial trains small Portuguese language models from scratch on one consumer GPU
An arXiv tutorial releases a tested Python package and notebooks for building 11–12M-parameter autoregressive and masked diffusion models at home, with a preregistered evaluation protocol for specialist legal tasks.
In plain words
Researchers published a tutorial showing how to build a very small language model from scratch, including its tokenizer, on a single consumer GPU. The model can generate text two ways — predicting the next word, or filling in masked parts — and the tutorial includes tests for judging whether such a model suits a specialist domain like Brazilian law.
What was announced
The tutorial proposes no new method but releases a tested Python package, two Brazilian Portuguese notebooks, a preregistered comparison protocol, and legal tasks built from text alone, with reference numbers for models of 11 to 12M parameters. On Brazilian prose and federal laws, the authors report that the autoregressive mode peaks at 64 epochs over the same text and then memorises it, while masked diffusion improves up to 256 epochs. At their best test points, the diffusion bound exceeds the autoregressive likelihood by 0.06 bits per byte, within the preregistered minimum effect.
Results are mixed on held-out laws and acts published after training: the small model ties a 6-gram floor in likelihood and loses to it at continuing those acts, though it beats the floor at detecting tampered text. It fills cross-references more often than the floor and public models of 160M and 630M parameters, but only in decrees, a genre absent from training, and in filling the blank only when each group weighs the same. On laws, the public models, trained with roughly 5x10^2 to 10^5 times its compute, lead in tampered text and continuation. The blind human reading is preregistered but not part of this version.
What it does not show
- The source is the paper abstract only; the full article was not reviewed.
- The blind human reading is preregistered but not included in this version of the paper.
- The reported advantages are narrow: the model ties or loses to a 6-gram floor on several held-out tasks, and public models trained with far more compute lead on laws in tampered-text detection and continuation.
For security and IT teams
- Scope
- The release covers models of 11 to 12M parameters evaluated on Brazilian legal text; the abstract reports no general-domain or production deployment results.
Sources
Source-support review completed 3 Dec 2026. This story was drafted with AI assistance and checked against retained source passages. Automated checking is not independent verification.
Coverage: arXiv: abstract.
Updates and corrections
No corrections so far.
First published 3 Dec 2026
New to the subject? AI from the Ground Up starts from the beginning.