# What Is LoRA?

> What LoRA is, why it makes fine-tuning a large model far cheaper, and where it still needs testing, explained simply for your AI interview.

**In short:** LoRA (Low-Rank Adaptation) fine-tunes a large model by freezing its original weights and training only small matrices added to each layer. It matches or beats full fine-tuning on the paper's tests, with far fewer trainable numbers and less GPU memory for training, so one base model can serve many teams.

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

## Say it in 30 seconds

LoRA stands for Low-Rank Adaptation. It fine-tunes a large model by freezing the original weights and training only a small pair of matrices added to each layer. The 2021 paper that introduced it reported quality on par or better than fine-tuning on its tests, with far fewer trainable parameters. The big win for a team is cost: one base model can serve many teams, each with a small adapter they can swap in.

## Say it in 2 minutes

A large language model has a huge number of weights, which hold what it learned. Full fine-tuning changes every one of them. The 2021 LoRA paper says full fine-tuning becomes less feasible as models grow, and that deploying independent fine-tuned instances is prohibitively expensive.

LoRA changes the approach. It freezes the original weights, so they never move. Beside each chosen layer it adds two small matrices, and only those are trained. The size of the middle, set by a number called the rank, decides how many numbers get trained.

In the paper's test on GPT-3 175B, compared with full fine-tuning using Adam, LoRA can reduce the trainable parameters by 10,000 times and the GPU memory requirement by 3 times. Quality was on par or better on its tests. The paper also says that, unlike adapter methods, LoRA adds no extra inference latency once merged.

In an interview, say the trade-off plainly. LoRA is cheap to train and easy to swap, but you still measure it on your own task. A bank's support assistant might keep one base model and one small adapter per product, and test each adapter before release. If a new adapter performs worse, the team swaps back to the last saved adapter file.

## What is LoRA, in plain words?

A language model is made of weights: numbers that hold what it learned. Fine-tuning adjusts those numbers so the model fits a job, such as answering bank customers in the right tone.

The problem is size. Full fine-tuning changes every weight, so each team that wants its own version needs its own full copy to train, store and serve. The 2021 LoRA paper says full fine-tuning becomes less feasible as models grow. LoRA is one of the most popular parameter-efficient fine-tuning (PEFT) methods, and PEFT methods train only a small number of extra parameters.

Think of a hospital triage nurse who already knows her job. Give her a short protocol card for one ward, and swap the card when the ward changes. LoRA's card is a small add-on, called an adapter, that sits beside a frozen model. A bank does the same with one base model: a small adapter teaches it the house wording and tone for one product, while fee amounts come from a lookup.

- **Weights:** The numbers inside a model that hold what it learned.
- **Fine-tuning:** Further training on your own examples, to fit a job.
- **Frozen:** Locked, so training never changes those numbers.
- **Adapter:** The small trained add-on that LoRA keeps per team.
- **Rank:** The size of the small middle, which sets how many numbers train.

## How does LoRA work inside a layer?

Each layer of the model multiplies its input by a big grid of weights. LoRA leaves that grid frozen and adds a side path next to it. The side path squeezes the input into a few numbers, then expands it back to full size. The two outputs are added, so the layer acts like the original plus a small learned change.

*Diagram, How LoRA adds a small trained path to a frozen layer: The frozen weights and the trained pair read the same layer input. The pair's output is added to the original output. Only the pair is trained, and the original weights never change.*
1. The layer input goes into the frozen original weights.
2. The same input also goes into the small adapter.
3. Matrix A squeezes it down, then matrix B expands it back.
4. The original weights give their normal answer.
5. The adapter's change joins that answer.
6. The sum moves on to the next layer.

The rank is the width of that squeeze. A rank of 8 keeps 8 numbers in the middle. A lower rank means fewer trainable numbers, and a higher rank gives the adapter more room to learn, at the cost of more numbers. Q286 goes deeper on rank.

## What does LoRA save, and what does it cost?

> "We propose Low-Rank Adaptation, or LoRA, which freezes the pre-trained model weights and injects trainable rank decomposition matrices into each layer of the Transformer architecture, greatly reducing the number of trainable parameters for downstream tasks." (The 2021 LoRA paper)
>
> "The original weight matrix remains frozen and doesn't receive any further updates." (Hugging Face's PEFT docs)

- **Saves: Trained numbers and memory.** Far fewer numbers to train and store. Each team keeps only its small adapter file.
- **Limit: Still needs testing.** Results depend on the task and the rank. Measure the adapter on your own cases before release.
- **Serving: No extra delay.** No extra delay once merged into the base weights, according to the paper and Hugging Face's docs.

In the paper's own test on GPT-3 175B, compared with full fine-tuning using Adam, LoRA can reduce the trainable parameters by 10,000 times and the GPU memory requirement by 3 times. The paper also reports VRAM use during training falling from 1.2TB to 350GB on that model. The numbers below use made-up sizes. The ratio is what matters.

```python
# A bank runs one base model for 12 product teams. Each team wants its own adapter.
# Made-up sizes: 32 layers, each a 4,096 by 4,096 grid of weights, rank 8.
LAYERS = 32
WIDTH = 4096
RANK = 8
TEAMS = 12

full_copy = LAYERS * WIDTH * WIDTH       # one full fine-tune for one team
adapter = LAYERS * 2 * WIDTH * RANK      # the two small matrices, one set per team

print(f"Full copies for {TEAMS} teams: {TEAMS * full_copy:,} weights")
print(f"Adapters for {TEAMS} teams: {TEAMS * adapter:,} weights")
print(f"One adapter is {adapter / full_copy:.2%} of a full copy")
```

Output:

```text
Full copies for 12 teams: 6,442,450,944 weights
Adapters for 12 teams: 25,165,824 weights
One adapter is 0.39% of a full copy
```

Each team's adapter is under half a percent (0.39%) of a full copy here, so twelve teams cost far less than twelve full models.

> **Tip:** Asked about cost? Say where the saving comes from: only the small matrices are trained and stored per team, and the frozen base is shared.

### How would you choose LoRA for a bank's support bot?

A bank wants its assistant to use its own fee wording and tone for twelve products. The base model already knows general language, so the team only needs to teach it the house wording and tone for each product.

- **Without LoRA: Twelve full copies.** Each product gets a full fine-tuned model to train, store and serve. Every update is costly.
- **With LoRA: One base, twelve adapters.** Train a small adapter per product on its own examples, and swap it in when the wording changes.

The catch is serving. Merged into the base, an adapter adds no delay, but each product's model becomes a full-size copy again. Kept separate, adapters stay small and swappable, and the paper says that route suits cases where latency is not critical.

Then say what LoRA does not settle. It changes how the model behaves on your data. It does not make the model's facts reliable, so fee amounts still come from a lookup the code checks.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: LoRA freezes the original weights and trains a small add-on.
- [ ] Why it helps: full fine-tuning changes every weight, so each team needs a full copy.
- [ ] Rank: the size of the small middle, the setting that controls how many numbers train.
- [ ] The paper's numbers, dated 2021 and tied to its test setup.
- [ ] Trade-offs: cheap and easy to swap, but still measured on your own task.
- [ ] How one base model can carry many small adapters.

**Common traps**

- Trap: "LoRA shrinks the model." Better: The base model keeps its full size. Only the small add-on is trained and stored.
- Trap: "LoRA is always as good as full fine-tuning." Better: The paper reports on par or better results on its tests. Your task can differ, so measure it.
- Trap: "Once the adapter is trained, the model knows the facts." Better: An adapter shapes behaviour. Facts that change still need retrieval or a lookup the code checks.

## Can you spot the mistake?

**Spot the mistake:** A team's LoRA plan for a claims-triage model. Which step breaks the idea?

A. Keep a held-out set of claims that training never saw, and measure on it.
B. Unfreeze the base model so the adapter can also change its original weights.
C. Save each team's adapter as its own file, so it can be swapped or rolled back.
D. Test the adapter on live claims in a shadow run before it makes real decisions.

**Answer:** B. LoRA's point is that the original weights stay frozen. Unfreezing them brings back the training and storage costs LoRA avoids. The other three are sound practice.

**Quick check:** One base model must serve 12 teams, each with its own tone and house wording. Which setup fits best?

A. Twelve fully fine-tuned copies of the model
B. One frozen base with twelve small LoRA adapters
C. One shared prompt for all teams, with no training
D. Retrain the base model from scratch each quarter

**Answer:** B. Each team gets a small adapter, and the base is shared and frozen. Full copies cost the most. A shared prompt trains nothing, so it does not learn each team's habits.

## Can you answer these from memory?

**Flash cards**

- **What is LoRA?** Low-Rank Adaptation: freeze the original weights, train a small add-on per layer.
- **What stays frozen in LoRA?** The original model weights. Training never changes them.
- **What is the rank?** The size of the small middle, which sets how many numbers get trained.
- **Full copy or LoRA for 12 teams?** LoRA: one shared base, small adapters. Full copies repeat all the training.
- **What did the 2021 paper report?** On GPT-3 175B: it can cut trainable parameters 10,000 times and GPU memory 3 times.
- **Does LoRA add inference latency?** Not once merged into the base weights, according to the paper.

## Likely follow-up questions

- Q283 What is PEFT? https://designervenkat.online/interview/ai/what-is-peft
- 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
- Q287 What is SFT / instruction tuning? https://designervenkat.online/interview/ai/what-is-supervised-fine-tuning
- Q281 Fine-tune vs RAG vs prompting: when to use which? https://designervenkat.online/interview/ai/fine-tuning-vs-rag-vs-prompting
- Q303 How do you serve many LoRA adapters? (full answer coming)
