Fine-tuning vs Prompting — AI Web

Prompting gives instructions and examples in every request. Fine-tuning trains the model's weights (the numbers inside the model) again on examples from a…

A new employee at the Bookshop can be taught in two ways. First, you stick an SOP card (a card with the work rules) by the cash register, and the employee reads it every shift. Second, you send them on a course for several weeks. The SOP card is cheap and can be replaced today. The course is expensive and takes time, and a course doesn't teach today's stock.

A model's behaviour can be changed in two similar ways. Prompting is the SOP card: you give instructions and examples in every request. Fine-tuning is the course: the model is trained again on your examples until its weights (the numbers inside the model) change, then you use the trained model.

Three tools, three problems

Tool What it changes Good for When the data changes
Prompt + examples (few-shot) the request text style, length, format, rules edit the text, it applies at once
RAG / SQL at request time the data you send knowledge: stock, prices, synopses, new books follows the latest data automatically
Fine-tuning the model's weights a style or format that must be consistent at high volume train again

Know the difference between two kinds of problem. Style and format can be taught through examples, for example "always call the customer "friend", at most 2 sentences, end with one recommendation". Knowledge, for example "The Dancer just arrived, 3 in stock", has to be sent through RAG or SQL in every request, because it changes every day. Fine-tuning is the wrong tool for the latest facts.

The order: prompt first, fine-tuning last

  1. Write clear instructions (the Prompt Engineering lesson).
  2. Add 2 to 5 example answers (few-shot).
  3. If the problem is knowledge: RAG or SQL.
  4. If the problem is JSON format: Structured Outputs.
  5. Only once all that has been tried, evaluation (testing with real questions, covered below) still fails, and the volume is high: fine-tuning.

So fine-tuning is chosen when you need highly consistent output in a specific format or style at high volume (a very large number of requests). Having few examples is the wrong reason to choose it: fine-tuning needs at least 10, and OpenAI only sees improvements at 50 to 100. A prompt that is too long is a wrong reason too, because fine-tuning doesn't enlarge the context window (the context limit: the most tokens a model can handle in one request). And fine-tuning is not for the latest facts.

What fine-tuning data looks like

The data is a JSONL file: one complete JSON object per line, in chat message format (a list of messages with roles, as in the Prompt Engineering lesson). Each line is one full example. Its last message is the answer you want to teach, with the role assistant. Here is one line of that file:

{"messages":[{"role":"system","content":"You are the Bookshop assistant."},{"role":"user","content":"<stock_data>\nThe Rainbow Troops | 12\nThis Earth of Mankind | 0\nBeauty Is a Wound | 5\nThe Dancer | 3\n</stock_data>\n<question>Is The Rainbow Troops still in stock?</question>"},{"role":"assistant","content":"Still in stock, friend: The Rainbow Troops has 12. Want a look at Beauty Is a Wound too?"}]}

Then the file is uploaded, and the server creates a job (a training task that OpenAI runs). The code follows OpenAI's "Supervised fine-tuning" guide, checked October 2026:

const file = await client.files.create({ file: fs.createReadStream("shop-style.jsonl"), purpose: "fine-tune" });
const job = await client.fineTuning.jobs.create({
  training_file: file.id,
  model: "gpt-4.1-mini-2025-04-14",
  method: { type: "supervised", supervised: { hyperparameters: { n_epochs: 3 } } },
});
// When it finishes: job.fine_tuned_model, for example "ft:gpt-4.1-mini-2025-04-14:bookshop::abc123"

The steps above show the main weaknesses of fine-tuning. It needs quality training data (examples written or checked by people) and time for evaluation. It also has compute costs, both for training and for every request to the resulting model.

Who still accepts fine-tuning (October 2026)

OpenAI's "Deprecations" page says the self-serve fine-tuning platform (the one you run yourself through the API) is being closed. Its base models (the original models that get trained further) are being shut down too:

Date What changes
7 May 2026 organisations that have never fine-tuned can no longer create jobs
2 July 2026 organisations that haven't used a fine-tuned model in the past 60 days can no longer create jobs
23 October 2026 gpt-4.1-nano and every fine-tuned version of it shut down
15 December 2026 no new fine-tuning jobs for anyone; finished models stay usable until their base model is shut down
14 January 2027 gpt-4.1 and gpt-4.1-mini shut down, with every fine-tuned version of them

These are the text base models that can still be trained (the "Supervised fine-tuning" guide), and their prices (the "Pricing" page, per 1 million tokens):

Base model Training Input / output of the resulting model
gpt-4.1-2025-04-14 $25 $3 / $12
gpt-4.1-mini-2025-04-14 $5 $0.80 / $3.20

You can fine-tune open-weight models yourself (their weights can be downloaded, for example to run through Ollama in a later lesson). But the GPU and the work are yours.

Evaluating before and after

OpenAI's guide advises: set up evaluation first, then fine-tune. How:

  1. Collect 30 to 50 real questions that are not in the training data.
  2. Write checks that code can run, for example: at most 2 sentences, the word "friend" is there, and the stock number equals the SQL result.
  3. Run the same questions on each version: the prompt alone, the prompt + few-shot, and the fine-tuned version (if you have one). Then compare what percentage of answers pass the checks.

If the prompt + few-shot version already passes nearly every check, fine-tuning has nothing left to fix. OpenAI is also closing Evals, its platform for running evaluations (read-only, which means it can only be viewed, from 31 October 2026, then shut down on 30 November 2026). So keep your evaluation set and script in your own repo.

Calculating the cost for the Bookshop

A typical stock question uses 400 input tokens and 40 output tokens (the first lesson). Each few-shot example is about 120 tokens: the JSONL line above, for example, is 115 tokens with the o200k_base tokenizer. So three examples add 3 × 120 = 360 input tokens. A fine-tuned model needs no examples, so its input stays at 400 tokens.

Before you look at the table, guess. Option A: gpt-6-luna with a long prompt carrying 3 example answers. Option B: a fine-tuned gpt-4.1-mini with a short prompt and no examples. Which is cheaper per question?

Option Per question 10,000 questions a day, 30 days
gpt-6-luna + 3 examples: (760 × $0.10 + 40 × $0.50) / 1 million $0.000096 $28.80
fine-tuned gpt-4.1-mini: (400 × $0.80 + 40 × $3.20) / 1 million $0.000448 $134.40
fine-tuned gpt-4.1: (400 × $3 + 40 × $12) / 1 million $0.00168 $504.00

Option A, gpt-6-luna with 3 examples, is cheaper. A short prompt doesn't help when the fine-tuned model's price per token is higher. Training itself is cheap: 50 examples × 120 tokens × 3 epochs = 18,000 tokens, and 18,000 × $5 / 1 million = $0.09 for mini. But every question to the fine-tuned model costs more, so there is no saving to cover that training cost. That means fine-tuning never pays for itself in this shop, whatever the volume. The bigger cost is actually the time spent writing 50 examples and the evaluation.

In the Lab, try raising the number of examples in the prompt. Mini only becomes cheaper per question at 33 examples (4,360 input tokens): prompting $0.000456, mini $0.000448. A prompt that long is rarely needed. Besides, gpt-4.1-mini and its fine-tuned versions shut down on 14 January 2027, and a shop that never fine-tuned has been unable to create jobs since 7 May 2026.

⚠️ When fine-tuning just wastes money

TL;DR: Prompting gives instructions and examples in every request. Fine-tuning trains the model's weights (the numbers inside the model) again on examples from a JSONL file: one {"messages":[system, user, assistant]} per line, at least 10 lines, start with 50. The order: instructions, few-shot (example answers in the prompt), RAG or SQL for knowledge, and Structured Outputs for JSON format. Fine-tuning comes last, when you need a consistent format or style at high volume and evaluation (testing with real questions) still fails. Its weaknesses: it needs quality data, evaluation and compute costs. New data can continue an existing fine-tuned model. As of November 2026 OpenAI is closing self-serve fine-tuning through the API (no new jobs from 15 December 2026). gpt-4.1-nano already shut down on 23 October 2026. The two base models (original models that can be trained) left, gpt-4.1 and gpt-4.1-mini, shut down on 14 January 2027. gpt-4.1-mini: training $5 per 1 million tokens, inference $0.80 (input) / $3.20 (output). For the Bookshop, gpt-6-luna + 3 examples ($0.000096 per question) is cheaper than a model fine-tuned from mini ($0.000448) or from gpt-4.1 ($0.00168). So in this shop fine-tuning never pays for itself.

⚡ An SOP card or a course

Meaning: A new employee can be taught with an SOP card (a card with the work rules) by the cash register, or on a course of several weeks. A model is the same. Prompting is like the SOP card: instructions and examples are sent in every request, and can be replaced today. Fine-tuning is like the course: the model is trained again on your examples until its weights (the numbers inside the model) change.

⚡ Style through examples, knowledge through data

Meaning: The style and format of answers (for example always saying "friend", at most 2 sentences) can be taught through examples. Knowledge like stock and new books changes every day, so send it in every request through RAG or an SQL query. Fine-tuning is the wrong tool for the latest facts.

⚡ One line of training data

Write:

{"messages":[{"role":"system","content":"You are the Bookshop assistant."},{"role":"user","content":"<stock_data>\nThe Rainbow Troops | 12\nThis Earth of Mankind | 0\nBeauty Is a Wound | 5\nThe Dancer | 3\n</stock_data>\n<question>Is The Rainbow Troops still in stock?</question>"},{"role":"assistant","content":"Still in stock, friend: The Rainbow Troops has 12. Want a look at Beauty Is a Wound too?"}]}

Meaning: Fine-tuning data is written as a JSONL file: one complete JSON object per line, and each line is one example conversation. Its last message is the assistant answer you want to teach. The file needs at least 10 lines, and OpenAI suggests starting with 50. The weaknesses of fine-tuning: it needs quality data, time for evaluation (testing the results), and compute costs.

⚡ When to fine-tune

Guess first: a fine-tuned model needs no examples in the prompt, so its prompt is shorter. Which is cheaper per question: gpt-6-luna with a prompt carrying 3 examples, or a fine-tuned gpt-4.1-mini with no examples?

gpt-6-luna with 3 examples: $0.000096 per question, against $0.000448. The fine-tuned model's price per token is higher, so the shorter prompt doesn't help.

Meaning: Choose fine-tuning only when you need highly consistent output in a specific format or style at high volume (a very large number of requests). And even then, only when prompt plus few-shot still fails the evaluation (testing with real questions).

What you will learn