Lessons and outlineLesson 3 of 11
AI Concepts in PicturesLesson 3
How a Model Is Made: Training, Fine-Tuning, LoRA and Friends
The stages of training, and the tricks that make models smaller and cheaper.
Models are made in stages: pretraining, instruction tuning and feedback. Fine-tuning adds your own examples. LoRA trains a small add-on. Distillation teaches a small model to copy a big one. Quantization shrinks a model's numbers.
- Pretraining
- Learning language and facts by guessing the next token.
- Fine-tuning
- More training on your own examples.
- Quantization
- Storing numbers with fewer digits to make a model smaller.
Match each description to the stage of making a model.
Read huge text and guess the next token.
Learn from many question and answer examples.
People rank which of two answers is better.
Train on a company's own support replies.
A small student model learns to copy a big teacher.
Store the numbers with fewer digits.
How does a model get its skills? Not in one step. A model goes through stages, like a person going from school to a job. This lesson walks through the stages in plain words. Then it explains three tricks that make models smaller or cheaper: LoRA, distillation and quantization.
Stage one: pretraining
First the model reads an enormous amount of text. Its only task is to guess the next token. By doing this billions of times, it learns grammar, facts, styles and patterns. The result is a base model. It knows a lot, but it is not helpful yet. Ask it a question, and it may just continue the text.
Stage two: instruction tuning
Next, people show the model many examples of a question and a good answer. The model learns to follow instructions. Now it behaves like an assistant.
Stage three: feedback
Then people, and sometimes other AI systems, compare answers. They mark which answer is better. The model learns to prefer helpful, honest and safe replies. You will often see this called learning from human feedback. This is why chat models are polite and refuse some requests.
- Strongest on hard tasks
- Slower and costlier
- Needs strong computers
- Fast and cheap
- Good for narrow jobs
- Can run on a laptop or phone
Extra stage: fine-tuning
Fine-tuning means more training on your own examples. A company might train on thousands of its own support replies. The model then copies that style and format better. Fine-tuning is good for steady behaviour. It is not a reliable way to add many new facts.
Three tricks for smaller and cheaper
- LoRA: instead of changing the whole model, you train a small add-on. It is cheaper and quicker, and you can swap add-ons.
- Distillation: a big teacher model helps train a small student model to copy its answers. The student is faster and cheaper.
- Quantization: store the model's numbers with fewer digits. The model gets smaller and runs faster. A little quality may be lost.
Why you should care
- It explains why models know a lot, yet may be out of date. Training stops at some point.
- It explains why chat models are polite. Feedback shaped them.
- It helps you choose between a big model and a tuned small one for a job.
A simple example
Say a clinic wants an assistant that writes patient letters in a calm, clear style. It starts with a general chat model. Prompts get close but not close enough. So the clinic fine-tunes on a few thousand good letters. Now the style is steady. To keep it cheap, the clinic uses a small tuned model rather than the biggest one. Each choice came from one stage on this page.
- ✓Models are made in stages: pretraining, instruction tuning and feedback.
- ✓Fine-tuning adds your own examples. It is best for style and format.
- ✓LoRA trains a small add-on instead of the whole model.
- ✓Distillation teaches a small model to copy a big one.
- ✓Quantization stores numbers with fewer digits so the model is smaller and faster.
Match a need to a trick
- Write three needs, such as faster replies, a brand voice and running on a phone.
- Next to each, write which idea helps: fine-tuning, LoRA, distillation or quantization.
- Write one risk for each choice.
- Share your table with a friend and compare answers.
Q1What does pretraining teach a model?show answer
Language, facts and patterns, by guessing the next token over a huge amount of text.
Q2What is the aim of fine-tuning?show answer
To make the model copy your examples, which helps with style, format and steady behaviour.
Q3How is distillation different from quantization?show answer
Distillation trains a small model to copy a big one. Quantization shrinks a model's numbers to save space and time.