esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Letโ€™s talk

Iโ€™ll build the agent for it.

Prompt and Prefix Tuning vs LoRA

How prompt tuning, prefix tuning and LoRA differ in where they add trained parts, what each one costs, and how to choose, explained for your AI interview.

In short

Prompt and prefix tuning train a few extra vectors and feed them to a frozen model. LoRA trains small matrices that change its weights, and they can be merged in afterwards. Prompt tuning changes the model only at its input.

11 min readAdvancedOccasional ยท estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Prompt tuning and prefix tuning train a few vectors and feed them to a frozen model. LoRA trains small matrices that sit beside chosen weights. Prompt tuning changes the model only at its input. In the worked example it trains the fewest numbers, but the count depends on the settings. A merged LoRA adds no serving delay, yet with many teams I'd keep the matrices separate and test both on our own data.

What is prompt or prefix tuning, in plain words?

Fine-tuning changes every weight in a model, so each team that needs its own version ends up with a full copy. Methods that train only a small add-on keep the big model frozen, so its original weights stay as they were.

Three common ones are prompt tuning, prefix tuning and LoRA. Each one is small and sits on top of the same base model. LoRA's trained part is a pair of small grids of numbers, and their product is added to a big weight grid. The rank is the width of their small shared middle, so a lower rank means fewer numbers.

Think of a new hire reading the company handbook. Prompt tuning is a card slipped in front of the handbook. LoRA is a set of sticky notes stuck on the pages that change, and the handbook itself is never rewritten. In an AI team, those trained parts might teach a claims-triage assistant how an insurer writes to its customers.

Key words

Frozen model
A base model whose original weights are locked, so training never changes them.
Virtual token
A trained vector placed where a word would go. No person can read it as text.
Attention
The part of a model that decides which earlier words to focus on when it writes the next word.
Prefix
Trained vectors that the model's attention reads in every layer, as if they came before the text.
Backpropagation
The method that adjusts trained numbers step by step by working backwards from the error.

How do the three methods differ?

All three keep the base model frozen. They differ in where the trained part goes into the model.

  • Prompt tuning

    Trained vectors at the input

    Trained vectors enter only at the input. The first layer takes them in, and deeper layers work on what it makes from them. In the worked example below, it trains the fewest numbers.

  • Prefix tuning

    Trained vectors in every layer

    The prefix reaches deeper into the model. It has more trained numbers than prompt tuning, and can exceed LoRA depending on the settings.

  • LoRA

    Small matrices beside the weights

    Two small grids of numbers are multiplied into a change, which is added to the weights inside each chosen layer. Once trained, it can be merged into the frozen weights.

Where each method adds its trained part

Prompt and prefix tuning

Virtual tokens, input only

a learned stand-in for words

Prefix vectors, all layers

read like extra words in each layer

LoRA

Two small matrices

a small add-on for chosen weights

Frozen base model

Each team plugs in its own small file.

  1. 1Prompt tuning adds trained vectors at the input only, so they enter at the first layer.
  2. 2Prefix tuning adds trained vectors that every layer reads.
  3. 3LoRA adds small trained matrices next to chosen frozen weights.
All three methods keep the base model frozen and save only a small trained part. The difference is where that part plugs in: at the input, in every layer, or next to each weight. Each team keeps one small file that works with the same model.

The authors say it in their own words, and each card below matches its page word for word.

  • โ€œsoft prompts are learned through backpropagation and can be tuned to incorporate signal from any number of labeled examplesโ€

    Lester, Al-Rfou and Constant, 2021

  • โ€œkeeps language model parameters frozen, but optimizes a small continuous task-specific vector (called the prefix)โ€

    Li and Liang, 2021 (prefix tuning)

  • โ€œOur simple linear design allows us to merge the trainable matrices with the frozen weights when deployedโ€

    Hu et al., 2021 (LoRA)

  • โ€œwe show that prompt tuning becomes more competitive with scaleโ€

    Lester, Al-Rfou and Constant, 2021, on scale

The scale finding matters. Lester and colleagues found the gap to full tuning closes only as models get large, so on smaller models prompt tuning trails full tuning. Prefix tuning was reported to do better when data is scarce: it outperforms fine-tuning in low-data settings. Hu and colleagues also observed that prefix tuning is difficult to train, and its performance does not always rise as parameters grow.

The Hugging Face PEFT docs describe the placement in the same way. Prefix parameters go into all of the model layers, while in prompt tuning only the input of the first layer receives the virtual tokens.

What does each one cost in trained numbers?

Count the trained numbers before you pick a method. This example is made up: an insurer runs one base model for 40 product teams, with 32 layers, weight grids 4,096 wide, 20 virtual tokens and LoRA rank 8. It counts the trained numbers for one team.

Python
# An insurer runs one base model for 40 product teams. Made-up sizes:
# 32 layers, weight grids 4,096 wide, 20 virtual tokens, LoRA rank 8.
LAYERS = 32
WIDTH = 4096
TOKENS = 20
RANK = 8

prompt = TOKENS * WIDTH                  # vectors at the input only
prefix = LAYERS * 2 * TOKENS * WIDTH     # keys and values, in every layer
lora = LAYERS * 2 * (2 * WIDTH * RANK)   # two weights per layer, each with two small matrices

print(f"Prompt tuning: {prompt:,} trained numbers")
print(f"Prefix tuning: {prefix:,} trained numbers")
print(f"LoRA, rank {RANK}: {lora:,} trained numbers")

Output

Prompt tuning: 81,920 trained numbers
Prefix tuning: 5,242,880 trained numbers
LoRA, rank 8: 4,194,304 trained numbers

In this example, prompt tuning trains by far the fewest numbers. Prefix tuning trains more than LoRA here, because it writes vectors into every layer, while LoRA touches two weights in each layer. The count depends on your settings, so compare the numbers before the names.

Virtual tokens also take up room. They count toward the input length, and Hu and colleagues note that reserving that room leaves less for the task itself.

Tip

If asked to estimate cost, say what grows with what: the prefix grows with layers, prefix length and width, and LoRA grows with layers, rank and width.

How would you choose for a real team?

  1. 1

    Start with the limit

    A full copy per product is too costly for 40 teams, so a small add-on is needed. All three methods here are small.

  2. 2

    Check the quality gap

    LoRA changes the weights inside each chosen layer. Hu and colleagues report it is on-par or better than fine-tuning in model quality. Prompt tuning changes only the input, and Lester and colleagues found it trails full tuning on smaller models.

  3. 3

    Plan the serving

    A merged LoRA has no extra latency compared with a fully fine-tuned model (Hu and colleagues), but merging also makes it hard to group requests for different tasks into one run, so with many teams keep the matrices separate. Prompt and prefix tokens add extra tokens that every request must process.

  4. 4

    Test on your own data

    Run each candidate on the team's own test set of real examples it already trusts. The winner is the one that passes that test.

For the insurer, I'd start with LoRA for real changes in behaviour, and test prompt tuning for light style changes.

What does the interviewer want to hear?

A strong answer covers

  • Where each method adds its trained part: the input, every layer, or next to each weight.
  • The trade-off: prompt tuning changes only the input, while LoRA changes weights inside each chosen layer.
  • All three keep the base model frozen, so one model serves many teams.
  • The cost depends on settings, so count the trained numbers before choosing.
  • Honest limits: prompt tuning only catches up with full tuning on large models.
  • A test on the team's own data decides the choice.

Common traps

  • Trap"Prefix tuning is always the lighter option."

    BetterNot always. It can train more numbers than LoRA, depending on prefix length and LoRA's rank.

  • Trap"LoRA rewrites the whole model."

    BetterIt trains small matrices and keeps the original weights frozen, then adds their product to them.

  • Trap"Prompt tuning is just a fancy prompt."

    BetterIt trains vectors that no person can read as words. The training is done by backpropagation.

Can you spot the right statement?

Spot the true statement

The insurer's platform team wants one base model for 40 teams. Which statement is true?

Quick check

For the insurer's claim-letter assistant, which method adds small trained matrices to the weights and can be merged in after training?

Can you answer these from memory?

Flash cards ยท tap a card to flip it

1 / 6

What will they ask next?

  1. Q283What is PEFT?11 min
  2. Q284What is LoRA?10 min
  3. Q286What does LoRA rank mean?10 min
  4. Q303How do you serve many LoRA adapters?11 min
  5. Q282What is full fine-tuning?10 min
  6. Q281Fine-tune vs RAG vs prompting: when to use which?10 min

Last updated on 27 November 2026

Choosing how to adapt a model for your team?

I design and build AI products and agents, including the system behind them. Book a short call and tell me what your team needs the model to learn.