AI Hints
Home›Fine-Tuning LLMs Tutorial›LoRA Explained
Fine-Tuning LLMs · Lesson 40 of 120

PEFT: the Big Idea

Freeze and adapt.

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

Let's understand the PEFT idea properly, because everything else in this course builds on it. Freeze the big model. Add a few small, trainable pieces. Train only those.

  • Freeze the big model
  • Add small trainable pieces
  • Train only those

Adapters

The small trainable pieces are often called adapters. Think of a travel adapter for a plug. The plug doesn't change. The adapter sits next to it, and makes it fit a new socket. In the same way, the model doesn't change. The adapter changes how it behaves, for our task.

keyvalue
Adaptersmall trainable add-on
Travel plugstays the same
The modelstays frozen
The adapterfits it to our task

Why freezing helps

Why does freezing help so much? Frozen weights need no gradients. They need no optimizer states. They're never saved again, because they never change. All the expensive training memory is only needed for the adapter, which is tiny.

Frozen weights need…Adapter needs…
no gradientsgradients
no Adam statesAdam states
no new copy on diska small file
only memory to runall training memory, but tiny

Summary

Let's recap. PEFT freezes the base model. Small adapters learn the task. And because frozen weights need no gradients or optimizer states, training memory drops hugely. Next, the most popular adapter, LoRA.

Key takeaways
  • Freeze the model
  • Train an adapter
  • Much less memory
Next up: LoRA Explained — low-rank adaptation