Stop 13 · Fine-Tuning & Adapting LLMsTopics · 1/9

Full Fine-Tuning vs PEFT

Part of the AI Engineer Roadmap

In short

Updating every weight of a 7B model needs big GPUs. PEFT trains a tiny add-on instead and often gets close. Knowing the difference decides whether you can fine-tune on a free Colab or not.

Full fine-tuning updates every model weight (expensive, needs lots of GPU memory); Parameter-Efficient Fine-Tuning updates a small subset — PEFT is the practical default outside large labs.

The blob in a flat chooses between a sledgehammer and new curtains with a small lamp.

Think of it like this

Renovating vs redecorating a rented flat

You can knock down walls and rebuild the kitchen: expensive, slow, and you can't easily undo it. Or you hang new curtains, add lamps and a rug: cheap, quick, and removable. Full fine-tuning is the renovation. PEFT is the redecoration.

Watch it happen

Train everything vs train a little

Full fine-tuning

  • Updates all weights
  • Needs lots of GPU memory
  • Saves a full model copy

PEFT (e.g. LoRA)

  • Freezes base, trains small add-ons
  • Fits on one modest GPU
  • Adapter file is often a few MB

Start with PEFT. Move to full fine-tuning only when you have lots of data, big GPUs, and PEFT has clearly hit a ceiling.

The big ideas

What you need to know

Memory is the bottleneck

Full fine-tuning stores gradients and optimiser states for every weight, often several times the model's own size.

PEFT family

LoRA, QLoRA, adapters and prompt tuning all train a small number of new parameters while the base stays frozen.

Swap adapters

One base model can serve many tasks by loading different small adapters, like one per customer.

Less forgetting

Since the base weights don't change, PEFT tends to forget less of the model's general skills.

See it in code

Walk through the code

python
1from transformers import AutoModelForCausalLM2from peft import LoraConfig, get_peft_model3 4model = AutoModelForCausalLM.from_pretrained("<small-open-model>")5 6config = LoraConfig(r=16, lora_alpha=32, lora_dropout=0.05,7                    target_modules=["q_proj", "v_proj"], task_type="CAUSAL_LM")8model = get_peft_model(model, config)9 10model.print_trainable_parameters()11# prints trainable params vs total params: usually well under 1%

1/3Load any small open causal language model from the Hub.

Wrapping a model with LoRA via Hugging Face PEFT. Module names like q_proj vary by model family.

Save yourself the pain

Common mistakes

Oops

Assuming full fine-tuning is always better.

Do this instead

With small datasets, PEFT often matches it and overfits less. Compare both on a held-out test set if you can.

Oops

Copying target_modules from a tutorial for a different model.

Do this instead

Print model.named_modules() and pick the right layer names for your model's architecture.

Your mission

Count the parameters

~20 min

Quick check

Why does PEFT need far less GPU memory than full fine-tuning?

Go deeper

  1. 1Compare the GPU memory and cost requirements of full fine-tuning vs. PEFT for a given model size.
  2. 2Learn why PEFT can match full fine-tuning quality on most task-specific use cases.
  3. 3Identify which approach makes sense for your hardware budget before starting a project.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge