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.