# Chapter 19: Fine-tuning in brief

Part of the course “AI from Zero to Autonomous Agents” (https://llm.yoga/en). Page for humans: https://llm.yoga/en/19-fine-tuning

*Fine-tuning a model sounds like the big lever. Usually it’s the last one, and when you do pull it, it’s with a few million parameters instead of billions.*

About 20 min to read · about 60 min hands-on exercise

**Start with the missions**

This chapter also comes as 3 short missions with a case, a decision and feedback, about 10 minutes each:

- [19.1 Our own model with our product knowledge?](https://llm.yoga/en/einsatz-19-1.md)
- [19.2 Can I fine-tune on my laptop?](https://llm.yoga/en/einsatz-19-2.md)
- [19.3 Are 80 examples enough?](https://llm.yoga/en/einsatz-19-3.md)

For agents, this page is split into 3 parts so that each part can be fetched in full. Read the parts the question needs.

## Parts

### Part 1: https://llm.yoga/en/19-fine-tuning-1.md

- **Getting started**: A new employee arrives with a good education.
- **What fine-tuning is**: A large language model is built in stages.
- **When yes, when no**: The most important rule comes before any technique: prompt first, then retrieve, and only after that, train.

### Part 2: https://llm.yoga/en/19-fine-tuning-2.md

- **Full fine-tuning, LoRA and QLoRA**: In full fine-tuning, all the model’s weights are adjusted.
- **Data: quantity, quality, format**: In fine-tuning, the dataset is the product.
- **Evaluation**: Fine-tuning without evaluation is guessing.

### Part 3: https://llm.yoga/en/19-fine-tuning-3.md

- **Risks**: Overfitting. Too many passes over too few examples, and the model repeats training answers almost word for word, even when the input is only similar.
- **Exercise: a LoRA adapter on the Mac**: Goal: you train a small LoRA adapter that makes a tiny model translate customer requests into a fixed JSON ticket, and you compare before and after.
- **Common misconceptions**: With fine-tuning, I teach the model our company knowledge.
- **Review questions**: 1. A team wants its internal assistant to know the current prices of all 400 products.
- **Go further**: Hu et al.: LoRA: Low-Rank Adaptation of Large Language Models (2021).
