# How Models Are Trained

Author: Ishwar Jangid
Canonical URL: https://ishwarj.com/books/how-models-are-trained/
Updated: 2026-10-11
Source: https://github.com/ishwar6/ishwar-books/blob/main/content/books/how-models-are-trained/index.md


A model that has only read the internet can finish your sentence, but it cannot answer your question. Something happens between the raw model and the assistant you talk to, and that something has a history, a set of equations and a lot of practical tricks. This book explains all of it, one step at a time.

It is written for beginners, in simple English. Every idea comes with the research paper that introduced it (shown as highlighted screenshots), a simple picture, the maths explained one symbol at a time with real numbers, and small pieces of real code that you can run yourself, with every line explained.

**Part 1, the big picture**, covers what training actually changes inside a model, how the methods began and evolved, and how anyone can tell whether a model got better.

**Part 2, from base model to instruction follower**, covers pretraining (the data, the compute arithmetic, scaling laws, and a tiny GPT trained from scratch) and supervised fine-tuning (instruction datasets, chat templates, the masked loss, LoRA, and a real fine-tune of a small open model).

**Part 3, learning from feedback**, covers reinforcement learning from scratch, reward models and RLHF with PPO.

