A picture guide, from zero

How AI models are made, fine-tuned and used

No maths and no jargon you will not meet again below. By the end you will know what a model really is, how it learns, what "fine-tuning" means, why a small model can learn from a big one, and how we did it for real.

1The big picture

Every AI chatbot goes through the same three stages. Think of a person: they grow up and read everything, then they train for a job, then they go to work.

1. Pretrainingread a huge part of theinternet, learn languagemonths, millions of dollars 2. Fine-tuningpractise one job withgood exampleshours, a few dollars 3. Using itanswer real questions(called inference)seconds, cents We did stage 2 and stage 3. Stage 1 is done by the company that makes the base model (NVIDIA, for ours).

2Computers only understand numbers

A model cannot read letters. First, the text is chopped into small pieces called tokens (often a word, or part of a word). Each token gets an ID number from a fixed list, and the model works on those numbers.

Show the top 5 custom ers 84312791802205127388 (the numbers here are made up to show the idea)

Then each ID is turned into a longer list of numbers (called an embedding) that captures its meaning: the lists for "cat" and "kitten" end up close to each other, and "cat" and "tax" end up far apart. This is how a model can feel that words are related.

3What a model is, and what weights are

A model is one very large calculation. The input numbers go in, pass through many layers, and the output is a list of probabilities for the next token: "after these words, 'customers' is 62% likely, 'users' 11%, ...". To write a sentence, the model picks one token, adds it, and asks again, over and over.

Inside each layer are adjustable numbers called weights. Think of them as dials. Together they decide how the model turns input into output.

tokensas numbers the model: many layers of dials (weights) next wordwith probabilities our small model has about 4,000,000,000 dials; the big teacher has about 550,000,000,000
Small model (student)
4B
weights. Fits on one rented GPU.
Big model (teacher)
550B
weights. Needs a data centre.

The saved file with all dial settings is "the model weights". "Open weights" means anyone can download that file. The weights are the model: the code that runs them is generic.

4How a model learns: guess, measure the mistake, nudge the dials

At the start the dials are random, so the model outputs nonsense. Training repeats one small loop millions of times:

1. show anexample 2. the modelguesses 3. measurehow wrong (loss) 4. nudgethe dials repeat, with the next example Each nudge is tiny. After enough rounds, the mistakes get smaller.
Loss is a single number saying how wrong the guesses are. Lower is better. In our training it fell from 0.34 to 0.09. Careful: a falling loss only proves the model is fitting its practice examples. It does not prove it will do well on new questions. That is what an exam is for (section 10).

How does it know which way to turn each dial? A bit of calculus (called gradient descent) tells every dial: "if you go up a little, the mistake grows; if you go down, it shrinks." Every dial moves a tiny step in the helpful direction. The size of that step is the learning rate.

5Pretraining: where a model gets its general skills

Pretraining is the same loop, but the examples are enormous amounts of text: "given these words, predict the next one". That is the whole task. To do it well across books, code and websites, the model has to pick up grammar, facts and reasoning patterns along the way.

It takes thousands of GPUs and months, costs millions, and only a few companies do it. The result is a base model. We did not do this. We started from NVIDIA's Nemotron 3 Nano 4B.

A base model is a bit like a very well-read person who has never held a job: knowledgeable, but not yet good at the exact thing you need, and sometimes it rambles or answers in the wrong style.

6Fine-tuning: practice one job

Fine-tuning is the same learning loop again, but with a small, focused set of examples: each one is a prompt (what the user asks) and the right answer you want. A few thousand good examples can change how the model behaves on that task.

prompt (what we give it) A database with tables forartworks and exhibitions, and"Which artworks were shownin the Floating World show?" the right answer (what we want back) SELECT a.titleFROM exhibitions eJOIN ... WHERE e.title ='Floating World'; One training example. Ours are thousands of these, for questions about databases.

During fine-tuning the loss is measured only on the answer part, because that is what we want the model to learn to produce.

7LoRA and QLoRA: fine-tuning on a small, cheap GPU

Changing all 4 billion dials needs a lot of memory, because for every dial the computer also keeps notes on how it is changing. Two tricks make it cheap:

Full fine-tuning all 4 billion dials change lots of memory, big GPUs LoRA base model: frozen 4 billion dials, never touched add-onabout 10 million QLoRA = LoRA + a squeezed base model each frozen dial is stored with 4 bits instead of 16, so the base takes about a quarter of the memory (roughly 8 GB shrinks to a few GB), small enough for a free or cheap GPU

LoRA keeps the big model frozen and trains a small add-on next to its layers (two thin grids of numbers per layer, instead of changing one giant grid). The add-on is a file of only about 40 MB, called an adapter. Take it off, and you have the original model back. The same base model can carry many adapters for different jobs.

That is exactly what we did: QLoRA on a 4-billion-dial model, on one small rented GPU.

8Good training data is most of the work

A model copies what it is shown. If the examples contain wrong answers, it learns wrong answers. So the quality of the examples matters more than their number.

big model writesquestions + answers check each onehere: run the query keep the gooddrop the broken train on them Set some aside as an exam. The model never practises on them. and check that nothing from the exam leaked into the practice set

Ours: a big model (Nemotron 3 Ultra) invented small databases and wrote questions with answers. We ran every answer and kept only the queries that worked. 821 examples in round 1, 4,322 in round 2. We also removed any practice example that matched an exam question.

9The knobs, and the trap called overfitting

Epoch
One full pass over all the examples. We did 2 passes.
Batch size
How many examples the model looks at before it nudges the dials.
Learning rate
How big each nudge is. Too big and it overshoots, too small and it barely learns.
Rank
How big the LoRA add-on is. Ours was 16: small but enough.

Overfitting is memorising the practice examples instead of learning the skill, like a student who memorises last year's answers. Practice scores keep improving, but new questions get worse.

practice error error on new questions more training → stop around here
An illustration of the idea, not our measured data. This is why we keep an exam aside and judge by it.

10Testing honestly

The only fair test is on questions the model has never seen. We use an exam of 172 database questions, 40% from industries the model never practised on. A query is marked right only if running it returns exactly the same rows as the stored reference query.

It is strict.
Each question has one reference answer. A good query that adds an extra column counts as wrong. That is why even the big teacher model scores only about a quarter.
It has a margin.
With 172 questions, a score of 39% really means "somewhere around 32% to 46%". We always show that range, because small tests are noisy.

We also check for leaks: no exam question, answer or database may appear in the training examples. If it did, the score would be fake.

11Using a model, and how it can know when it is unsure

Using a trained model is called inference. For each next word the model gives probabilities, so we can also read how sure it is: a 95% word choice is very different from a 30% one. We can also ask the same question several times and see whether the answers agree. Together this gives a confidence score.

three tries agree: confident try 1: SELECT name FROM t ...try 2: SELECT name FROM t ...try 3: SELECT name FROM t ... use the small model's answer three tries disagree: unsure try 1: SELECT a, b FROM x ...try 2: SELECT a FROM y JOIN ...try 3: SELECT count(*) FROM ... ask the big model instead

12Big teaches small (distillation)

Running a 550-billion-dial model for every question is slow and costly. A 4-billion one is cheap but less skilled. Distillation uses the big model as a teacher: its good answers become the small model's lesson book. The student cannot match the teacher everywhere, but on the questions it has practised it can be close, at a fraction of the price.

A rule worth knowing: only models whose licence allows it may be used as teachers. Some companies forbid using their models' answers to train other models. Ours is an open model, and every lesson records which model wrote it and under what licence. We never train on the student's own answers either, because a model that learns from itself drifts and gets worse.

13Putting it together: Ratchet

Ratchet is a gateway between an app and the models. The app talks to it exactly like it talks to OpenAI. Behind it, the small model answers first, and the big one steps in only when the small one is unsure. Then the system learns from what the big model answered.

1. your app sends a question 2. gateway checks itkey, limits, which job it is 3. small model answerstries a few times, checks agreement 4. confidentenough? yes no small model's answerfast and cheap big model answersslower, costs more 5. answer goes back, then, off the main path: logged (who answered, cost) · big model's answers saved as lessons now and then the big model re-checks a small-model answer (an audit)

The lessons saved in step 5 have personal data removed first. The audits matter: they measure how often the small model is truly right, so the system never just trusts it.

Every night: the system improves itself

1. collect 2. train 3. exam gate 4. shadow 5. canary the big model's lessonsa new 40 MB add-onmust beat the current modelanswers compared quietly10%, 50%, 100% of traffic the next night starts again with more lessons If quality drops at any step, it rolls back by itself each add-on carries a signed list of exactly what it was trained on

Simulation The nightly release and automatic rollback have been tested with mock models only; they have not yet run live. Real The data, the training and the exam below did happen.

14The real numbers

Exam of 172 database questions the model never trained on, scored strictly (the same rows as the reference query).

Who answeredRightScore
Small model, no training22 of 17212.8%
Big model (teacher), same questions44 of 17225.6%
Small model after round 1 (821 examples)57 of 17233.1%
Small model after round 2 (4,322 examples)67 of 17239.0%
no traininground 1round 2 12.8% 33.1% 39.0%
What this honestly means

Training made the small model about three times better on this strict exam, for roughly $15 of big-model answers and a few dollars of rented GPU. More examples helped, though part of the round 2 gain could be luck, and almost all of it is on questions that join tables.

It is not ready to replace the big model: at a 95% precision target its confidence gate lets almost nothing through. That is the safety check doing its job, not a bug.

Training ran on a free Colab GPU and a rented Modal GPU. The data is synthetic.

Glossary

Token
A small piece of text (often a word) that the model reads as a number.
Weights / parameters
The adjustable numbers inside a model. They hold everything it has learned.
Loss
One number for "how wrong the model is" during training. Lower is better.
Pretraining
The huge first training on general text that creates a base model.
Fine-tuning
Extra training on examples of one job.
LoRA / adapter
Training a small add-on instead of the whole model. The add-on file is the adapter.
QLoRA
LoRA with the frozen base squeezed to 4-bit numbers to save memory.
Epoch
One pass over all the training examples.
Overfitting
Memorising the practice examples and doing worse on new ones.
Inference
Using a trained model to answer questions.
Distillation
A small model learning from a big model's answers.
Teacher / student
The big model that writes lessons, and the small one that learns them.
Confidence
How sure the model seems, from its probabilities and whether repeated tries agree.
Audit
A spot check: the big model answers a question the small one already did, to see if they agree.
Rollback
Going back to the previous model automatically when a new one does worse.