Prefix Tuning

Category: Generative AI / LLM

A parameter-efficient fine-tuning method that prepends trainable continuous vectors (prefixes) to the input of each transformer layer, leaving model weights frozen.

Full Explanation

Prefix tuning adapts a frozen language model by learning a set of continuous task-specific vectors (prefixes) that are prepended to the key and value representations at each transformer layer. These learned prefixes act as virtual tokens that steer the model behavior toward the target task without modifying any of the original model parameters. Only the prefix parameters are trained, typically comprising less than 0.1% of the total model parameters. Prefix tuning was proposed for natural language generation tasks and works particularly well with encoder-decoder models. It offers advantages in multi-task settings, as different tasks can use different prefixes with the same frozen model. Compared to LoRA, prefix tuning uses fewer parameters but may slightly reduce the effective context length since the prefixes consume positions in the attention window. It is one of several PEFT methods alongside LoRA, prompt tuning, and adapter layers.

Related Terms

More in Generative AI / LLM

Explore More