AI Hints
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.

📚 120 lessons▶ 3:01:51+ of video💻 103 code examples🖼 0 screenshots
The complete Fine-Tuning LLMs course, free on YouTubeWatch on YouTube ↗

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.

3. Setup, the Hub and pipeline()

  1. Setting Up10:29
  2. The Hugging Face Hub12:03
  3. Your First Model: pipeline()13:43

5. Models, Logits and Generation

  1. Loading a Model20:08
  2. Logits and Probabilities21:57
  3. Generating Text23:47

6. Decoding, Instruct Models and Chat Templates

  1. Decoding Settings25:07
  2. Base vs Instruct Models26:54
  3. Chat Templates28:36

7. Memory and Data Types

  1. Parameters and Memory30:19
  2. Data Types31:36
  3. Training Memory33:32

8. How Training Works

  1. Loss35:22
  2. Gradients and Learning Rate37:14
  3. Epochs, Batches, Steps39:11

9. Working with Datasets

  1. The datasets Library40:45
  2. map, filter, split42:20
  3. Our Project Data43:55

11. Training with the Trainer

  1. Trainer and TrainingArguments49:49
  2. Train It51:23
  3. Evaluate It52:33

12. Overfitting, Saving and Using

  1. Overfitting54:09
  2. Save and Load56:13
  3. Use Your Model58:06

13. Fine-Tuning a Language Model

  1. Full Fine-Tuning an LLM59:27
  2. Labels for Causal LMs1:01:05
  3. Why We Need PEFT1:02:54

14. LoRA Explained

  1. PEFT: the Big Idea1:04:34
  2. LoRA Explained1:05:44
  3. Rank and Alpha1:07:44

15. LoRA with PEFT

  1. Which Layers?1:09:24
  2. LoraConfig1:10:46
  3. get_peft_model1:12:04

17. Your First LoRA Fine-Tune

  1. TRL and SFTTrainer1:17:59
  2. SFTConfig1:19:28
  3. First LoRA Run1:20:44

18. Results, Loss and Hyperparameters

  1. Before and After1:22:12
  2. Reading the Loss1:23:33
  3. Hyperparameters That Matter1:24:48

19. Save, Load and Merge Adapters

  1. Saving Adapters1:26:27
  2. Loading Adapters1:27:40
  3. Merging Adapters1:28:55

20. Quantization and QLoRA

  1. Quantization1:30:40
  2. 4-bit NF41:32:03
  3. QLoRA1:33:37

21. Fitting Training into Memory

  1. GPU Memory Budget1:35:05
  2. Gradient Accumulation1:36:42
  3. Gradient Checkpointing1:38:22

22. Precision, Length and Hardware

  1. Mixed Precision1:40:01
  2. Sequence Length and Packing1:41:19
  3. Where to Train1:42:30

23. Bigger Models and Many Adapters

  1. A Bigger Model1:43:41
  2. Many Adapters1:45:08
  3. Practice1:46:35

24. Data: Quality and Collection

  1. Quality Beats Quantity1:47:58
  2. Collecting Data1:49:15
  3. Synthetic Data1:50:30

25. Data: Cleaning, Splits and Size

  1. Cleaning and Dedup1:52:21
  2. Splits and Leakage1:53:41
  3. How Much Data?1:55:07

26. Data: Prompts, Conversations and Sharing

  1. System Prompts1:56:23
  2. Multi-turn Data1:57:41
  3. Sharing Datasets1:58:53

27. Data: Balance, Safety and Practice

  1. Label Balance2:00:01
  2. Bias and Safety2:01:39
  3. Data Practice2:03:21

28. Evaluating a Fine-Tuned Model

  1. Why Evaluation Is Hard2:04:44
  2. Exact Match and Valid JSON2:06:14
  3. Perplexity2:07:42

29. Evaluation Loops, Judges and Forgetting

  1. An Evaluation Loop2:09:20
  2. LLM as a Judge2:10:54
  3. Catastrophic Forgetting2:12:27

30. Comparing Runs and Error Analysis

  1. Comparing Runs2:13:54
  2. Error Analysis2:15:30
  3. Evaluation Practice2:17:03

31. Preference Tuning and DPO

  1. Preference Tuning2:18:15
  2. DPO2:19:46
  3. DPO with TRL2:21:14

32. Beyond LoRA: PEFT, Distillation and Prompting

  1. Other PEFT Methods2:23:03
  2. Distillation2:24:42
  3. When Not to Fine-Tune2:26:05

33. Sharing and Serving Your Model

  1. Push to the Hub2:27:52
  2. Serving with vLLM2:29:19
  3. GGUF and Ollama2:32:09

34. Fast Inference, Many Adapters and Costs

  1. Fast Inference2:33:48
  2. Serving Many Adapters2:35:32
  3. Costs2:36:47

35. Project: Plan, Data and Baseline

  1. Project: Plan2:37:58
  2. Project: Baseline2:39:14
  3. Project: Dataset2:40:21

36. Project: Train, Evaluate and Improve

  1. Project: Train2:41:45
  2. Project: Evaluate2:42:56
  3. Project: Improve2:43:58

37. Project: Save, Use and Wrap-up

  1. Project: Merge and Save2:45:42
  2. Project: Chat With It2:46:57
  3. Project: Wrap-up2:48:11

38. Mistakes, Troubleshooting and Interview Basics

  1. Common Mistakes2:49:35
  2. Troubleshooting2:51:02
  3. Interview: Core2:52:32

39. Interview Questions and Cheat Sheets

  1. Interview: LoRA and Training2:54:20
  2. Cheat Sheet: Code2:56:31
  3. Cheat Sheet: Settings2:57:28

40. Final Quiz, Next Steps and Recap

  1. Final Quiz2:58:42
  2. What to Learn Next3:00:55
  3. Course Recap3:01:51