Prefix Tuning
Fine-tuning a large model leaves you owning a full copy of its weights for every task. Prefix tuning asks a cheaper question: can a frozen model be steered from outside, by prepending something to the sequence that is learned rather than written?
Learned vectors, not wordsA small set of continuous vectors — ten to a hundred positions — is prepended to the keys and values at every attention layer, and only those vectors are trained. The model's own parameters never move. Because they live in the model's internal space rather than its vocabulary, they can express steering that no sequence of words could, and gradient descent finds them. Training touches well under 1% of the parameters, so a task ships as a few megabytes and is swapped in at serving time. Acting at every layer is what separates it from prompt tuning, which learns vectors only at the input embeddings and needs a very large model before it works at all.
Where it fits- It arrived for generation tasks such as summarisation and table-to-text, matching full fine-tuning while training around 0.1% of the weights, and beating it when training data was scarce.
- It costs context: the prefix occupies positions in the context window and space in the KV cache on every single request.
- LoRA has since taken most of this ground, being easier to tune and mergeable back into the weights, so prefix tuning now appears mainly as one option among several in libraries like Hugging Face PEFT.
Prefix tuning adapts a frozen language model by learning a short sequence of continuous vectors that are prepended to the keys and values at every attention layer. Only those vectors are trained — well under 1% of the parameters — so each task ships as a few megabytes instead of a full model copy. It makes per-task adaptation cheap to store and swap, at the cost of occupying context positions on every request.
Think of a very capable assistant you are not allowed to retrain, but who will read a note you slip in before every task. Prefix tuning learns that note — except the note is not written in words. It is a small set of numbers, discovered by trial and correction, that sits at the front of whatever the model is given and steers it towards one particular job, like summarising legal documents. The big model itself is left completely untouched. One shared model can then serve many specialised jobs, each needing only its own tiny note instead of a whole private copy.