Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
Fine-tuning has costs that don't show up until you're committed: building and cleaning a dataset (usually the biggest cost), GPU time for training, an eval harness to prove it worked, and the ongoing burden of hosting and re-training as the world changes. The benefit has to clear that bar — and it often does, especially when a fine-tuned small model replaces an expensive large hosted one at a fraction of the per-token cost. This task makes the trade-off quantitative so you decide with numbers, not vibes: when does the upfront cost pay back, and how fast?
The demo is a simple break-even calculator: it compares the all-in cost of a fine-tuning project (data + training + hosting) against staying on a hosted API, and reports how many requests it takes to pay back.
Use these three in order. Each builds on the one before.
In one paragraph, what are the real costs of a fine-tuning project beyond the training run itself?
Walk me through how to build a break-even analysis comparing a fine-tuned self-hosted model against a hosted API.
Given 200k requests/month currently on a hosted model at a known price, estimate whether fine-tuning a small open model to self-host would pay back within a quarter, and what assumptions dominate the answer.
def breakeven(hosted_cost_per_1k_req, self_hosted_cost_per_1k_req,
one_time_finetune_cost):
savings_per_1k = hosted_cost_per_1k_req - self_hosted_cost_per_1k_req
if savings_per_1k <= 0:
return "Self-hosting is not cheaper per request -- fine-tune only for behavior, not cost"
req_to_breakeven = (one_time_finetune_cost / savings_per_1k) * 1000
return f"Break even after ~{req_to_breakeven:,.0f} requests"
# Hosted big model: $15 / 1k requests. Self-hosted fine-tuned small model: $2 / 1k.
# One-time project cost (data + a few Colab/cloud GPU hours + your time): $400.
print(breakeven(hosted_cost_per_1k_req=15, self_hosted_cost_per_1k_req=2,
one_time_finetune_cost=400))python3 main.py