Inference Optimization for Large Models
When a language model does not behave the way a project needs, a tempting response is to train it further on your own examples.
The Tempting Fix When a Model Underperforms
When a language model does not behave the way a project needs, a tempting response is to train it further on your own examples. Finetuning sounds like the direct fix: the model learns your task, and the problem goes away. Many people reach for it early, often before they have tried anything else.
This article examines the belief that finetuning is always the first step to take when a model underperforms. That belief is usually wrong. The more careful sequence starts with prompting, moves to finetuning only when evidence says simpler methods have run out of room, and includes decisions about separate models and newer base models along the way.
Tracing a Failed Model Through the Decision
Instead of asking 'should I finetune?' at the start, follow the state of the project one decision at a time. Begin with a model that underperforms. The first question is not about training. It is whether prompting has been carefully tested. If it has not, or if it has been tried only once or twice, the project stays on the prompting branch and the work is to refine and test prompt variants. Only when carefully tested prompting proves inadequate does the path lead toward finetuning.
Read the diagram as a series of gates. A failed prompt sends you to the first gate, which asks whether prompting has truly been tested. Only a 'Yes' there opens the way to finetuning, and even then the finetuning gate asks whether the evidence justifies the cost. The later gates about newer base models and separate models are reached only after the earlier decisions have been made honestly.
Why Prompting Comes First
AI engineering experiments should begin with prompting, and that prompting work should follow sound practices. The reason is cost and evidence. Finetuning is expensive to set up and maintain, so it needs to be justified by proof that simpler methods have run out of room. Prompting is the cheapest way to find out how far a model can already go with the right instructions.
The phrase 'thoroughly tested' carries most of the weight in this advice. A model's behavior can shift considerably depending on how a request is worded, so one or two attempts tell you very little. A fair test means trying several variants of the prompt and checking each result against a clear measure of success. Without a clear measure, you cannot tell whether a variant helped.
The lesson is not that prompting always works. It is that a claim such as 'prompting does not work' should be checked against how thoroughly prompting was actually tried. Most failed prompting efforts trace back to a small set of weaknesses.
Worked Decision: A Ticket Tagging Project
Deciding Whether to Finetune a Ticket Tagger
A team wants a model to tag incoming support tickets by product area. The first prompt returns many wrong tags. The lead proposes finetuning on a few hundred tickets right away. Walk the decision in the order the course recommends.
- 1Check how the first attempt was run
The team tried one prompt, once. That is not a thorough test, because a model's output can shift with small changes in wording. The project stays on the prompting branch.
- 2Diagnose the three common weaknesses
The team reviews the prompt. The instructions say only 'tag the ticket', which is vague. The few examples came from a clean sample, while real tickets are messy. And the success measure is a loose 'looks right' judgment that cannot separate good tags from bad ones.
- 3Retest with a fixed measure
The team writes specific instructions, uses examples drawn from real ticket traffic, and defines accuracy against a labeled sample. They test several prompt variants and compare the results against that measure.
- 4Decide whether finetuning is now justified
Only if the carefully tested prompting still fails should the team consider finetuning. At that point they must weigh the labeling cost and the maintenance commitment before collecting data.
The team cannot yet justify finetuning from the first attempt. After a fair prompting test, the decision becomes an evidence-based one rather than a reflex.
The Escalation Order of an Experiment
The steps of an AI engineering experiment happen in a fixed order. Each step is meant to be completed before the next one is considered. Prompting comes first, and finetuning becomes an option only at a later point, once the earlier steps have shown their limits.
Notice that the step of gathering annotated data appears only after prompting has been shown to fall short. Data collection is one of the largest up-front costs of finetuning, so placing it after the prompting test is what keeps the project from paying for training it did not need.
Up-Front and Ongoing Costs of Finetuning
Finetuning requires high up-front investment and continual maintenance. These costs are easy to underestimate, because the training step itself often looks like the simplest part of the project. Costs fall into two groups: those paid before the model is useful, and those that continue for as long as the model is in use.
| Cost type | When it is paid | What it covers |
|---|---|---|
| Annotated data | Before the model is useful | Data that is slow and expensive to acquire |
| Training know-how | Before the model is useful | Skills to train, evaluate, and debug models |
| Monitoring | Continually, after deployment | A policy and budget for watching the model |
| Updates | Continually, after deployment | A policy and budget for revising the model |
Up-front and ongoing costs named in the course material
The Moving Target of Newer Base Models
Finetuning is also a bet against a moving target. New base models are being developed quickly, and they may improve faster than you can improve a finetuned model. A model you spent months finetuning may be overtaken before the work pays off. That creates two decisions the team must answer in advance: whether a switch to a newer base model is worth it, and whether the work should be prioritized at all.
A switch to a better base model often yields only a small incremental improvement. In that case the task may deserve lower priority than projects with larger returns, such as enabling new use cases. Deciding how to spend effort is part of engineering judgment, not only a question of which model scores highest on a benchmark.
A team's finetuned model is about to launch, and a newer base model has just been released with a modest gain on the team's own metric. Before deciding, what two questions should the team answer, and which one could move the project to a lower priority?
Hints
- Think about whether the expected gain is large or small compared with the cost of finetuning again.
- Consider whether the same effort could enable a new use case with a larger return.
One Model or Several for Many Tasks
Sometimes a finetuned model improves one kind of query while harming others. A model might handle one type of query better after finetuning but perform worse on two other tasks. To avoid this, finetune on all the queries you care about, rather than making narrow adjustments that favor one task.
If you still cannot get one model to perform well across all your tasks, consider separate models for different tasks. If serving several models becomes inconvenient, they can be combined into one later through merging, a technique the course discusses in a later part of the same chapter. The order matters: separate models are considered after the team has seen that one model cannot serve every task, and merging is a later simplification, not a first step.
Specialized Domains Raise the Bar
The course gives finetuning for a specialized domain its own treatment, which signals that domain work raises considerations beyond the general case. The costs of data, training knowledge, and serving apply with particular force here, because domain tasks often depend on expertise that is hard to label.
Mistakes Teams Make Before Finetuning
Common mistake Reaching for finetuning as the first response to underperformance
What it looks likeA model returns weak answers on day one, and the team starts collecting training data that same week.
Why it failsFinetuning is expensive to set up and maintain, so it should be justified by evidence that simpler methods have run out of room.
Do this insteadBegin with prompting and test it carefully before considering finetuning.
Common mistake Judging prompting after one or two attempts
What it looks likeA single wording produces a bad answer, and the team concludes that prompting does not work.
Why it failsA model's behavior can shift considerably depending on how a request is worded, so one or two attempts tell you very little.
Do this insteadTry several prompt variants and check each against a clear measure of success.
Common mistake Forgetting the ongoing costs
What it looks likeThe team budgets for the training run but nothing for monitoring or updates.
Why it failsServing and maintaining a finetuned model require a policy and budget for monitoring and updates.
Do this insteadPlan the monitoring and update policy and budget before the project starts.
Common mistake Ignoring that a newer base model may overtake the finetuned one before the work pays off
Common mistake Finetuning narrowly for one task
Why it failsNarrow adjustments can improve one kind of query while harming others.
Do this insteadFinetune on all the queries you care about.
Trace the Decision Yourself
A project's model fails on a classification task. The team has tried one prompt, and it failed. Using the decision path, state which branch you take first, and what evidence would have to exist before you could move toward finetuning.
Hints
- Start at the gate that asks whether prompting has been carefully tested.
- Remember that one or two attempts is not a thorough test.
What do you think happens?
After a single failed prompt, should the team finetune right away?
Reveal answer
No, prompting must be carefully tested first
Finetuning is justified only when carefully tested prompting proves inadequate, and one or two attempts do not count as a careful test.
Putting the Sequence Together
- 1Finetuning is rarely the first step. Experiments begin with prompting, and finetuning is justified only when carefully tested prompting proves inadequate.
- 2Finetuning carries high up-front costs, including annotated data and the know-how to train, evaluate, and debug, and ongoing costs of monitoring and updates.
- 3New base models may overtake a finetuned model, so a switch to a newer base model must be weighed against its size of gain and the value of other work.
- 4When one model cannot serve all tasks well, consider separate models, with merging as a later option for simplifying serving.
Key Takeaways
- Finetuning is rarely the first step; experiments start with carefully tested prompting.
- Finetuning carries up-front costs for annotated data and training know-how, plus ongoing costs for monitoring and updates.
- A newer base model may overtake a finetuned model, so weigh the size of any gain against other priorities.
- If one model cannot serve all tasks, consider separate models, with merging as a later simplification.