Sub topic 14
When to Choose Instructions, Fine-Tuning, or Other Methods
This chapter covers the last decision in the tutorial: when few-shot prompting is the right tool and when something else does the job better. It assumes you can read short Python, know what a prompt and a completion are, and are familiar with system, user, and assistant roles. It also assumes you have read the earlier chapters on choosing examples and on testing a prompt against held-out data. The decision rules below depend on that kind of measurement.
Why the choice matters
Few-shot prompting is cheap to start and easy to change. It is not always the best fit. Examples cost tokens on every call, they can be copied, and they only teach what fits in the context window. Other methods trade differently on setup effort, cost per call, and reliability.
The main options are:
- Zero-shot instructions: a clear task description with no examples.
- Few-shot prompting: instructions plus a handful of input and output pairs.
- Reasoning prompts: asking the model to work step by step, with or without worked examples.
- Retrieval: fetching facts from a document store and placing them in the prompt.
- Fine-tuning: training the model further on many labeled examples.
- Structured output controls: schemas or constrained decoding that force a valid format.
- Ordinary code: rules, regular expressions, or a classical classifier.
Start from the failure, not the technique
Pick a method by naming what is going wrong. Different failures call for different fixes.
| Observed failure | Likely cause | First thing to try |
|---|---|---|
| Output is correct but in the wrong format | Format is not specified clearly | Tighter instructions, then a few examples that show the format |
| Labels are inconsistent on borderline inputs | Task boundary is unclear | Examples of the borderline cases, plus a rule in the instructions |
| Answers are wrong because facts are missing | Model lacks the knowledge | Retrieval, not examples |
| Multi-step problems give wrong answers | Model answers too fast | Ask for reasoning, or show reasoning in examples |
| Output sometimes fails to parse | Format is not enforced | Structured output or a schema, plus validation in code |
| Prompt is long and costly at high volume | Examples repeated on every call | Fewer examples, caching, or fine-tuning |
| Quality plateaus even with many good examples | Task needs more than fits in context | Fine-tuning or a different model |
Examples are best at showing things that are hard to describe: a tone, a label boundary, an output layout. They are weak at supplying facts the model does not have.
When instructions alone are enough
Try zero-shot first. Modern chat models follow clear instructions well. If a plain instruction with a stated output format reaches your accuracy target on held-out data, adding examples only adds cost and risk.
Examples earn their place when you can show a measured gain. Use the accuracy function from the evaluation chapter to compare variants on the same held-out set.
def accuracy(predict, labeled):
correct = 0
for text, label in labeled:
if predict(text).strip().lower() == label:
correct += 1
return correct / len(labeled)
def compare(variants, labeled):
"""variants maps a name to a predict function."""
results = {}
for name, predict in variants.items():
results[name] = accuracy(predict, labeled)
return results
# Example use, with predict functions you define elsewhere:
# scores = compare(
# {"zero_shot": predict_zero, "three_shot": predict_three, "eight_shot": predict_eight},
# held_out,
# )
# for name, score in sorted(scores.items(), key=lambda kv: kv[1], reverse=True):
# print(f"{name}: {score:.1%}")Run each variant on the same data. On a small held-out set, differences of a point or two are noise. Prefer the simpler prompt unless the gain is clear.
When few-shot is the right choice
Few-shot prompting fits when:
- The task is easier to show than to describe, such as a house style or a custom label scheme.
- You have only a handful of labeled examples, from a few to a few dozen.
- The task changes often, so you want to edit the prompt rather than retrain.
- Volume is low or moderate, so the extra tokens are affordable.
- You need a result today and have no training pipeline.
If the examples vary by query and you have a larger pool, dynamic selection from the earlier chapter keeps the prompt short while keeping the examples relevant.
When to add reasoning
If the model gets multi-step problems wrong, the fix is usually to make it work through the steps, not to add more plain input and output pairs. You can ask for steps in the instructions, or show worked reasoning in your examples. Reasoning raises the token count of every answer, so use it where the task needs it. For simple classification it often adds cost without improving accuracy. Some models also reason internally, in which case explicit step-by-step prompts may help little. Measure it.
When retrieval beats examples
Examples teach behavior. Retrieval supplies knowledge. If the model fails because it does not know your return policy, your product catalog, or last week's data, no number of examples will fix that reliably. The model may imitate the style of an answer while inventing the content.
A common and useful combination is to retrieve relevant documents for facts and include two or three examples that show how to use them. The examples show the answer format and how to cite the source. The retrieved text supplies the content.
When to fine-tune
Fine-tuning trains the model on many labeled input and output pairs so the behavior is built into its weights. Consider it when several of these hold:
- You have hundreds or thousands of good labeled examples.
- The task is stable and you will not change the label scheme often.
- Call volume is high enough that long prompts cost real money or add latency.
- Few-shot accuracy has plateaued below your target even after you improved the examples.
- You need a smaller, cheaper model to match the behavior of a larger one.
Fine-tuning has costs. You need clean data, a training and evaluation process, and a plan for redoing the work when the base model changes or the task shifts. It is also a poor way to add facts. Fine-tuning shapes style and behavior more reliably than it stores knowledge.
A rough cost check helps. Estimate the tokens that your examples add to each call, multiply by call volume, and compare with the one-time training cost plus any change in per-call price.
def examples_overhead(example_tokens, calls_per_day, price_per_million_tokens):
"""Daily cost of resending the examples with every call."""
tokens_per_day = example_tokens * calls_per_day
return tokens_per_day / 1_000_000 * price_per_million_tokens
# 600 tokens of examples, 200,000 calls a day, $1.00 per million input tokens
daily = examples_overhead(600, 200_000, 1.00)
print(f"Examples cost about ${daily:.2f} per day") # 120M tokens -> $120.00The prices here are made up for the arithmetic. Use your provider's current rates. If the daily overhead is small, fine-tuning rarely pays for itself on cost alone. Prompt caching, where your provider supports it, can also reduce the cost of a fixed block of examples, so check that before you commit to training.
When code is the better tool
Some tasks do not need a model at all. If a regular expression, a lookup table, or a classical classifier meets the requirement, it is faster, cheaper, and easier to test. A model can still help by handling the messy cases that rules miss. A common design runs the rules first and sends only the leftover inputs to the model.
Also validate model output in code, whatever method you choose. Check that a label is in the allowed set, that JSON parses, and that required fields exist. Retry or flag failures. Few-shot examples make correct formats more likely. They do not guarantee them.
A decision path
The flow below summarizes the order to try things. Each step should be judged on held-out data, not on a few hand-picked inputs.
Common mistakes in choosing a method
- Fine-tuning before measuring. Teams train a model when a better instruction would have worked. Always get a zero-shot and few-shot baseline first.
- Using examples to supply facts. The model copies the shape of the answer and fills in plausible but wrong content.
- Adding examples to fix a parsing problem. Use a schema or output validation instead.
- Judging by a few good-looking outputs. Use a held-out set with enough items to see real differences.
- Ignoring maintenance. A prompt is easy to edit. A fine-tuned model needs retraining when requirements change. Count that cost.
- Mixing changes. If you change the model, the instructions, and the examples at once, you cannot tell which change helped.
Summary of decision criteria
| Situation | Best fit |
|---|---|
| Clear task, model already meets target | Instructions only |
| Format or label boundary hard to describe | Few-shot examples |
| Model lacks the needed facts | Retrieval |
| Multi-step problems fail | Reasoning prompts |
| Output must always parse | Schema or constrained output, plus validation |
| Stable task, large labeled set, very high volume | Fine-tuning |
| Rules fully capture the task | Plain code |
Exercise
A support team classifies tickets into six categories. Zero-shot accuracy on 200 held-out tickets is 71%. With five examples it is 84%. With twelve examples it is 85%. They process 500,000 tickets a day and each example costs about 80 tokens. Which prompt would you ship first, and what would make you consider fine-tuning?
Show answer
Ship the five-example prompt. The jump from 71% to 84% is a clear gain, while 85% with twelve examples is within noise on 200 tickets and costs 560 extra tokens per call (7 more examples at 80 tokens each), or 280 million extra tokens a day at this volume. Consider fine-tuning if 84% is below the target, if they have hundreds or more labeled tickets, if the categories are stable, and if the daily cost of resending even five examples (400 tokens times 500,000 calls, which is 200 million tokens a day) is larger than the cost of training plus any change in per-call price. They should check prompt caching first.
Exercise
A model answers questions about a company's internal refund policy. It writes answers in the right format but often states the wrong refund window. Adding ten more examples does not help. What is the likely cause and the better fix?
Show answer
The model lacks the policy facts, and examples teach format and behavior rather than knowledge. The better fix is retrieval: fetch the relevant policy text and place it in the prompt, and keep two or three examples that show how to answer from the supplied text and cite it.