SproutStackSproutStack home

The LLM Training Pipeline

5 min readBeginner-friendlyFree to read

Read a little, play a little. No scary maths, and no rush.

Share:

Three stages, one assistant

A chat model isn't trained in one go — it's built in three passes, each fixing what the last one left unfinished.

Stage 1 — Pretraining: reading the internet

The model predicts the next token across trillions of words: books, code, Wikipedia, forums. From this it absorbs grammar, facts, reasoning patterns, coding idioms — and also biases, misconceptions, and a knowledge cutoff (training data ends on some date; everything after is unknown). The result is a base model: brilliant at completing text, useless at following instructions. Ask it "summarize this" and it may continue with "summarize this…" — completion, not obedience.

Stage 2 — SFT: learning manners

Supervised fine-tuning trains on tens of thousands of hand-written instruction → ideal-response pairs. Now "summarize this in 3 bullets" produces 3 bullets. SFT teaches format, tone, and helpfulness patterns — but barely adds new facts. Think of it as etiquette school for a well-read graduate.

Stage 3 — Preference tuning: learning taste

Human raters rank pairs of answers (helpful? harmless? honest?), and methods like RLHF or the simpler DPO nudge the model toward preferred styles. This is where refusals, balanced tone, and "as an AI" habits come from — and where over-tuning can make models sycophantic or preachy.

Why builders must know this

  • Cutoff is forever: the model can't know your new product, policy, or yesterday's news. Fresh facts need RAG, not a bigger model.
  • Base vs chat: APIs serve chat-tuned models; raw base models (completers) are a different product for different jobs.
  • Behavior is baked, knowledge is rented: fine-tuning teaches style cheaply; facts belong in retrieval.

Where the cost goes

The three stages are wildly different in scale. Pretraining is the giant: thousands of GPUs running for weeks or months over trillions of tokens, a budget only a handful of organizations can afford. SFT and preference tuning use far less data and compute, measured in tens of thousands of examples rather than trillions of tokens.

Your own fine-tuning, if you ever do it, is smaller still: usually a parameter-efficient method like LoRA on a few thousand examples, finishing in hours on one or a few GPUs. That gap is why the practical choices for application builders are "pick a good model, ground it with retrieval, and occasionally fine-tune for style", not "train one".

Reading a model card

Every serious model ships with a model card, a page describing what it is. Before choosing a model, look for:

  • Base or instruct. For an assistant you want the instruction-tuned version.
  • Context window. How many tokens fit in one request.
  • Knowledge cutoff. The date its training data ends, which tells you what it cannot know.
  • License. Whether commercial use is allowed, and on what terms.
  • Intended use and limitations. What the authors tested it for, and what they warn against.

A few minutes on the card prevents choosing a model that legally or technically cannot do the job.

Remember this

  • Pretrain = knowledge (stale). SFT = obedience. Preference = taste.
  • When the model lacks facts, reach for retrieval, not retraining.

Check your understanding

5 questions · first-try answers earn the most XP

1. A base model is asked "summarize this article". What typically happens?
2. What does supervised fine-tuning reliably change, and what does it not?
3. Your product launched a new pricing policy yesterday. The model keeps quoting the old price. What should you fix?
4. What is the risk of over-tuning with preference optimisation?
5. Why does the chapter say "behaviour is baked, knowledge is rented"?

My notes

Saved in this browser. Highlight a line above and save it, or write it in your own words.

Nothing saved yet. Your highlights will live here.

References

Finished reading?

Ticking it here also ticks the chapter in the sidebar, the section count and your streak — it is all one number.

Related chapters

Spotted a mistake or want a topic covered? Report an issue

📬 An occasional email when new lessons land

New lessons and showdowns, no more than a few times a month. No spam, unsubscribe anytime. We store your email only to send the newsletter.