🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
HTML MASTER CLASS /// LEARN TAGS /// BUILD STRUCTURE /// SEMANTIC WEB /// HTML MASTER CLASS /// LEARN TAGS ///

Fine-Tuning vs Prompting: A Real Trade-Off, Not a Default

Watch few-shot prompting classify a real ticket, then reason through when a fine-tuned model would actually beat it.

Narrated Video Summary
data-composition-id="aiagentsmasterclass-module3_lesson7"1280×720 @ 30fps3 clips0:49 total

Two Ways to Specialize a Model

TriageAgent's priority check has been a hardcoded rule so far. A real system needs a real classifier — and there are two honest ways to get one: a well-crafted prompt with examples baked in every single call, or a fine-tuned model that already 'knows' the pattern without needing those examples repeated.

// Option A: Prompting
system = "Classify priority. Examples: ..."  // repeated on EVERY call

// Option B: Fine-Tuning
model = "ft:gpt-...:triage-priority"  // pattern is baked in, once

A Real Decision, Not a Default

Fine-tuning isn't automatically the better choice — it's a real trade-off between a recurring per-call cost and a one-time training cost, appropriate for high-volume, narrow, stable tasks. Next lesson: assuming TriageAgent's priority classification qualifies, preparing the real dataset fine-tuning actually needs.

/* Next: Preparing a Real Fine-Tuning Dataset */
0:00 / 0:49
Scene 1 / 3 — Two Ways to Specialize a Model
Total XP: 0|💻 aiagentsmasterclass XP: 0

Skill Matrix

UNLOCK NODES BY LEARNING NEW TAGS.

Prompt or Fine-Tune?

A real trade-off, not an upgrade path.

Quick Quiz //

What real cost does fine-tuning remove that few-shot prompting always pays?


🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Both approaches can genuinely solve the same classification task — the real question is which cost structure fits how you'll actually use it.

1The Real Difference Is Where the Cost Lands

A few-shot prompt pays its cost on every single call — the examples are tokens, resent every time, forever. Fine-tuning pays its cost once, upfront, during training, and then every call afterward is shorter (no examples needed) and, for a genuinely narrow task, often more consistent, because the pattern is baked into the model's weights rather than re-derived from examples each time.

2When Prompting Still Wins

Fine-tuning needs a real, labeled dataset, a real training job, and real evaluation before it's trustworthy — meaningful upfront investment. For a low-volume task, a task that changes frequently, or one where a hand-written prompt already performs well, that investment usually isn't worth it. Prompting stays flexible; a fine-tuned model is comparatively fixed to the pattern it was trained on.

3Step-by-Step Breakdown

Two Ways to Specialize a Model. TriageAgent's priority check has been a hardcoded rule so far. A real system needs a real classifier — and there are two honest ways to get one: a well-crafted prompt with examples baked in every single call, or a fine-tuned model that already 'knows' the pattern without needing those examples repeated.

Watch Few-Shot Prompting Do the Job. Give a real model a system prompt with a few labeled examples baked in, then ask it to classify a new ticket. Watch it work — and notice how much of the prompt is spent on examples that would have to be resent, identically, on every single future classification call.

When does fine-tuning typically become worth it over a well-crafted few-shot prompt like the one you just used?

  • When a narrow, consistent behavior is needed across a very high volume of similar requests, and the recurring per-call cost of resending examples in every prompt outweighs a one-time training investment.
  • Fine-tuning is unconditionally superior and should replace prompting for every task, with no exceptions.

A Real Decision, Not a Default. Fine-tuning isn't automatically the better choice — it's a real trade-off between a recurring per-call cost and a one-time training cost, appropriate for high-volume, narrow, stable tasks. Next lesson: assuming TriageAgent's priority classification qualifies, preparing the real dataset fine-tuning actually needs.

Level Up 🚀

Advanced cheat sheets, SEO tricks, and interview prep for this topic.

Browser Support

ChromeSupported

Fully supported.

FirefoxSupported

Fully supported.

SafariSupported

Fully supported.

EdgeSupported

Fully supported.

Accessibility (A11y)

1Document Which Approach a Given Classifier Uses

Whether a component is a few-shot prompt or a fine-tuned model changes how it's updated and debugged — keep that decision explicit in code comments or config, not implicit in whichever approach happened to be built first.

// priority_classifier: fine-tuned, retrain via scripts/retrain.py

SEO Implications

  • 1

    Target 'fine-tuning vs prompt engineering' and 'when to fine-tune an LLM' separately

    Developers deciding between the two approaches search for the direct comparison and the decision criteria as distinct questions.

Best Practices

Prove the Task Out With Prompting First, Fine-Tune Once Volume Justifies It

Validating the task is well-specified and the model can do it at all with a good prompt is far cheaper than discovering a fine-tuning dataset was built around a poorly-defined task.

Frequent Bugs

THE BUG

Fine-tuning a model for a task that changes frequently, like evolving product categories.

THE FIX

Every meaningful change to the task requires retraining, which is far more expensive than updating a prompt — reserve fine-tuning for genuinely stable, narrow tasks.

Real-World Examples

High-Volume Ticket Classification

A support system classifying tens of thousands of tickets a day into a small, stable set of priority levels is a strong fine-tuning candidate — the per-call savings from dropping repeated examples compound at that volume.

10,000 tickets/day * saved example tokens = real savings

Interview Prep

?Frequently Asked Questions

Pascual Vila

Pascual Vila

Frontend Instructor // Code Syllabus

Common Pitfalls & Errors

The Error //

Hardcoding sensitive credentials

// Wrong const API_KEY = 'sk-123456789'; // Correct const API_KEY = process.env.API_KEY;

The Solution //

Never hardcode API keys, passwords, or secrets in your source code. Use environment variables (.env files) to keep them secure and out of version control.

Lesson Glossary

[01]Few-Shot Prompting

Including a handful of labeled examples directly in the prompt so the model infers the pattern for the current call only.

Code Preview
"Ticket: X -> high\nTicket: Y -> low"

[02]Fine-Tuning

Further training a model on a labeled dataset so it internalizes a pattern, removing the need to repeat examples in every prompt.

Code Preview
model = "ft:base-model:custom-name"

Continue Learning