Understanding Foundation Models
AI Engineer path · lesson 55 of 124See what a foundation model is pretrained on, derive the compute-optimal split between model size and training tokens, and step the pretrain → SFT → preference-tuning pipeline that turns a text completer into an assistant.
Key insight
Curation is where the capability comes from. Two labs with identical architectures and identical compute produce noticeably different models, and the difference is almost entirely what they chose to train on and what they chose to throw away.
How a chat model gets made
Order the training stages.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
- 1Drop a step here
- 2Drop a step here
- 3Drop a step here
- 4Drop a step here
- 5Drop a step here
Test your knowledge
The pretraining objective for a foundation language model is:
The short version
Pretraining is reading the entire library and learning to finish any sentence. Supervised finetuning is being taught that when someone asks a question you answer it. Preference tuning is learning which of two correct answers a person actually wanted. Same reader, three different kinds of schooling.
In more depth
Understanding Foundation Models
A foundation model is a next-token predictor trained on a very large corpus, then repaired by post-training into something usable.
Training data determines the shape of capability
Web-scale corpora are dominated by whatever is abundant online — English is roughly half, and 100+ languages share the tail. A model is worst exactly where its data was thinnest: low-resource languages, private domains, specialised corpora, and anything after the cutoff.
Scaling laws
Training compute is approximately C = 6ND (N parameters, D tokens). Compute-optimal training puts D ≈ 20N, so N = √(C / 120). A large model starved of data loses to a smaller one trained properly on the same budget.
Production models are often over-trained past this point on purpose: training compute is paid once, inference compute is paid per call forever.
Post-training
Reading a model size
Parameters predict memory tightly, cost and latency loosely (MoE breaks the link), and capability badly. Data quality, token budget and post-training separate models at the same size.
Interview Questions
References & Further Reading
Related topics
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required