Sub topic 11
Comparing cost, latency, freshness, and control
This chapter compares prompting, retrieval-augmented generation (RAG), and fine-tuning on four dimensions. It assumes you can call a chat-style API, read Python, and know what embeddings and a context window are. The next chapter turns these comparisons into a decision framework.
The four dimensions
Each approach pays for its benefits in a different place.
- Cost has two parts: the one-time cost to build the approach and the per-request cost to run it.
- Latency is the time a user waits for a response.
- Freshness is how quickly the system can use a new or changed fact.
- Control is how reliably you can shape the format, tone, and content of the output.
Prompting
Prompting has almost no setup cost. You edit text and re-run your evaluation set. Every request pays for the instructions and few-shot examples again, though. Input tokens are billed on every call, so a 1,500-token prompt costs more at 100,000 requests a day than it did in testing. Longer prompts also add a little latency.
Freshness is high only if you paste the facts into the prompt yourself. Control is moderate. The model follows instructions most of the time, but it can still drift.
RAG
RAG adds a retrieval step before generation. You pay to build and host an index: chunking, embedding, and a vector store. Each request then pays for one query embedding, one search, and extra prompt tokens for the retrieved passages.
Latency grows by the retrieval time plus the longer prompt. Freshness is the strongest of the three. When a document changes, you re-embed that document, and the next query can use it. Control over content is good, because you can show which passages the answer came from. Control over style is no better than plain prompting.
Fine-tuning
Fine-tuning has the highest setup cost. You must curate training examples, run a training job, and evaluate the result. Per-request cost can then drop, because behavior learned in training no longer needs long instructions or many examples in the prompt. Shorter prompts also reduce latency.
Freshness is the weakest. Facts learned during training are fixed until you train again. Control over style and format is the strongest, because the behavior is part of the model.
Side by side
| Dimension | Prompting | RAG | Fine-tuning |
|---|---|---|---|
| Setup cost | Very low | Medium (index and pipeline) | High (data and training) |
| Per-request cost | Grows with prompt length | Extra tokens plus a search | Often lower, with shorter prompts |
| Latency | Low | Higher (retrieval step) | Low |
| Freshness | Only what you paste in | Best: update the index | Worst: retrain to change |
| Control of style | Moderate | Moderate | Strongest |
| Control of facts | Weak | Strong, with sources | Weak |
A rough break-even calculation
The per-request savings of fine-tuning only matter at volume. This function estimates how many requests it takes to pay back the setup cost.
def breakeven_requests(setup_cost, prompt_cost_per_request, tuned_cost_per_request):
saving = prompt_cost_per_request - tuned_cost_per_request
if saving <= 0:
return None # fine-tuning never pays back on cost alone
return setup_cost / saving
# Example: $500 setup, $0.012 per prompted call, $0.004 per tuned call
print(breakeven_requests(500, 0.012, 0.004)) # 62500.0At about 62,500 requests, the setup cost is recovered. At low volume, it is not. Fine-tuned models can also have a higher per-token price at some providers, so use your real prices.
Where the time goes
Common mistakes
- Judging cost by setup alone. Compare total cost at your expected request volume.
- Expecting fine-tuning to keep facts current. It changes behavior well and updates facts poorly.
- Ignoring retrieval latency. The search step often adds more delay than people expect.
- Treating control as one thing. Control over format and control over facts are different, and different approaches provide each.
Exercise
A support bot answers questions about a product manual that changes weekly. Answers must also follow a strict house tone. Which dimension favors RAG, which favors fine-tuning, and why might you need both?
Show answer
Freshness favors RAG, because you re-embed the changed manual pages and the next query uses them. Control over style favors fine-tuning, because tone is learned behavior and does not need long instructions. Neither covers the other's weakness: a fine-tuned model goes stale on weekly changes, and RAG alone does not guarantee a consistent tone. A combined system, or a strong prompt in front of RAG, covers both needs.
Exercise
Using breakeven_requests, setup cost is $800, a prompted call costs $0.010, and a tuned call costs $0.007. How many requests pay back the setup?
Show answer
The saving is $0.003 per request, so 800 / 0.003 is about 266,667 requests.