Sub topic 13
Choosing between prompting and fine-tuning
This chapter assumes you have read the earlier chapters of this tutorial. You should know how an extraction schema and a gold set are built. You should also be able to compute span-level precision, recall and F1, and know how a prompted extractor and a BIO token classifier each work. Here we combine those pieces into a decision procedure.
The decision is about constraints
Neither approach is better in general. A prompted LLM and a fine-tuned model solve the same task with different cost structures:
- Prompting has a low up-front cost and a high per-document cost. You pay for a long prompt and a large model on every call.
- Fine-tuning has a high up-front cost (labeling, training, evaluation) and a low per-document cost. A small model that you host answers quickly and cheaply.
So the question is rarely "which is more accurate?" It is "which one meets my accuracy target within my constraints on data, volume, latency, privacy and change?" Accuracy matters, but it is only one of the constraints.
The dimensions that matter
The table summarizes how the two approaches typically compare. These are tendencies, not guarantees. Always check them against your own gold set.
| Dimension | Prompted LLM | Fine-tuned model |
|---|---|---|
| Labeled data needed to start | A handful of examples, plus a gold set for evaluation | Hundreds to thousands of labeled documents for training, plus a separate gold set |
| Time to first working version | Hours | Days to weeks |
| Per-document cost | Higher (long prompt, large model) | Lower (small model, short input) |
| Latency | Hundreds of milliseconds to seconds | Often tens of milliseconds for a token classifier |
| Schema changes | Edit the prompt and re-run the evaluation | Relabel data and retrain |
| Rare or unusual entity types | Often decent from the label description alone | Weak if the training set has few examples |
| Exact span boundaries | Needs post-processing to find offsets | Native, because tags are per token |
| Output reliability | Needs validation and retries | Constrained by the tag set, so always well-formed |
| Data privacy | Text may leave your network if you use a hosted API | Can run entirely on your own hardware |
| Consistency over time | Can shift when the provider updates the model | Frozen until you retrain |
Two rows deserve extra attention.
Span boundaries. A BIO classifier returns token positions directly. A generative model returns strings, and you must map them back to character offsets. If the same string appears twice, the mapping is ambiguous. Tasks that need exact spans, such as redaction or highlighting, favor token classification.
Schema stability. Suppose the business adds a new field every month. Each change to a prompt takes minutes to make and a few more to evaluate. Each change to a trained model needs new annotation. High schema churn pushes you toward prompting.
A decision flow
The diagram gives an order in which to ask the questions. It starts from the assumption that you always build a prompted baseline first.
Notice two properties of this flow. First, every path goes through the gold set, because without one you are comparing impressions. Second, error analysis, not intuition, decides whether a failing prompt is worth fixing. If most errors come from ambiguous labeling rules, a fine-tuned model will inherit the same ambiguity.
Start with the prompted baseline
A prompted baseline is cheap to build, and it gives you three things even if you never ship it:
- A measured accuracy number on your gold set.
- A list of the hard cases, which you need for error analysis.
- Draft labels. You can have the LLM pre-label training data and have humans correct it, which is faster than labeling from scratch. The hybrid chapter covers this in detail.
Skipping the baseline is the most common planning mistake. Teams commit weeks to annotation before learning that a three-example prompt already meets the target, or that the task is ambiguous enough that human annotators disagree with each other.
When prompting is the right answer
Prefer prompting when most of these hold:
- Volume is low or moderate, so per-document cost does not dominate.
- The schema is new, changing, or has many rare types.
- You have little labeled data and annotation is expensive, for example because it needs domain experts.
- Latency of a second or more is acceptable.
- The prompted baseline already meets the target on your gold set.
- Sending text to a hosted API is permitted.
When fine-tuning is the right answer
Prefer a fine-tuned model when most of these hold:
- Volume is high and stable, so a lower per-document cost pays back the training effort.
- The schema is fixed and the entity types are common enough to appear often in the training data.
- You need low latency or must run offline or on-premises.
- You need exact, reproducible spans, or output that cannot be malformed.
- The prompt has plateaued below the target, and error analysis shows the remaining errors are about domain conventions that examples teach better than instructions do.
- You can obtain or create a few hundred to a few thousand labeled documents.
Fine-tuning a generative model for extraction sits between the two. It keeps the flexible output format but removes the long prompt, which cuts cost per call. It still needs training data, and it still needs output validation.
Estimating the break-even point
Cost arguments are easy to make vaguely. Make them concrete with a small calculation. The prices below are placeholders. Replace them with your own.
def prompted_cost(docs_per_month, in_tokens, out_tokens,
price_in_per_m, price_out_per_m):
"""Monthly cost of calling a hosted LLM; prices are per million tokens."""
per_doc = (in_tokens * price_in_per_m + out_tokens * price_out_per_m) / 1e6
return docs_per_month * per_doc
def breakeven_months(upfront, monthly_prompted, monthly_finetuned):
"""Months until the fine-tuned model's savings repay the up-front cost."""
saving = monthly_prompted - monthly_finetuned
if saving <= 0:
return None # fine-tuning never pays back on cost alone
return upfront / saving
prompted = prompted_cost(
docs_per_month=2_000_000,
in_tokens=1200, # instructions + examples + document
out_tokens=80,
price_in_per_m=0.50,
price_out_per_m=1.50,
)
finetuned_serving = 300.0 # hosting a small model
upfront = 6000.0 # annotation, training, evaluation
months = breakeven_months(upfront, prompted, finetuned_serving)
print(round(prompted, 2))
print(None if months is None else round(months, 1))With these placeholder numbers, the prompted system costs about 1,440 per month and the fine-tuned one pays back in about five months. At 20,000 documents per month the same calculation returns a saving of about 14 per month against 300 of serving cost, so breakeven_months returns None. Volume decides the outcome.
The calculation leaves out maintenance. Add the engineer time to retrain when the data shifts, monitor drift and manage model versions. Add also the cost of prompt regression testing when a provider changes the underlying model.
Compare on the same gold set
Whatever you choose, compare candidates under identical conditions:
- Use one gold set that neither system saw during development. Keep a final test split that you score only once.
- Use the same scoring rule for both. Exact-match span F1 penalizes a prompted system that returns "Dr. Smith" when the gold span is "Smith". Decide in advance whether boundary tolerance is acceptable, and apply it to both.
- Report per-type scores, not only the overall F1. A system that scores well overall can still fail on the one type you care about.
- Report confidence intervals or at least the gold set size. On a gold set of 200 entities, a 2-point F1 difference is within noise.
Combining the two
Often the best answer is both. Common patterns:
- LLM labels, small model serves. Use a strong prompted model to label a large pool of unlabeled text, have humans review a sample or the uncertain cases, and train a token classifier on the result. You get low serving cost without the full annotation bill.
- Small model first, LLM fallback. Run the cheap model on everything. Send documents to the LLM only when the small model's confidence is low or its output fails validation.
- LLM for rare types, classifier for common ones. Let the fine-tuned model cover frequent entity types, and let a prompt handle the long tail.
Each pattern adds an interface to maintain. Use one only when the saving or accuracy gain is measurable.
Common mistakes in the decision
- Choosing by headline benchmark. Public benchmark scores do not predict your schema, your document style or your labeling conventions.
- Ignoring the ceiling set by annotators. If two humans agree on only 85% of spans, no system will reliably beat that on your gold set. Fix the labeling rules before changing models.
- Counting only the cost per call. A long few-shot prompt multiplies every call, and retries on invalid output add to it.
- Fine-tuning to fix a schema problem. Models cannot learn a distinction your guidelines do not define.
- Treating the decision as permanent. Volume grows, prices drop, and schemas settle. Re-run the comparison when those change, because your gold set makes this cheap.
Exercise
A team extracts five fields from support emails. The schema changes about monthly, volume is 30,000 emails per month, there are no labeled examples, and latency of two seconds is acceptable. What would you do first, and what result would make you reconsider?
Show answer
Build a prompted baseline and score it on a small hand-labeled gold set, since the schema changes often, volume is low, and there is no training data. Ship it if it meets the accuracy target. Reconsider if error analysis shows the remaining errors are stable, domain-specific conventions that more instructions do not fix, if volume grows enough that a break-even calculation favors a small model, or if privacy or latency requirements change. Even then, use the prompted outputs to pre-label training data rather than annotating from scratch.
Exercise
Your prompted extractor scores 0.78 span F1 and your fine-tuned classifier scores 0.80 on a gold set of 150 entities. Can you conclude the classifier is better?
Show answer
No. With only 150 entities, a 2-point difference is likely within noise. You need a larger gold set or a confidence interval, per-type scores to see where each system fails, and the cost, latency and maintenance comparison before deciding.