Teaching a 50M Model to Finish a Story
After my first training run, I gave the model the beginning of a sentence, "The capital of France is." It described a big field, then sent a girl named Emily for a walk in the park. I tried a different opening about a little dog. This time the model named him Max, put an apple on the table, and had his owner give it to him. The difference between those two answers makes sense once you know what the model had been reading.
How a sentence becomes a training example
Take the sentence "The dog ran home." After "The," the model gets a chance to predict "dog." After "The dog," it gets another chance to predict "ran." The original text supplies the answer at every position. During training I can score all those predictions at once by hiding the text to the right of each position. A low probability for the piece that actually came next means a larger training loss. When generating a story, the model has to pick one piece, add it to the text, and use it to predict the next.
In practice, the pieces are called tokens. I built my tokenizer from 200,000 FineWeb-Edu documents. It starts with bytes and repeatedly joins pieces that often occur together, building a vocabulary of 8,192 entries. A common word can fit in a single token, while an unfamiliar word can take several.
The model reads up to 1,024 tokens at a time. It represents each position with 640 numbers and passes them through ten Transformer layers. Counting the layers, the vocabulary table, and the other weights gives a total of 50.7 million parameters. Each parameter is a number that training can adjust.
Two checks before the first long run
With random weights, the model should give roughly equal odds to every token. For a vocabulary of 8,192, that puts the expected starting loss near 9.01, the natural logarithm of 8,192. I measured 9.13. Next I fed it the same batch over and over. The loss fell to 0.0003. The training code could make the model learn that batch well enough to memorize it. Now I could ask how it did on text it had never been given as an exercise.
I started with TinyStories, a collection of short English stories with simple vocabulary. Training on 500 million tokens took about 49 minutes on an RTX 5070 Ti with 16 GB of memory. That run produced both Max and Emily. The model had learned enough about stories to continue a scene and write dialogue. It applied the same habit to geography and arithmetic prompts.
Scoring the same model on different text
I measured prediction quality in bits per byte, or BPB. Think of using the model to compress a passage. If it can usually anticipate what comes next, fewer bits are needed to record what the author actually wrote. Dividing by the number of bytes in the passage lets me compare tokenizers on the same text. Lower is better.
My story model scored 0.517 BPB on held-out stories and 2.58 BPB on FineWeb-Edu web pages. The weights were identical in both evaluations. I also checked for copied passages. About 28% of the evaluated story tokens fell in 64-token stretches that appeared verbatim in the training file. After I removed windows with such matches, the score was 0.515. Those exact copies had little effect on this score.
I then trained a fresh model of the same size on a billion tokens of educational web text. Given a prompt about photosynthesis, it began by saying that plants convert sunlight to energy. A few sentences later it was repeating itself. The change of reading material had given it a plausible way to start an explanation. Keeping that explanation accurate from beginning to end was still beyond it. Model and baseline experiments