Prefix Tuning and Prompt Tuning

Prefix tuning and prompt tuning are both soft-prompt methods. The shared idea: we are not editing the main model weights; we are learning a prompt representation. They differ mainly in how that learned context is attached and used.

Intuition

Both methods add virtual tokens (learned embeddings). Think of them as a small learned “header” that conditions the model for a task.

Method Plain-English idea Often useful for
Prefix tuning Attach learnable prefix context (often influencing attention keys/values as extra context) Generation tasks; compact adaptation
Prompt tuning Learn only the prompt embeddings; keep the whole model frozen Simple PEFT baseline

How it works

Prefix tuning

Prompt tuning

Where each one lands in the model:

flowchart TB subgraph PT[Prompt tuning] P1[Learned vectors at the input only] --> P2[Layer 1] --> P3[Layer 2 ... Layer N] end subgraph PX[Prefix tuning] X1[Layer 1 + its own prefix] --> X2[Layer 2 + its own prefix] --> X3[Layer N + its own prefix] end

Prefix tuning therefore trains more parameters than prompt tuning — a prefix for every layer instead of one set at the front — but both remain far smaller than an adapter or a full fine-tune.

The cost of longer prompts

If you keep adding soft tokens:

Practical habits:

What goes wrong

One-line summary

Prefix tuning and prompt tuning learn virtual prompt context instead of updating the backbone — prefix tuning leans on learned prefix context; prompt tuning learns prompt embeddings with a frozen model.

Key terms