Fine-tuning lab
Frame the LoRA support-tone adapter experiment
Ship a falsifiable slice of **LoRA adapter that keeps support replies in brand voice while facts stay in RAG** — success is held-out tone score ≥ 0.82 and factual hallucination rate ≤ 0.05 on 40 gold pairs, not a polished screenshot.
1Try it yourself
Decision drill
Fine-tune vs RAG lab
LoRA for style/format; RAG for changing facts — full fine-tune is last resort.
1/3Match brand voice on 500 support macros.
2Learn the idea
Read
Name the operable slice
This lab builds LoRA adapter that keeps support replies in brand voice while facts stay in RAG. The human in the loop is support ops manager reviewing tone before a seasonal campaign. Scope is intentionally narrower than “make AI reliable”: you will prove one oracle — held-out tone score ≥ 0.82 and factual hallucination rate ≤ 0.05 on 40 gold pairs — and one invariant — weights never encode store hours or prices; those stay in retrieval docs. Record non-goals in your notes so a later change cannot silently expand authority. The incident mnemonic for the chapter is FT-PROMO-LEAK-12; design as if that ticket is already written and you are filling evidence.
Read
Write the acceptance contract
Turn the oracle into a table: input fixture, expected observable, prohibited side effect, owner, latency/cost ceiling. Separate model taste from software correctness — transport, auth, parsing, and termination must be deterministic even when generated text varies. Primary metric family: tone_pass_rate and unsupported_fact_rate. Averages without a denominator or revision label do not gate release. Fake external dependencies in unit tests; live calls wait until fakes pass.
Read
Implementation artifact
{"messages":[{"role":"system","content":"Brand voice: warm, concise, never invent prices."},{"role":"user","content":"Refund window?"},{"role":"assistant","content":"Glad to help — our standard window is in the linked policy note."}]}
Read
Freeze the first red test
Before implementation, encode a failing check that would have caught training set includes tomorrow's promo price; model invents it after promo ends. That failure is the pedagogical north star for later pages: contracts reject it, happy path never performs it, validation asserts it, failure-handling contains it, observability detects it, security-ops prevents privilege tricks around it, and mastery replays it in a drill. Endpoint under study: POST /v1/fine_tuning/jobs.
Read
Stage depth
Capacity note for planners: estimate peak demand on POST /v1/fine_tuning/jobs and the cost ceiling for a failed retry storm. Write the abort conditions — unbounded spend, cross-tenant leakage, or inability to roll back — before you enjoy the first green test. Prefer synthetic fixtures shaped like production over anonymized production dumps you cannot share in class. When you are tempted to widen scope, re-read the oracle (held-out tone score ≥ 0.82 and factual hallucination rate ≤ 0.05 on 40 gold pairs) and cut features that do not serve it. The teaching outcome is judgment under constraints: support ops manager reviewing tone before a seasonal campaign gets a trustworthy control, not a kitchen-sink framework. Keep the language of release decisions: promote, hold, or roll back — never “see if it gets better.”
Read
Field notes for `fine-tuning-lab` / `lab-goal`
Decide what will live in version control on day one: fixtures, contract markdown, and a failing test name. Write the cost ceiling as a hard number with currency and period. If the lab involves clusters, name the non-prod context you will use and forbid prod kubecontexts in scripts. Capture the baseline metric once before changing code so later gains are comparative. Refuse tools that hide the request path behind magic macros until the oracle is green on fakes. In this chapter the product is LoRA adapter that keeps support replies in brand voice while facts stay in RAG, the human stakeholder is support ops manager reviewing tone before a seasonal campaign, and the incident id you design against is FT-PROMO-LEAK-12. Re-state the oracle in your notes — held-out tone score ≥ 0.82 and factual hallucination rate ≤ 0.05 on 40 gold pairs — and keep the invariant visible: weights never encode store hours or prices; those stay in retrieval docs. Track tone_pass_rate and unsupported_fact_rate as the scoreboard. Surface under change control: POST /v1/fine_tuning/jobs.
Go deeper
Before you start
Why this matters
Write the single done-definition a reviewer would accept for Fine-tuning lab (FT-PROMO-LEAK-12). Include the numeric gate hidden in this oracle: held-out tone score ≥ 0.82 and factual hallucination rate ≤ 0.05 on 40 gold pairs. Then name the fake success you refuse: a demo that ignores training set includes tomorrow's promo price; model invents it after promo ends. Keep the sentence beside your editor; every later page should make this sentence easier to prove.
Related lessons
Check your understanding
Page assessment
Answer from memory. Completion is saved from this evidence, not from opening the next page.
All responses are required.