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.
Everything in this module collapses into one repeatable decision tree you can run in five minutes before any LLM project: is it knowledge or behavior, do you have data and an eval, have you exhausted prompting, and is a small fine-tuned model the cheapest path to your latency or cost goal. Encoding the whole module as a single function makes the decision fast, consistent, and shareable with your team. This is the artifact you'll actually reuse — the rest of the course assumes you've run it and landed on 'yes, fine-tune.'
The demo composes the whole module into one decision tree that returns a concrete recommendation, so you never start a fine-tune on instinct again.
Use these three in order. Each builds on the one before.
In one paragraph, give me a simple decision tree for whether to fine-tune, use RAG, or just prompt.
Walk me through each branch of a fine-tune-vs-RAG-vs-prompt decision tree and why the order of checks matters.
Critique this decision tree for a production setting: what edge cases (multilingual, regulated facts, multi-tenant) would I need to add branches for, and why?
def decide(problem):
if problem["needs_fresh_or_private_facts"]:
return "RAG (optionally + a small format fine-tune on top)"
if not problem["tried_prompting"]:
return "Prompt engineering first -- cheapest reversible lever"
if problem["num_examples"] < 100:
return "Few-shot prompting -- not enough data to fine-tune"
if not problem["can_build_eval"]:
return "Build an eval set first -- otherwise you can't prove anything"
if problem["latency_or_cost_critical"]:
return "Fine-tune a SMALL model (LoRA/QLoRA) and self-host -- this course"
if problem["needs_consistent_style_or_format"]:
return "Fine-tune with LoRA -- this course"
return "Prompting is probably enough; revisit if it plateaus"
example = {"needs_fresh_or_private_facts": False, "tried_prompting": True,
"num_examples": 800, "can_build_eval": True,
"latency_or_cost_critical": True, "needs_consistent_style_or_format": True}
print(decide(example))python3 main.py