Prompt Tuning is a parameter-efficient fine-tuning (PEFT) technique that adapts a pre-trained language model to a specific task by learning a small set of soft prompt parameters while keeping the model's original parameters frozen.

Unlike prompt engineering, which manually designs text prompts, prompt tuning learns continuous prompt embeddings during training. This allows a single pre-trained model to be adapted to different tasks by using different learned prompts.
Working
Prompt tuning adds a small sequence of learnable vectors, called soft prompts, to the model's input. The pretrained model remains frozen and only these vectors are updated during training.

- Start with a Pre-trained Model: A pre-trained language model such as T5 is used. Its original parameters are kept frozen.
- Initialize Soft Prompts: A small set of learnable vectors is added to the model's input. Unlike normal text prompts, these vectors do not have to correspond to actual words.
- Provide Task Data: Input-output examples for the target task are passed to the model along with the soft prompts.
- Train the Soft Prompts: The model generates an output and calculates the loss against the expected output. During backpropagation, only the soft prompt parameters are updated; the model's parameters remain unchanged.
- Use the Learned Prompt: After training, the learned soft prompt is combined with new inputs to guide the frozen model toward the target task.
For Example
For a sentiment classification task, the model can learn a set of soft prompt vectors that help it predict whether an input sentence is positive or negative. The learned vectors do not need to be human-readable instructions such as "Classify the sentiment".
Prompt Tuning vs. Fine-Tuning vs. Prompt Engineering
| Aspect | Prompt Tuning | Fine-Tuning | Prompt Engineering |
|---|---|---|---|
| Goal | Adapt a pre-trained model to a task by learning soft prompts. | Adapt a model by updating its parameters using task-specific training. | Guide the model using carefully designed input prompts. |
| Model Modification | Only a small set of soft prompt parameters is trained; the base model remains frozen. | Model parameters are updated during training. | No model parameters are changed. |
| Data Required | Typically requires task-specific training examples. | Typically requires task-specific training data. | No additional training data is required. |
| Use Case | Efficiently adapting one frozen model to different tasks. | Specializing a model for a task or domain. | Improving responses through better instructions or examples. |
| Training Cost | Lower than full fine-tuning. | Higher because many or all model parameters are trained. | No model training is required. |
When to Use Each
- Prompt Tuning: Use when you want to adapt a large pre-trained model to specific tasks while keeping most of its parameters frozen and reducing training and storage costs.
- Fine-Tuning: Use when deeper model adaptation is required and sufficient task-specific training data and computational resources are available.
- Prompt Engineering: Use when you only need to improve or control model outputs through better instructions, examples, context or formatting without training the model.
Applications
- Text Classification: Learning task-specific prompts for sentiment, topic or intent classification.
- Question Answering: Adapting a model to answer questions according to a particular task format.
- Text Summarization: Learning prompts that guide the model to generate summaries in a desired format.
- Machine Translation: Adapting a model to specific translation tasks or language pairs.
- Domain-Specific NLP: Adapting a general-purpose model to specialized tasks or domains while keeping the base model frozen.
Advantages
- Parameter Efficient: Only a small number of prompt parameters are trained instead of updating the entire model.
- Lower Storage Requirements: Different tasks can use separate small soft prompts while sharing the same frozen base model.
- Reduced Training Cost: Since the base model remains frozen, prompt tuning generally requires fewer trainable parameters and less memory than full fine-tuning.
- Scalable: Research has shown that prompt tuning becomes increasingly competitive with full model tuning as the size of the pre-trained model increases.
- Multiple Task Adaptations: The same frozen model can be adapted to different tasks by maintaining a separate learned prompt for each task.
Challenges
- Requires Training: Unlike prompt engineering, prompt tuning requires task-specific training and an optimization process to learn the soft prompts.
- Limited Interpretability: Soft prompts are continuous vectors, so it is difficult to understand what specific information they represent.
- Task and Model Dependence: Performance can vary depending on the underlying model, task and prompt configuration.
- Still Requires Computational Resources: Although it is more efficient than full fine-tuning, training still requires access to the pre-trained model and suitable computational resources.