Skip to content
AgenticAIWiki
  1. Learn
  2. Part 5
  3. 29. Fine-tuning
  4. 29.5

Lesson 29.5 · 5 of 9 · 5 min read · Reviewed 24 Nov 2026

Evaluating a fine-tuned model

By the end, you can

  • Evaluate a fine-tuned model properly.
  • Catch regressions in general ability and safety.

What to compare

baseline:  base model + best prompt + retrieval
candidate: tuned model + same prompt + retrieval
same test set, same graders, same settings

If the candidate doesn’t clearly beat the baseline, don’t ship it.

What to measure

Area Examples
Target task Accuracy, format validity, style rubric scores
General ability A broad sample of other tasks the model still needs
Safety Refusal of harmful requests; no new leaks of private data
Honesty Saying “I don’t know” when it should
Cost and latency Tokens per answer, speed on your hardware

Read the failures

Averages hide problems. Sort failures by type (Part 3, chapter 17). A model that’s 3% better on average but now invents policy details is worse.

Use several graders

  • Code checks for format and exact fields.
  • A model graderLLM-as-judge: Using a language model with a rubric to grade another model’s outputs. with a rubricRubric: A written set of criteria and score levels that a grader applies to each output. for style and helpfulness (chapter 18).
  • Human review on a sample, especially for safety.

Keep it repeatable

Store the dataset version, settings, base model id and eval results together. Make the eval a gate in CIContinuous integration (CI): Automatically building and testing code on every change, usually in a hosted pipeline. (chapter 20), so a re-tune can’t ship if it regresses.

Key points

  • Compare the tuned model with the best prompt-plus-RAG baseline on the same held-out test set.
  • Check what you tuned for, and also what you didn't: general skills, safety and refusals can regress.
  • Look at failures, not just averages; a better average can hide new, serious errors.
  • Re-run the evals whenever you change data, settings or the base model.
Hands-on labRuns in the Playground

Gate a tuned model against its baseline

Decide automatically whether a fine-tuned model may ship by comparing every eval area with the baseline, not just the average.

You will have: A gate function that prints per-area deltas, any regressions and a ship or do-not-ship verdict for two candidates.

Steps

  1. Read the baseline and two candidates' scores per area.
  2. Compute the delta per area and the change in the average.
  3. Treat any drop larger than 0.02 in safety, honesty or general ability as a blocking regression.
  4. Require the target task to improve by at least 0.05.
  5. Print the verdict with the reason for each candidate.

Done when

  • Tuned v1 prints SHIP.
  • Tuned v2 prints DO NOT SHIP and names safety and honesty.
  • v2's average is printed even though it does not decide the verdict.

Open in the Playground No API key needed.

Starter code (Python)
AREAS = ["target task", "general ability", "safety refusals", "honesty", "format validity"]
BASELINE = [0.72, 0.85, 0.97, 0.90, 0.94]
CANDIDATES = {"tuned v1": [0.84, 0.84, 0.97, 0.90, 0.99], "tuned v2": [0.89, 0.74, 0.88, 0.70, 0.99]}
GUARDED = {"general ability", "safety refusals", "honesty"}

def gate(scores):
    # TODO: return (verdict, reasons). Block on guarded drops > 0.02; need target gain >= 0.05.
    return "TODO", []

for name, s in CANDIDATES.items():
    verdict, reasons = gate(s)
    print(name, verdict, reasons)
Show a solution
AREAS = ["target task", "general ability", "safety refusals", "honesty", "format validity"]
BASELINE = [0.72, 0.85, 0.97, 0.90, 0.94]
CANDIDATES = {"tuned v1": [0.84, 0.84, 0.97, 0.90, 0.99], "tuned v2": [0.89, 0.74, 0.88, 0.70, 0.99]}
GUARDED = {"general ability", "safety refusals", "honesty"}

def gate(scores):
    reasons = []
    for a, b, s in zip(AREAS, BASELINE, scores):
        if a in GUARDED and s < b - 0.02:
            reasons.append(f"{a} fell {b - s:.2f}")
    if scores[0] - BASELINE[0] < 0.05:
        reasons.append("target task gain under 0.05")
    return ("DO NOT SHIP" if reasons else "SHIP"), reasons

avg = lambda xs: sum(xs) / len(xs)
for name, s in CANDIDATES.items():
    verdict, reasons = gate(s)
    print(f"{name}: average {avg(BASELINE):.3f} -> {avg(s):.3f}  {verdict}" + (": " + "; ".join(reasons) if reasons else ""))
Quick checkA tuned model improves style scores, but now follows harmful requests it used to refuse. What went wrong?
How sure are you?
Pick an answer and how sure you are