AI Hints
Home›Fine-Tuning LLMs Tutorial›What Fine-Tuning Is
Fine-Tuning LLMs · Lesson 3 of 120

Pretraining vs Fine-Tuning

Two stages of training.

⏱ 2 min read▶ Video at 3:45🎓 Free
Watch this lesson in the Fine-Tuning LLMs courseWatch on YouTube ↗Full Fine-Tuning LLMs course

Every model you'll fine-tune was trained in two stages. Understanding these two stages explains why fine-tuning is so cheap, and so useful.

  • Two stages of training
  • Why fine-tuning is cheap
  • And why it's useful

Two stages

Stage one is called pretraining. The model reads trillions of words, from books, websites, and code, and learns to predict the next token. That takes weeks, on thousands of GPUs. The result is a base model. It knows a little about everything. Stage two is fine-tuning. We train the base model on a small set of our own examples. That takes hours, often on one GPU. The result is a specialist.

Side by side

Let's compare them. Pretraining uses trillions of words. Fine-tuning uses hundreds, or thousands, of examples. Pretraining costs millions of dollars, and only big labs do it. Fine-tuning can cost a few dollars, and anyone can do it. In this course, we only do fine-tuning. Someone else has already done the expensive part.

Pretraining

  • Trillions of words
  • Weeks, thousands of GPUs
  • Millions of dollars, big labs

Fine-tuning

  • Hundreds of examples
  • Minutes to hours
  • A few dollars, anyone

Our project: Riverside Books

Throughout this course, we'll help one small business. Riverside Books is a bookshop. Every day, customers send messages. Where is my order? Can I return this book? How much does it cost? We'll fine-tune a small model to read each message, and say what the customer wants, and which book it's about.

keyvalue
Riverside Booksa small bookshop
Every daycustomer messages
The taskwhat do they want? which book?
Our toola small fine-tuned model

Summary

Let's recap. Pretraining is huge, slow, and expensive, and makes a base model. Fine-tuning is small, fast, and cheap, and makes a specialist. And we'll fine-tune a model for Riverside Books. Next, when to fine-tune, and when not to.

Key takeaways
  • Pretraining: huge, done for you
  • Fine-tuning: small and cheap
  • Project: Riverside Books
Next up: Prompting, RAG or Fine-Tuning? — choosing the right tool