In LLM 105, we focused on evaluation: how to measure whether an LLM system is useful, faithful, and reliable. Evaluation naturally leads to adaptation. Once you know where a model fails, you can decide how to improve it.
The tempting answer is often “fine-tune it.” Sometimes that is right. Often it is not. Many LLM problems are better solved with a clearer prompt, better retrieval, a tool call, stronger evaluation, or a narrower workflow. Fine-tuning is powerful, but it is not magic. It changes model behavior; it does not automatically add fresh facts, guarantee truthfulness, or replace system design.
1. Adaptation Is a Spectrum
There are many ways to adapt an LLM system. Fine-tuning is only one of them.
Change instructions and examples.
Add external evidence at inference time.
Let systems compute, search, or act.
Update model behavior with examples.
Shape outputs using chosen/rejected examples.
The right choice depends on the failure mode. If the model lacks current facts, use retrieval. If it does arithmetic poorly, use a calculator or code tool. If it writes in the wrong format every time, fine-tuning may help. If it gives answers users dislike even when they are technically valid, preference tuning may help.
Simple rule: use fine-tuning to change behavior, not to store facts. Use RAG or tools when the answer needs inspectable, updateable information.
2. Prompting vs RAG vs Fine-Tuning
These methods solve different problems.
Best when the model can already do the task but needs clearer instructions.
Best when the model needs external documents, current facts, or citations.
Best when the model needs durable behavior across many examples.
Suppose you are building a research assistant for evacuation papers.
- If it summarizes too verbosely, adjust the prompt.
- If it misses project-specific documents, improve RAG.
- If it consistently fails to follow your lab’s structured review template, consider fine-tuning.
- If it invents statistics, add evidence requirements and evaluation before training.
- Wei et al. (2021), "Finetuned Language Models Are Zero-Shot Learners": the FLAN paper, showing the value of instruction tuning across many tasks.
- Ouyang et al. (2022), "Training Language Models to Follow Instructions with Human Feedback": shows how supervised fine-tuning and human feedback can improve instruction following.
3. Supervised Fine-Tuning
Supervised fine-tuning (SFT) trains the model on input-output examples. The model learns to produce outputs that look like the target examples.
Input: Summarize this evacuation paper for a transportation planning audience.
Target output:
- Research question: …
- Data source: …
- Method: …
- Key behavioral factors: …
- Planning implication: …
- Evidence gaps: …
SFT is useful for formats, domain style, recurring workflows, and task conventions. It is less useful for facts that change. If you fine-tune on old policy documents, the model may internalize outdated information. A retriever is usually a better home for facts.
Good SFT data has:
- consistent instructions;
- high-quality target outputs;
- realistic examples;
- edge cases;
- refusals or uncertainty cases;
- clear formatting;
- held-out evaluation examples.
Fine-tuning amplifies the quality of your examples. If the examples are inconsistent, vague, or casually wrong, the model will learn those patterns too.
- Chung et al. (2022), "Scaling Instruction-Finetuned Language Models": studies how instruction tuning scales with model size, task count, and chain-of-thought data.
- Wang et al. (2022), "Self-Instruct": explores generating instruction data from a model itself to support instruction tuning.
4. Full Fine-Tuning vs Parameter-Efficient Fine-Tuning
Full fine-tuning updates all model parameters. This can be powerful, but it is expensive and can require storing a full copy of the adapted model.
Parameter-efficient fine-tuning (PEFT) updates only a small number of additional parameters or selected components. The base model stays mostly frozen.
Updates most or all parameters.
High compute and storage cost.
Useful when deep adaptation is needed.
Updates small adapter modules or low-rank matrices.
Lower compute and storage cost.
Useful for many practical domain adaptations.
LoRA is one of the most influential PEFT methods. Instead of changing a large weight matrix directly, it learns small low-rank updates. QLoRA goes further by fine-tuning adapters while the base model is quantized, reducing memory requirements.
Illustrative only. Actual cost depends on model size, sequence length, hardware, batch size, and training setup.
Here is a typical LoRA configuration to give you a sense of the moving parts:
# Example: LoRA configuration (using Hugging Face PEFT)
from peft import LoraConfig
lora_config = LoraConfig(
r=16, # rank of the low-rank matrices
lora_alpha=32, # scaling factor
target_modules=[ # which layers to adapt
"q_proj", "v_proj"
],
lora_dropout=0.05,
bias="none",
task_type="CAUSAL_LM"
)
# This adds ~0.1% new parameters while keeping
# the base model frozen.
- Hu et al. (2021), "LoRA: Low-Rank Adaptation of Large Language Models": introduced low-rank adaptation for efficient fine-tuning.
- Dettmers et al. (2023), "QLoRA": showed memory-efficient fine-tuning of quantized LLMs with LoRA adapters.
5. Distillation: Learning from a Larger Model
Distillation trains a smaller model (the student) to imitate the outputs of a larger model (the teacher). Instead of training the student from scratch on raw data, you use the teacher’s probability distributions or generated outputs as the training signal. The student learns not just the correct answer, but the teacher’s confidence and reasoning patterns.
Why does this matter? You get a smaller, faster, cheaper model that retains much of the teacher’s capability for specific tasks. A 70B-parameter model may be too expensive to serve at scale, but a 7B student distilled from it can handle a well-defined task surprisingly well at a fraction of the cost.
Large, expensive to run.
High capability across many tasks.
Used to generate the training signal: soft probabilities, chain-of-thought traces, or curated outputs.
Smaller, faster, cheaper to serve.
Task-focused: trained on the teacher's outputs for a specific domain or workflow.
Can match or approach teacher quality on the target task.
Distillation works best when the target task is well-defined. A student model distilled for general chat may lose less breadth than one distilled for a narrow domain, but the narrow model can be surprisingly good at its specific job.
- Hinton et al. (2015), "Distilling the Knowledge in a Neural Network": the foundational paper on knowledge distillation, showing how a smaller model can learn from a larger model's soft output distributions.
- Gu et al. (2023), "MiniLLM: Knowledge Distillation of Large Language Models": applies distillation specifically to LLMs, showing effective methods for transferring capability from large to small language models.
6. Preference Tuning
Sometimes you do not only want the model to imitate examples. You want it to prefer one kind of answer over another.
Preference data usually contains pairs:
Chosen: A RAG answer should cite sources because citations let users inspect the evidence and verify whether the answer is grounded.
Rejected: Citations are always necessary because they make the model smarter.
The chosen answer is not just a correct answer; it better matches the desired behavior. Preference tuning methods use these comparisons to shape model outputs.
RLHF uses reward modeling and reinforcement learning. DPO offers a simpler direct optimization route using preference pairs. Constitutional AI explores using written principles and AI feedback to critique and revise outputs.
- Ouyang et al. (2022), "Training Language Models to Follow Instructions with Human Feedback": a key RLHF paper for instruction-following models.
- Rafailov et al. (2023), "Direct Preference Optimization": introduces an RL-free method for optimizing language models from preference data.
- Bai et al. (2022), "Constitutional AI": explores harmlessness training using critique, revision, and AI feedback guided by principles.
7. Data Quality Is the Whole Game
Fine-tuning is not mainly a modeling problem. For most teams, it is a data problem.
Bad training data can teach:
- wrong facts;
- inconsistent formatting;
- shallow reasoning;
- unsupported citations;
- overconfident answers;
- hidden bias;
- brittle refusal behavior;
- leakage of private information.
Before training, ask:
- Who wrote the examples?
- Are they correct?
- Are they representative of real use?
- Do they include difficult cases?
- Are sources and permissions clean?
- Is there a separate evaluation set?
- What behavior should the model not learn?
Small but sharp data beats large sloppy data. A hundred excellent examples can be more valuable than thousands of inconsistent ones, especially for narrow behavior changes.
8. Evaluation Before and After Training
Fine-tuning without evaluation is vibes with a GPU bill.
Use the evaluation ideas from LLM 105 before training:
- create a local evaluation set;
- define success metrics;
- include edge cases;
- separate factual grounding from style;
- test baseline prompting and RAG first;
- compare before and after fine-tuning;
- check regressions on general behavior.
Measure baseline failures.
Monitor loss and validation behavior.
Test task gains and regressions.
If fine-tuning improves format but harms truthfulness, you have not solved the problem. You have moved it. The strongest adaptation workflows evaluate both the target task and the behaviors you do not want to lose.
9. When Fine-Tuning Is the Right Move
Fine-tuning is often worth considering when:
- the same task is repeated many times;
- the desired format is stable;
- the model needs a domain-specific style;
- high-quality training examples exist;
- prompting becomes too long or fragile;
- RAG provides facts but the model still mishandles the task;
- latency or cost improves by replacing long prompts with learned behavior;
- evaluation shows a stable failure pattern.
For example, a transportation research lab might fine-tune a model to produce a standard paper-review template. The facts still come from retrieved papers. The fine-tuning teaches the model the lab’s review structure, level of detail, and cautious phrasing.
10. When Fine-Tuning Is the Wrong Move
Fine-tuning is probably the wrong first move when:
- the facts change frequently;
- the problem is missing retrieval;
- the failure is caused by unclear instructions;
- you do not have good examples;
- the task requires exact computation;
- the risk is from unsupported claims;
- the workflow needs access control or citations;
- you cannot evaluate the result.
Do not train a model to remember a document collection that should be searchable. Do not train a model to do arithmetic that a calculator can do. Do not train a model to obey a workflow you have not clearly defined.
11. A Practical Adaptation Checklist
Before fine-tuning, I would walk through this checklist:
- Name the failure. Is it style, format, reasoning, grounding, tool use, or factual knowledge?
- Try the simpler fix. Prompt, RAG, tool, schema, or evaluation change.
- Collect examples. Use realistic inputs and high-quality target outputs.
- Hold out eval data. Do not train on the examples you need for testing.
- Choose the tuning method. SFT, LoRA, QLoRA, DPO, or another preference method.
- Train narrowly. Avoid broad behavior changes unless you can evaluate them.
- Compare to baseline. Measure actual improvement, not just nicer demos.
- Check regressions. Truthfulness, safety, formatting, latency, cost, and refusal behavior.
- Keep facts external. Use RAG for updateable knowledge.
Fine-tuning is most valuable when it teaches a model how to behave in a stable workflow. It is weakest when used as a substitute for evidence, tools, or clear product design.
- Your model consistently writes summaries that are too long and miss the lab's required format. You have 200 examples of good summaries. Should you adjust the prompt, use RAG, or fine-tune? Justify your choice.
- A team fine-tunes a model on 5,000 examples scraped from the internet without review. After training, the model occasionally produces confident but incorrect claims. Using the data quality section, explain what likely went wrong.
- You fine-tune a model on a structured review template. The fine-tuned model follows the template perfectly but sometimes refuses to answer questions that the base model handled well. What happened, and how would you detect this during evaluation?
In the next post, we can look at deployment: latency, cost, model choice, caching, monitoring, privacy, and how to make an LLM system behave well outside a notebook.