Fine-Tuning LLMs Tutorial 120 lessons · 3:01:51+ of video
Fine-Tuning LLMs Home What Fine-Tuning Is
What Is Fine-Tuning? How LLMs Work Pretraining vs Fine-Tuning When to Fine-Tune
Prompting, RAG or Fine-Tuning? What Fine-Tuning Can and Can't Do The Tools: Transformers, PEFT, TRL Setup, the Hub and pipeline()
Setting Up The Hugging Face Hub Your First Model: pipeline() Tokenizers
Tokenizers Token IDs and Special Tokens Padding, Truncation, Attention Masks Models, Logits and Generation
Loading a Model Logits and Probabilities Generating Text Decoding, Instruct Models and Chat Templates
Decoding Settings Base vs Instruct Models Chat Templates Memory and Data Types
Parameters and Memory Data Types Training Memory How Training Works
Loss Gradients and Learning Rate Epochs, Batches, Steps Working with Datasets
The datasets Library map, filter, split Our Project Data Classification Fine-Tuning
Classification Fine-Tuning Tokenize the Dataset A Classification Model Training with the Trainer
Trainer and TrainingArguments Train It Evaluate It Overfitting, Saving and Using
Overfitting Save and Load Use Your Model Fine-Tuning a Language Model
Full Fine-Tuning an LLM Labels for Causal LMs Why We Need PEFT LoRA Explained
PEFT: the Big Idea LoRA Explained Rank and Alpha LoRA with PEFT
Which Layers? LoraConfig get_peft_model Instruction Data
Instruction Data Formats Build a Chat Dataset Train on Answers Only Your First LoRA Fine-Tune
TRL and SFTTrainer SFTConfig First LoRA Run Results, Loss and Hyperparameters
Before and After Reading the Loss Hyperparameters That Matter Save, Load and Merge Adapters
Saving Adapters Loading Adapters Merging Adapters Quantization and QLoRA
Quantization 4-bit NF4 QLoRA Fitting Training into Memory
GPU Memory Budget Gradient Accumulation Gradient Checkpointing Precision, Length and Hardware
Mixed Precision Sequence Length and Packing Where to Train Bigger Models and Many Adapters
A Bigger Model Many Adapters Practice Data: Quality and Collection
Quality Beats Quantity Collecting Data Synthetic Data Data: Cleaning, Splits and Size
Cleaning and Dedup Splits and Leakage How Much Data? Data: Prompts, Conversations and Sharing
System Prompts Multi-turn Data Sharing Datasets Data: Balance, Safety and Practice
Label Balance Bias and Safety Data Practice Evaluating a Fine-Tuned Model
Why Evaluation Is Hard Exact Match and Valid JSON Perplexity Evaluation Loops, Judges and Forgetting
An Evaluation Loop LLM as a Judge Catastrophic Forgetting Comparing Runs and Error Analysis
Comparing Runs Error Analysis Evaluation Practice Preference Tuning and DPO
Preference Tuning DPO DPO with TRL Beyond LoRA: PEFT, Distillation and Prompting
Other PEFT Methods Distillation When Not to Fine-Tune Sharing and Serving Your Model
Push to the Hub Serving with vLLM GGUF and Ollama Fast Inference, Many Adapters and Costs
Fast Inference Serving Many Adapters Costs Project: Plan, Data and Baseline
Project: Plan Project: Baseline Project: Dataset Project: Train, Evaluate and Improve
Project: Train Project: Evaluate Project: Improve Project: Save, Use and Wrap-up
Project: Merge and Save Project: Chat With It Project: Wrap-up Mistakes, Troubleshooting and Interview Basics
Common Mistakes Troubleshooting Interview: Core Interview Questions and Cheat Sheets
Interview: LoRA and Training Cheat Sheet: Code Cheat Sheet: Settings Final Quiz, Next Steps and Recap
Final Quiz What to Learn Next Course Recap Fine-Tuning LLMs · Lesson 4 of 120
Prompting, RAG or Fine-Tuning? Choosing the right tool.
⏱ 2 min read ▶ Video at 5:35 🎓 Free
▶ starts at 5:35 Fine-tuning is powerful. But it's not always the right tool. There are three main ways to make a model do what you want. Let's meet all three, and learn when to use each one.
Not always the right tool Three main ways When to use each one The first is prompting. You write better instructions, and examples, in the message you send. The second is RAG, which stands for retrieval augmented generation. You search your documents, and paste the useful parts into the prompt. The third is fine-tuning. You change the model's weights, with your own examples.
Prompting better instructions in the message
RAG search your documents, add them to the prompt
Fine-tuning change the weights with examples
Here's a simple guide. If you need new facts, like today's prices, use RAG. Facts change, and RAG always reads the latest version. If you need a style, a format, or a skill done the same way every time, fine-tuning shines. And if a good prompt already works, just use the prompt. It's the cheapest option.
You need… Best tool A quick result prompting Up-to-date facts RAG A fixed style or format fine-tuning A small, fast, cheap model fine-tuning
Prefer to watch? The full Fine-Tuning LLMs course is free All lessons in one video with animations, real code and chapters.
Watch free A good rule. Always try prompting first. It's free, and it takes minutes. If the results aren't good enough, or the prompt gets very long and expensive, then consider fine-tuning. And these tools work together. A fine-tuned model can still use RAG.
key value Step 1 try a good prompt Step 2 add RAG for facts Step 3 fine-tune for behaviour Together they combine well
Let's recap. Prompting changes the message. RAG adds facts from your documents. Fine-tuning changes the weights, and is best for style, format, and skills. And always try prompting first. Next, what fine-tuning can, and can't, do.
Key takeaways Prompting: the message RAG: facts Fine-tuning: behaviour