# What Is PEFT?

> What PEFT is, why it saves memory and storage, and how LoRA and adapters work, for your AI interview.

**In short:** PEFT, parameter-efficient fine-tuning, adapts a large pre-trained model by training only a small number of its parameters, often as a small add-on. The original weights usually stay frozen, so training and storage cost far less, and results can be comparable to full fine-tuning.

AI and LLM interview question Q283, Fine-tuning and adaptation. Intermediate, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-is-peft

## Say it in 30 seconds

PEFT stands for parameter-efficient fine-tuning. Instead of retraining every weight in a large model, you freeze most of the original weights and train a small part, often an add-on. LoRA is one such version. It adds two small matrices to each layer, so only a tiny share of the weights get trained. The gain is lower memory and storage, and results can be comparable to full fine-tuning. Comparable is not the same as identical, so you still test it on your own task.

## Say it in 2 minutes

PEFT stands for parameter-efficient fine-tuning. Fine-tuning means training a pre-trained model further on your own examples, so it learns your task. The old way retrains every weight, which is slow, and every task ends up with its own full copy of the model. PEFT changes only a small part.

The method to know first is LoRA, low-rank adaptation. The original weights stay frozen. For each layer, LoRA adds two small matrices, and only those are trained. Because the add-on is small, you can store one base model and a small file per team, instead of twelve full copies. Adapters and prompt tuning are other PEFT methods, with their own trade-offs. Adapters are small layers added to the model. The 2019 adapter paper reported results within 0.4% of full fine-tuning on GLUE, adding 3.6% parameters per task. Prompt tuning trains a short set of learnable prompt vectors while the model stays frozen.

The trade-off is quality. The Hugging Face PEFT docs say PEFT can give performance comparable to full fine-tuning. Comparable is not the same as identical, so I would test on our own data, check the results against a plain baseline, and only then choose the method. For a bank with twelve teams, the saving on storage alone can be large.

## What is PEFT, in plain words?

A bank hires a senior analyst who already knows finance. Rather than send them back to school for every new desk, the bank gives them one short course on that desk's own rules. Their old knowledge stays where it was.

A large model works the same way: it is pre-trained, so it already knows a lot of language. Fine-tuning is a short course on your task: you train the model further on your own examples. Full fine-tuning updates every weight, the numbers inside the model that training adjusts. Weights are also called parameters. PEFT updates only a small part.

- **Pre-trained model:** A model already trained on a large, general set of text, before your task.
- **Fine-tuning:** Further training on your own examples, so the model fits your task.
- **Frozen weights:** Weights locked on purpose, so training does not change them.
- **Add-on:** A small set of new weights trained on top of the frozen model.
- **Matrix:** A grid of numbers. LoRA trains two small grids beside each layer.

A survey first submitted in March 2024 defines PEFT as adjusting a pre-trained large model for a specific task while minimising the number of additional parameters and the computing resources it needs. The Hugging Face PEFT library collects many such methods, and it is integrated with the Transformers, Diffusers and Accelerate libraries.

## Why is full fine-tuning too heavy?

Full fine-tuning updates every weight, so every task ends up with its own full copy of the model. The LoRA paper says this gets harder as models grow. The adapter paper, from 2019, said the same about many tasks:

> "As we pre-train larger models, full fine-tuning, which retrains all model parameters, becomes less feasible." (LoRA paper, 2021)
>
> "fine-tuning is parameter inefficient: an entire new model is required for every task." (Adapter paper, 2019)

So there are two costs: the compute to train every weight, and the storage and serving of one full copy per task. PEFT aims at both.

*Diagram, Twelve teams, two ways to store them: Twelve full copies of a model store far more weights than one shared base with twelve small add-ons. The numbers come from the made-up example further down.*
1. Each team stores its own full copy, so storage grows by a whole model per team.
2. Storage grows only by one small add-on per team, on top of one shared base.

## How does LoRA make a small add-on?

LoRA is one PEFT method, and the one this answer explains in detail. The paper proposes freezing the pre-trained weights and injecting trainable rank decomposition matrices into each layer, so far fewer parameters get trained.

1. **Freeze the base:** The base model's weights are locked. Training never changes them.
2. **Add two small matrices:** For each weight table, add a tall, thin matrix and a short, wide one. Their narrow middle is the rank r, a small number you choose.
3. **Train only those:** Normal training updates just the two small matrices, not the table itself.
4. **Save the small file:** The output is the base output plus the add-on's change. You store only the small file per team.

*Diagram, How LoRA adds a small trained part: The same input feeds the frozen base model and a pair of small matrices. Their two outputs are added. Only the matrices are trained.*
1. The input goes into the frozen base model.
2. The add-on reads that same input at the same time.
3. Matrix A shrinks it to a few numbers, then matrix B grows it back.
4. The add-on's change is sent on to the answer.
5. The base output goes to the same answer, and the two are added.

Here is the arithmetic for one weight table, then for a bank with twelve teams. The numbers are made up. The arithmetic is real.

```python
# A made-up bank: 12 teams each want their own tuned version of one base model.
# Every number here is made up, to show the shape of the saving.
TABLES = 32   # weight tables in the base model (made-up)
WIDTH = 4096  # rows and columns in each table (made-up)
RANK = 8      # size of the LoRA add-on for each table (made-up)
TEAMS = 12

one_table = WIDTH * WIDTH                     # weights in one table
one_addon = RANK * (WIDTH + WIDTH)            # trained weights for one table
print(f"One table, full training: {one_table:,} weights")
print(f"One table, LoRA add-on:   {one_addon:,} weights ({one_addon / one_table:.2%})")

base = TABLES * one_table                     # the frozen base model
addon = TABLES * one_addon                    # what each team trains and stores
full_copies = TEAMS * base
peft_total = base + TEAMS * addon
print(f"Full copies for {TEAMS} teams: {full_copies:,} weights")
print(f"One base plus {TEAMS} add-ons:  {peft_total:,} weights")
print(f"Weights saved: {full_copies - peft_total:,}")
```

Output:

```text
One table, full training: 16,777,216 weights
One table, LoRA add-on:   65,536 weights (0.39%)
Full copies for 12 teams: 6,442,450,944 weights
One base plus 12 add-ons:  562,036,736 weights
Weights saved: 5,880,414,208
```

Read the last lines as the bank's storage bill. Twelve full copies hold 6,442,450,944 weights. One base plus twelve add-ons holds 562,036,736. That is far less to train and store, and the results still need measuring.

## What are the other PEFT methods?

- **Adapters: Small layers inside the model.** Adapter modules are added per task. In the 2019 adapter paper's tests, they came within 0.4% of full fine-tuning on GLUE, adding 3.6% parameters per task.
- **Prompt tuning: Learned soft prompts.** A short set of learnable vectors goes in with the input, while the model stays frozen. They are not human readable.
- **LoRA: Small matrices beside each layer.** Freezes the base and trains low-rank matrices. The paper says that, unlike adapters, it adds no inference latency.

The PEFT quick tour puts prompt tuning and LoRA side by side: train a smaller number of prompt parameters, or reduce the trainable parameters with a method like LoRA. The LoRA paper adds that, unlike adapters, LoRA adds no inference latency.

## What are the trade-offs?

- **Less memory and cost:** Training and storage need far less. This is the main win.
- **Quality to measure:** Results can differ from full fine-tuning, so test on your own data.
- **Settings to tune:** The rank, and which layers to adapt, need tuning too.
- **Base still loads:** You still load the full base model to run it.

> "yielding performance comparable to a fully fine-tuned model" (Hugging Face PEFT docs)
>
> "unlike adapters, no additional inference latency" (LoRA paper, 2021)

In its GPT-3 test, the LoRA paper says LoRA can reduce trainable parameters by 10,000 times and GPU memory needs by 3 times, compared with full fine-tuning using Adam.

> **Tip:** Asked about PEFT's cost, lead with lower training and storage. Then say the quality has to be measured against a full fine-tune or a clear baseline on your data.

### How would you pick PEFT for twelve teams at a bank?

The bank's twelve teams each want a tuned assistant for their own work, such as card disputes, loan letters and branch FAQs. This is the order I would work in.

1. **Try good prompts and documents first:** Good instructions, examples and reference documents often solve it. Tuning is for what those cannot fix, such as a house writing style.
2. **Use PEFT where weights must learn:** LoRA fits when a team has enough examples and the base model has to learn the style or the task.
3. **Share one base, one add-on per team:** Serve the base once and load each team's small add-on. The adapter paper says new tasks can be added without revisiting previous ones.
4. **Measure each add-on against the base:** Test on held-out cases from that team's own work, and keep the list of failures before every release.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: train a small add-on, and freeze the rest.
- [ ] Why it exists: full fine-tuning is heavy to train and to store.
- [ ] The main methods, with LoRA first.
- [ ] The trade-off: far less compute, and quality to be measured.
- [ ] A storage example: one base plus small add-ons.
- [ ] Honest limits: comparable is not the same as identical.

**Common traps**

- Trap: "PEFT is a smaller model you train from scratch." Better: PEFT is a way to adapt a pre-trained model with a small set of added weights.
- Trap: "PEFT always matches full fine-tuning." Better: The docs say comparable performance. Test on your own data before you claim it.
- Trap: "PEFT means no GPU is needed." Better: It cuts training and storage load. The base model still has to load and run on real hardware.

## Can you pick the right plan?

**Spot the right plan:** A team wants its loan-letter assistant to write in the house style. Which plan uses PEFT correctly?

A. Retrain every weight of the base model on the letters, then ship a full copy.
B. Freeze the base, train a small LoRA add-on on the letters, and ship only the add-on.
C. Delete the base model and keep only the add-on, since it is smaller.
D. Paste the letters into every prompt, with no training at all.

**Answer:** B. Only the add-on trains and ships, while the base stays frozen and shared. The first option is full fine-tuning, the third breaks the add-on because it needs its base, and the last is prompting, not PEFT.

**Quick check:** Which statement about LoRA is true?

A. It retrains every weight of the base model.
B. It freezes the base weights and trains small rank-decomposition matrices.
C. It changes the wording of the user's prompt each time.
D. It needs no base model at run time.

**Answer:** B. LoRA freezes the pre-trained weights and trains small matrices instead. The other options describe full fine-tuning or prompting, and an add-on needs its base model to run.

## Can you answer these from memory?

**Flash cards**

- **What does PEFT stand for?** Parameter-efficient fine-tuning: train a small part, keep the rest frozen.
- **What is LoRA, in one line?** A PEFT method: two small matrices per layer are trained, the base stays frozen.
- **Why does PEFT save storage?** Each task stores only its small add-on, not a full copy of the model.
- **Is PEFT the same as full fine-tuning?** No. The docs say comparable performance. Comparable is not the same as identical.
- **What delay do adapters add that LoRA does not?** Extra delay when the model answers. The LoRA paper says LoRA adds none.
- **Name a PEFT method besides LoRA.** Adapters, or soft prompt methods such as prompt tuning.

## Likely follow-up questions

- Q282 What is full fine-tuning? https://designervenkat.online/interview/ai/what-is-full-fine-tuning
- Q284 What is LoRA? https://designervenkat.online/interview/ai/what-is-lora
- Q285 What is QLoRA? https://designervenkat.online/interview/ai/what-is-qlora
- Q286 What does LoRA rank mean? https://designervenkat.online/interview/ai/what-does-lora-rank-mean
- Q281 Fine-tune vs RAG vs prompting: when to use which? https://designervenkat.online/interview/ai/fine-tuning-vs-rag-vs-prompting
- Q287 What is SFT / instruction tuning? https://designervenkat.online/interview/ai/what-is-supervised-fine-tuning

## Learn it in depth

- [Fine-tuning](https://designervenkat.online/learn/ai-engineering/fine-tuning)
