Home›Fine-Tuning LLMs Tutorial
Free course
Fine-Tuning LLMs Tutorial
Learn to fine-tune large language models from zero, one small and easy step at a time. Every idea is explained in plain words first, then shown in real Hugging Face code, trained for real on a laptop, with real output and real scores.
Course contents
Every lesson has its own page with the explanation, code you can copy, the real output, screenshots from the video, and a link that jumps straight to that moment in the video.
1. What Fine-Tuning Is
2. When to Fine-Tune
3. Setup, the Hub and pipeline()
- Setting Up10:29
- The Hugging Face Hub12:03
- Your First Model: pipeline()13:43
4. Tokenizers
5. Models, Logits and Generation
- Loading a Model20:08
- Logits and Probabilities21:57
- Generating Text23:47
6. Decoding, Instruct Models and Chat Templates
- Decoding Settings25:07
- Base vs Instruct Models26:54
- Chat Templates28:36
7. Memory and Data Types
- Parameters and Memory30:19
- Data Types31:36
- Training Memory33:32
8. How Training Works
- Loss35:22
- Gradients and Learning Rate37:14
- Epochs, Batches, Steps39:11
9. Working with Datasets
- The datasets Library40:45
- map, filter, split42:20
- Our Project Data43:55
10. Classification Fine-Tuning
11. Training with the Trainer
- Trainer and TrainingArguments49:49
- Train It51:23
- Evaluate It52:33
12. Overfitting, Saving and Using
- Overfitting54:09
- Save and Load56:13
- Use Your Model58:06
13. Fine-Tuning a Language Model
- Full Fine-Tuning an LLM59:27
- Labels for Causal LMs1:01:05
- Why We Need PEFT1:02:54
14. LoRA Explained
- PEFT: the Big Idea1:04:34
- LoRA Explained1:05:44
- Rank and Alpha1:07:44
15. LoRA with PEFT
- Which Layers?1:09:24
- LoraConfig1:10:46
- get_peft_model1:12:04
16. Instruction Data
- Instruction Data Formats1:13:51
- Build a Chat Dataset1:15:11
- Train on Answers Only1:16:42
17. Your First LoRA Fine-Tune
- TRL and SFTTrainer1:17:59
- SFTConfig1:19:28
- First LoRA Run1:20:44
18. Results, Loss and Hyperparameters
- Before and After1:22:12
- Reading the Loss1:23:33
- Hyperparameters That Matter1:24:48
19. Save, Load and Merge Adapters
- Saving Adapters1:26:27
- Loading Adapters1:27:40
- Merging Adapters1:28:55
20. Quantization and QLoRA
- Quantization1:30:40
- 4-bit NF41:32:03
- QLoRA1:33:37
21. Fitting Training into Memory
- GPU Memory Budget1:35:05
- Gradient Accumulation1:36:42
- Gradient Checkpointing1:38:22
22. Precision, Length and Hardware
- Mixed Precision1:40:01
- Sequence Length and Packing1:41:19
- Where to Train1:42:30
23. Bigger Models and Many Adapters
- A Bigger Model1:43:41
- Many Adapters1:45:08
- Practice1:46:35
24. Data: Quality and Collection
- Quality Beats Quantity1:47:58
- Collecting Data1:49:15
- Synthetic Data1:50:30
25. Data: Cleaning, Splits and Size
- Cleaning and Dedup1:52:21
- Splits and Leakage1:53:41
- How Much Data?1:55:07
26. Data: Prompts, Conversations and Sharing
- System Prompts1:56:23
- Multi-turn Data1:57:41
- Sharing Datasets1:58:53
27. Data: Balance, Safety and Practice
- Label Balance2:00:01
- Bias and Safety2:01:39
- Data Practice2:03:21
28. Evaluating a Fine-Tuned Model
- Why Evaluation Is Hard2:04:44
- Exact Match and Valid JSON2:06:14
- Perplexity2:07:42
29. Evaluation Loops, Judges and Forgetting
- An Evaluation Loop2:09:20
- LLM as a Judge2:10:54
- Catastrophic Forgetting2:12:27
30. Comparing Runs and Error Analysis
- Comparing Runs2:13:54
- Error Analysis2:15:30
- Evaluation Practice2:17:03
31. Preference Tuning and DPO
- Preference Tuning2:18:15
- DPO2:19:46
- DPO with TRL2:21:14
32. Beyond LoRA: PEFT, Distillation and Prompting
- Other PEFT Methods2:23:03
- Distillation2:24:42
- When Not to Fine-Tune2:26:05
33. Sharing and Serving Your Model
- Push to the Hub2:27:52
- Serving with vLLM2:29:19
- GGUF and Ollama2:32:09
34. Fast Inference, Many Adapters and Costs
- Fast Inference2:33:48
- Serving Many Adapters2:35:32
- Costs2:36:47
35. Project: Plan, Data and Baseline
- Project: Plan2:37:58
- Project: Baseline2:39:14
- Project: Dataset2:40:21
36. Project: Train, Evaluate and Improve
- Project: Train2:41:45
- Project: Evaluate2:42:56
- Project: Improve2:43:58
37. Project: Save, Use and Wrap-up
- Project: Merge and Save2:45:42
- Project: Chat With It2:46:57
- Project: Wrap-up2:48:11
38. Mistakes, Troubleshooting and Interview Basics
- Common Mistakes2:49:35
- Troubleshooting2:51:02
- Interview: Core2:52:32
39. Interview Questions and Cheat Sheets
- Interview: LoRA and Training2:54:20
- Cheat Sheet: Code2:56:31
- Cheat Sheet: Settings2:57:28
40. Final Quiz, Next Steps and Recap
- Final Quiz2:58:42
- What to Learn Next3:00:55
- Course Recap3:01:51