Skip to content

19.6 Evaluation and fine-tune scope

This part of Choosing Training and Adaptation Methods develops the mechanisms below. Work the numerical examples or trace the code before checking the answer.

Concepts from other sections (16)

This section uses these ideas. Each has a short definition and a link to the section that explains it in full. Tap a dotted term in the text to preview it.

Learning objectives

  • Choose an adaptation method from a measured failure and available data.

Everything so far equips you for the practitioner’s core loop: decide, measure, train, measure again. Scoping starts by asking whether the problem needs fine-tuning at all.

Most requests for fine-tuning are really requests for something else. The table maps symptoms to the first fix to try and to the case where fine-tuning does win:

SymptomFirst fixFine-tune when
Model lacks facts or private, changing knowledgeRAG (Retrieval and RAG)never for fast-changing facts; fine-tuning is poor at reliable knowledge injection
Wrong format, style, tone, schemaprompting + few-shot + structured outputprompt is long, brittle, or eats latency/cost: SFT/LoRA bakes it in
Narrow task, high volume, latency or cost boundprompt a large model to get a baselineSFT or distill into a small model; often the biggest ROI
“Better” is a preference, not a labelprompt iterationDPO on chosen/rejected pairs
Correctness is checkable (code runs, answer matches, schema validates)prompting + verification loopRFT / GRPO with the checker as reward
Domain language the base barely knows (new language, proprietary DSL)nonecontinued pretraining (billions of tokens), then SFT

Each method consumes a different shape of data, in different amounts:

MethodData shapePractical minimumTypical
SFT (LoRA)prompt → ideal responsea few hundred high-quality1K-50K
DPOprompt, chosen, rejected~1K pairs5K-100K
RFT / GRPOprompts + grader (no answers needed)100s of prompts the model sometimes solves1K-20K
Distillationprompts (teacher writes responses)1K10K-1M

Warning: GRPO needs a base pass rate strictly between 0 and 1 on the training prompts. If every sample in a group gets the same reward, then A^i=0\hat{A}_i = 0 for all of them and nothing is learned. Prompts the model always solves or never solves are wasted.

If you cannot measure base versus tuned on a held-out set the customer agrees with, you are not ready to train. The procedure has five steps. First, build the held-out evaluation set before training, with the customer, from real traffic; freeze it and deduplicate it against the training set. Second, define the metric (exact match, pass@k, or a rubric scored by an LLM judge calibrated against human labels) and the threshold for shipping. Third, measure the base model, the base model with the best prompt you can write, and the tuned model on the same set; the prompt baseline is the honest comparison. Fourth, also run a general-capability regression, such as a slice of MMLU-Pro, IFEval, or the customer’s other use cases, to catch catastrophic forgetting. Fifth, watch train and eval loss per epoch, because overfitting on small SFT sets shows up within 2-3 epochs.

The mitigations for catastrophic forgetting are LoRA instead of full fine-tuning, fewer epochs and a lower learning rate, replay (mixing in 5-20% general instruction data), a KL penalty to the base (built into DPO and GRPO), and evaluating the general set at every checkpoint. Evaluation design is covered in depth in LLM Evaluation.

The cost estimate reuses the pretraining arithmetic with a different constant:

D_train = examples × avg_tokens_per_example × epochs
FLOPs = k · N · D_train k = 6 (full FT), ≈ 4 (LoRA / QLoRA)
GPU-hours = FLOPs / (peak_FLOP/s × MFU) / 3600
$ = GPU-hours × $/GPU-hour + data creation + eval runs + (RL: rollout GPU-hours, often > training)

Work an example. Five thousand examples of 800 tokens for 3 epochs is 12M tokens. On an 8B with LoRA that is 4×8×109×1.2×107=3.8×10174 \times 8\times10^9 \times 1.2\times10^7 = 3.8\times10^{17} FLOPs, which at 35% MFU on one H100 is about 0.3 GPU-hours. The compute is a rounding error; the bill is in the 5,000 examples, the evaluation set, and the iterations. Say this early in every scoping call. Running python code/memory_calc.py --tokens 12e6 prints the full table.

Putting the pieces together, the common customer situations map to recommendations like this:

Customer situationRecommendation
< 100 examples, no eval setprompt engineering + build the eval set; no training yet
500-5K labeled examples, format/task adherenceLoRA SFT on an 8B-class instruct model, rank 16-64, all linear layers
Wants frontier quality at small-model costdistill: frontier model generates, filter by grader, SFT a small model
Has thumbs up/down or A/B preference logsSFT first, then DPO (or KTO for unpaired feedback)
Has a reliable automatic graderSFT warm start, then GRPO/RFT
Needs > 1 task or per-tenant variantsone base, many LoRA adapters, multi-LoRA serving
Regulated, needs weights on-premLoRA or full FT on open weights; export merged weights
Model must learn a large new corpuscontinued pretraining (full FT, multi-node), then SFT; budget weeks

And the methods themselves, side by side, compare on data, memory, and sampling:

MethodDataModels in memoryOnline samplingTypical use
SFTprompt → response1noformat, task, style
Reward modelpreference pairs1noscoring for PPO / rejection sampling
PPO (RLHF)prompts + RM4 (policy, ref, RM, critic)yesclassic RLHF, mostly superseded
DPO / KTO / SimPOpairs / thumbs2 (1 for SimPO)no (online variants: yes)preference alignment
GRPO / RLOO / DAPOprompts + verifier2 (policy, ref) + rollout engineyesreasoning, code, agents, RFT
Distillationprompts + teacherstudent (+ teacher logits)optionalcheap small models
LoRA / QLoRA / DoRAany of the abovebase frozen + adaptern/amemory-bound fine-tuning

Choose an adaptation method from a measured failure and available data. State the assumptions before applying the result to a different workload.

  1. What evidence would justify rejecting a successful training run?

    Answer

    Held-out quality or the serving cost and latency contract can regress even while training loss improves.

Chapter contents · Next: The training step and validation