finetune-or-promptGitHub

A decision study on real data

Fine-tune a small model, or prompt a large one?

Measured on 3,080 banking support messages and 77 intents: accuracy with intervals, cost per 1,000 requests, speed, and the monthly volume where the answer flips. With few labels, prompt. With many, put each message's most similar labelled examples in the prompt: that beat fine-tuning, for 6 cents per 1,000 requests.

Fine-tuning passes fixed prompts at 25 to 50 labels per intent, but not prompts with retrieved examples

What we found

Common beliefs, checked on the same test messages.

Fine-tuning beats prompting when labels are scarce

Given the same 385 labelled examples, Claude Haiku with them in its prompt got 86.7% right; a model fine-tuned on them got 62.4%

With plenty of labels, fine-tune

Haiku given each message's 10 most similar labelled examples got 94.3%, ahead of the fine-tuned model's 93.3%, for 6 cents per 1,000 requests

A fine-tuned model is simply more accurate than a prompt

Most of its lead over fixed prompts was learned labelling habit: counting answers as defensible as the label, Sonnet came out 0.9 points ahead

Fine-tuning is what makes a small model good

A small model that was not fine-tuned, trained in about a second, came within a point; a recipe built for few labels (SetFit) trailed it by 4 points

Prompting a large model is too expensive at scale

Prompt caching cut the bill by 85 to 94%; Haiku with examples stayed cheaper than a model of your own up to about 7 million requests a month

Self-hosting cost is mostly the server

The server was about $53 of a fixed cost near $870 a month; engineer time and labels were the rest

Price per request decides

What a wrong answer costs moved the answer most: at one cent a mistake, a model of your own paid off from about 1 million requests a month instead of 7 million

The question

A team needs to sort customer messages into 77 banking intents. They can:

  1. Prompt a large hosted model (Claude Haiku 5.5 or Sonnet 5.5). No training, pay per request.
  2. Fine-tune a small open model (ModernBERT-base, 150M parameters) on labelled examples and serve it themselves. Pay once for labels and training, then a fixed amount for a server.
  3. Use a small model without fine-tuning (frozen bge-small embeddings plus a linear classifier), the cheapest option of all.
  4. Combine them: the small model finds the labelled examples most similar to each message, and the hosted model reads them and chooses.

This study measures all of them on the same test messages and turns the results into a decision: how many requests a month, how many labelled examples and what price per wrong answer make each option worth it.

The notebooks

Each answers one question a team would ask.

How the study is run

  1. Same test messages for every approach, so differences are measured in pairs, with 95% intervals from resampling the test set. Where Sonnet answered only 20 messages per intent (1,540, to save cost), every comparison uses those.
  2. No tuning on the test set. A validation set is held out from training, and each approach picks one setting on it that is then used at every training size. Tuning per size would flatter the small sizes.
  3. Training sizes are nested (the 10 examples per intent include the 5), with three random draws each, so the learning curve shows the value of more labels rather than the luck of a draw.
  4. Prompts and small models see the same labels. The five examples per intent in a prompt are the same 385 messages the small models trained on at that size.
  5. Every paid request is on file. Each hosted answer is saved with its token counts and timing, so costs and speeds are computed from what was actually used. Prompts are cached, and a hard cap stops spending.
  6. Errors are read, not just counted. The messages every option misses, and every disagreement between the fine-tuned model and Sonnet, were read by hand to separate model mistakes from label problems.
  7. Assumptions are stated and varied. Engineer time, label price and the cost of a mistake are not measured, so notebook 05 shows how far each one moves the answer.
  8. Models run locally in a separate environment (requirements-train.txt) and save only their test predictions to results/. The notebooks read those files, so they rerun without model weights or an API key.