Stage 4 · Assumes you can code · Fine-tuning and cost

Fine-Tuning for Real

SFT, LoRA, and preference training — data quality beats the method.

The previous lesson is when to fine-tune. This one is how, at the level you need to not waste a quarter.

SFT (supervised fine-tuning) imitates input → output pairs. LoRA / PEFT freeze the base model and learn small adapters — cheaper to train and to swap per tenant or task. Preference methods (DPO and cousins) learn from (chosen, rejected) pairs: style, hedging, refusals. All of these still predict tokens. None of them is a good wiki.

Constrained decoding (Structured Output) still belongs after a fine-tune. A 98% valid-JSON adapter plus a grammar beats hoping the remaining 2% never hits production.

Three Ways to Actually Fine-Tune
Supervised fine-tune
Show (input → desired output) pairs. The model imitates them. Great for format and tone; it will also imitate your label errors and your outdated facts.

Three common recipes. Click each: they shape behavior, not your Q3 refund table.

All lessons in Stage 4: Builders (optional)