AI Hints
Home›Fine-Tuning LLMs Tutorial›Fine-Tuning a Language Model
Fine-Tuning LLMs · Lesson 39 of 120

Why We Need PEFT

A cheaper way.

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

Full fine-tuning works, but it's expensive. It needs huge memory, and every result is a full sized copy. Researchers asked a clever question. Do we really need to change every weight?

  • Expensive memory
  • Full-sized copies
  • Do we need every weight?

The surprising answer

The answer is no. A pretrained model already knows almost everything. Fine-tuning only needs a small adjustment. And research showed that this adjustment is simple. It can be described with very few numbers. So we can freeze the original weights, and train only a tiny set of new ones.

keyvalue
Pretrained modelalready knows a lot
Fine-tuninga small adjustment
The adjustmentneeds few numbers
Sofreeze, and train a little

Full fine-tuning vs PEFT

PEFT stands for parameter efficient fine-tuning. Compare it with full fine-tuning. Full fine-tuning trains every weight, needs huge memory, and saves a full copy. PEFT freezes the model, trains often less than one percent of the parameters, needs far less memory, and saves a tiny file, often just a few megabytes. And the results are usually almost as good.

Full fine-tuning

  • Trains 100% of weights
  • Huge memory
  • Saves a full copy

PEFT

  • Trains often < 1%
  • Far less memory
  • Saves a few MB

Quick check

Let's check. In PEFT, what happens to the original model weights? Pause, and think about it. The answer is B. They're frozen. Only a small set of new weights is trained.

Quick check
In PEFT, the original model weights are...

Summary

Let's recap. Fine-tuning only needs a small adjustment. PEFT freezes the model, and trains a tiny set of new weights. It saves memory, and storage. Next, the most popular PEFT method of all. LoRA.

Key takeaways
  • A small adjustment
  • Freeze + train a little
  • PEFT saves memory
Next up: PEFT: the Big Idea — freeze and adapt