What this is about
A language model starts out knowing nothing. Training is how it learns. You show it a piece of text with the next word hidden. It guesses. You measure how wrong the guess was. You change its inner numbers a tiny bit so the next guess is a little less wrong. Then you do it again, many thousands of times.
That is the whole idea. Everything else is detail about doing the loop fast and keeping it honest. This article walks through the loop once, slowly, with our own small model as the example.
Why it matters
Training is where the cost lives. It decides how long a graphics card is busy, how much text you must collect, and what the model can do at the end. If you know the loop, you can read any "we trained a model" claim and ask the right questions. How much text did it see? How was it scored? Was the score measured on text it had never seen?
It also takes some magic out of the topic. A trained model is not a mind that was taught. It is a big table of numbers that was nudged, again and again, until its guesses got better.
How it works, step by step
Step 1: Start with random numbers. A model is a large set of numbers called parameters. At the start they are random. A model with random parameters writes nonsense. Ours, Metis, has 72,632,320 of them. We come back to what a parameter is in the next article of this series.
Step 2: Show it a piece of text. We cut the training text into small pieces called tokens. The model gets a run of tokens and must guess the next one. In one of our runs each step used 16,384 tokens at a time. The model makes a guess for every position in that run, so one step holds thousands of small exams.
Step 3: Measure how wrong it was. We know the real next token, because it is in the text. So we can score each guess. A wrong guess gets a high penalty. A confident right guess gets a low one. Add the penalties up and you get one number for the whole step. This number is called the loss.
We also watch a related score on text the model has never seen. We use bits per byte: how many bits the model needs to describe one byte of fresh text. Lower is better. This is the fair judge, because a model can look great on text it has memorized. In our larger run of the same model, this score fell from 1.664 to 1.294.
Step 4: Nudge the numbers. Now comes the clever part. For every parameter, the computer works out which direction would have made the loss smaller. Then it moves each parameter a very small amount in that direction. The size of the nudge is called the learning rate. In our small-model tests the plain recipe started at 3e-4, which is 0.0003. A big nudge can overshoot. A tiny one wastes time. Many of our tests were about finding a good size.
The method that does the nudging is called an optimizer. The one that won in our tests is called AdamW. We compared many newer ideas against it, and the plain recipe held.
Step 5: Repeat. One pass through steps 2 to 4 is called an update. The model gets a bit less wrong after each one. After thousands of updates, the guesses are good enough to be useful.
A real run, with real numbers
Here is one small run of ours. Metis was trained to call four of our tools: a calculator, a lookup in our notes, a page fetch and a small script runner. The training text mixed Wikipedia, our own redacted notes and worked math problems.
The run used 2,400 updates of 16,384 tokens each, so the model read about 39 million tokens. Each update took about 168 milliseconds. The whole thing took 405 seconds on one RX 7900 XTX, a gaming graphics card. After it, we asked 56 questions the model had never seen. It used a real tool result in 22 of them. A control model with no tool training scored 0 of 56.
Then we gave the same model ten times more text. It went from about 0.5 tokens of training text per parameter to about 5.5. It answered 55 of the 56 tool questions. Same model, same recipe, more reading.
Read those two results with care. Twenty-two of 56 is not "good". It is proof that the loop works. And the second run shows that the biggest lever was not a clever trick. It was more text.
What the loop does not do
Training does not guarantee the model gets better at everything. In the first run above, the model got worse at general reading, even as it got better at tools. Its score on a last-word guessing test moved from 45.5 to 80.2, which is the wrong way (lower is better there). The loop improves what you measure and feed it. It can cost you something you did not measure.
It also does not prove the model understands. We did not see our common-sense test move, even with ten times more text. A trained model is a pattern that scores well on a test. Whether that is more than that is a bigger question than one run can answer.
Words you may not know
- Parameter: one number inside the model that training adjusts.
- Token: a small piece of text, often a word or part of a word.
- Loss: one number that says how wrong the guesses were in a step.
- Learning rate: how big each nudge is.
- Optimizer: the method that decides how to nudge. AdamW is one.
- Update: one full turn of the loop: show, guess, measure, nudge.
- Bits per byte: a score for text the model has not seen. Lower is better.
Try it
You can see the engine our small models run in on the mojo-baro project page. It is an inference engine for AMD graphics cards, with every GPU kernel written in Mojo. Its code is on GitHub. Our tool mokei estimates how many tokens a file holds. Try it on a page of your own text, and you will see why tokens, not letters, are the unit of training.
If you want to talk through training with us, our forum is at gllm.forum. Bring your own numbers. We like checking them.
Read next
Our results for the small model are in 400 Million Tokens for 73 Million Parameters, which has the full table of what the extra text did, and Closed at 63M: What Lost, which lists every training change we tried against plain AdamW.

Comentarios
Aún no hay comentarios.
Iniciar sesión para comentar.