Back to paper library
arXiv 2021EMNLP 2021Model adaptationPaper notes

Soft Prompts

A soft reminder

Original paper

The Power of Scale for Parameter-Efficient Prompt Tuning

Paper authors

Brian Lester · Rami Al-Rfou · Noah Constant

Publication
EMNLP 2021Conference
First submitted to arXiv
arXiv:2104.08691
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@misc{modeltuningsoftprompts2021,
  title = {{The Power of Scale for Parameter-Efficient Prompt Tuning}},
  author = {Brian Lester and Rami Al-Rfou and Noah Constant},
  year = {2021},
  eprint = {2104.08691},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.08691}
}
On this page

We just finished reviewing Prefix-Tuning not long ago, and now let's take a look at another new method: Prompt Tuning.

Problem Definition

The authors begin the paper by revisiting the framework of T5 to help readers understand the challenges currently faced in fine-tuning models.

T5 treats all tasks as text generation problems. Whether it is translation, summarization, or classification, tasks can be represented as generating output text from input text.

Traditional classification models use the probability Pr(y∣X)\text{Pr}(y|X) to map an input XX to an output class yy. However, in the T5 framework, the focus is on a conditional generation problem, where the objective is to compute:

Prθ(Y∣X)\text{Pr}_\theta(Y | X)

where:

  • YY is text representing a class, such as "positive" or "negative," rather than categorical labels like 0, 1, or 2.
  • θ\theta are the parameters of the Transformer model.

This approach enables the model to generate richer textual outputs rather than just a single class label.

Prompting involves adding a piece of text before the input XX to guide the model in generating the correct output YY. Prompts provide the model with task context or instructions, helping it understand how to handle the input.

For example, in a sentiment analysis task, a prompt might look like this:

Code
"Please determine the sentiment of the following sentence:"

The user’s input sentence is appended to the prompt, forming the final input for the model:

Code
"Please determine the sentiment of the following sentence: I love this movie!"

Manual prompting takes experimentation, and discrete token choices cannot be updated directly by continuous gradient descent. Automatic search is still possible—AutoPrompt uses gradients to guide a discrete search.


To address this issue, previous research—Prefix-Tuning—proposed adding a special sequence of tokens called a Prefix to the model's input. This prefix influences the model at every layer, ensuring it is guided throughout the entire generation process.

But can we simplify this further? What if we only guide the model at the input layer?

Enter the paper: Prompt Tuning.

Solving the Problem

Prompt Tuning

The authors proposed the Prompt Tuning method, introducing trainable prompt embedding parameters θP\theta_P. These parameters are no longer constrained by the model's word embedding table and can be automatically learned from the training data.

The new conditional generation formula becomes:

Prθ;θP(Y∣[P;X])\text{Pr}_{\theta; \theta_P}(Y | [P; X])

where:

  • [P;X][P; X] represents the concatenation of the prompt PP and the input XX.
  • θ\theta are the frozen model parameters.
  • θP\theta_P are the trainable prompt parameters.

During training, only the prompt parameters θP\theta_P are updated using the backpropagation algorithm, while the main model parameters θ\theta remain unchanged.

The implementation can generally be divided into the following steps:

  1. Input Embedding: Embed the nn input tokens into a matrix Xe∈Rn×eX_e \in \mathbb{R}^{n \times e}, where ee is the embedding dimension.
  2. Prompt Embedding: Embed the prompt tokens into a matrix Pe∈Rp×eP_e \in \mathbb{R}^{p \times e}, where pp is the length of the prompt.
  3. Concatenation: Concatenate the prompt embeddings and input embeddings into: [Pe;Xe]∈R(p+n)×e[P_e; X_e] \in \mathbb{R}^{(p + n) \times e}
  4. Model Processing: Input the concatenated embeddings into the encoder-decoder architecture for computation.

For example, suppose we want the model to determine the sentiment of the sentence "I love this movie!" In traditional methods, the model input would look like this:

Code
"Please determine the sentiment of the following sentence: I love this movie!"

In contrast, using the Prompt Tuning method, the model input becomes:

Code
[Token1] [Token2] [Token3] [Token4] [Token5] I love this movie!

[Token1] and the other labels stand for trainable vectors. The implementation concatenates matrices at the embedding layer; it does not tokenize those literal strings.

Discussion

The authors conducted a series of ablation studies to explore key questions surrounding Prompt Tuning:

These ablations use five T5.1.1 sizes on SuperGLUE development sets. The default uses 100K steps of shared LM adaptation, 100 prompt vectors and class-label initialization, with separate prompt training per task. The plots show mean and standard deviation over three runs.

How long should the prompt be?

As shown in Figure (a), the authors experimented with different prompt lengths ({1, 5, 20, 100, 150}) across various model scales (Small, Base, Large, XL, XXL).

The results indicate:

  • For most models, increasing the prompt length beyond a single token leads to significant performance improvements.
  • For the T5-XXL model, even a single-token prompt achieves reasonable performance, suggesting that larger models are less reliant on extensive prompt signals.
  • Beyond 20 tokens, performance gains taper off; for some larger models, going beyond 100 tokens even causes a slight decline.

What is the impact of prompt initialization strategies?

In Figure (b), the authors compared three initialization strategies:

  1. Random Initialization: Prompt embeddings are initialized with values uniformly sampled from [−0.5,0.5][-0.5, 0.5].
  2. Vocabulary Embedding Initialization: Embeddings are initialized using T5's 5,000 most common SentencePiece tokens.
  3. Class Label Initialization: Downstream task labels are converted into embeddings. If a label consists of multiple tokens, the embeddings are averaged. For prompts longer than the number of classes, remaining tokens are filled with vocabulary embeddings.

The findings show:

  • Class Label Initialization generally performs best in the tested sizes, with particularly pronounced differences for smaller models.
  • For the T5-XXL model, performance is relatively insensitive to the initialization strategy, with stable results regardless of the method used.

How does the pretraining objective affect Prompt Tuning?

In Figure (c), the authors examined the impact of different pretraining objectives on Prompt Tuning:

  1. Span Corruption: T5's default span corruption objective during pretraining.
  2. Span Corruption + Sentinel: Adds sentinel tokens in the target output of downstream tasks to mimic the format used in pretraining.
  3. LM Adaptation: Train the T5 backbone for up to 100,000 additional steps to generate a natural-text continuation from a text prefix. This shared adaptation updates the backbone; only afterward is it frozen for task-specific prompt training.

The results show:

  • Models pretrained with Span Corruption are poorly suited for frozen-model Prompt Tuning because they expect input and output texts to include sentinel tokens. Even simulating the pretraining format with Span Corruption + Sentinel provides limited benefits.
  • LM Adaptation significantly improves performance across all model scales, highlighting its effectiveness in aligning the model's pretraining objective with downstream Prompt Tuning tasks.

The Impact of LM Adaptation Duration

As shown in Figure (d), the authors investigated the effect of LM adaptation duration on Prompt Tuning.

Longer LM adaptation generally helps within the tested range, which ends at 100,000 steps—about 10% of the original T5 pretraining step count. The shared backbone adaptation is performed once and reused across tasks.

T5-XXL performs well under various suboptimal configurations, demonstrating its robustness. However, under Span Corruption pretraining, performance is unstable, with smaller models sometimes outperforming Base, Large, and XL models. These issues are not caused by random noise, as consistent low variance was observed across three repeated experiments.

Compared to models trained with Span Corruption, LM-adapted models exhibit stable performance across all scales, significantly reducing the risk of performance instability.


Comparison with Other Methods

The figure compares Prompt Tuning with several related methods. Below are brief descriptions of each method and their corresponding references:


  • Prefix Tuning:

    • [21.01] Prefix-Tuning: Optimizing Continuous Prompts for Generation

      Prefix Tuning prepends learnable prefixes to every layer of the Transformer, effectively providing fixed activations for each layer. It is designed for GPT-2 and BART, while Prompt Tuning focuses on T5. For BART, Prefix Tuning requires prefixes for both the encoder and decoder, whereas Prompt Tuning only modifies the encoder.

      Prompt tuning learns a sequence of input vectors with pepe parameters. Prefix tuning directly supplies layerwise prefix activations. The former’s prompt representations can become contextualized by the input in higher layers; the latter’s prefix activations are fixed across examples, while ordinary text activations still depend on the input. Its reparameterization MLP is only needed during training, so Figure 4 counts more task-specific parameters for Prefix Tuning during training than at inference.


  • WARP:

    • [21.01] WARP: Word-level Adversarial ReProgramming

      WARP introduces prompt parameters at the input layer, utilizing [MASK] tokens and a learnable output layer to map masked portions to class predictions. However, this method only supports single-output tasks, limiting it to classification problems.

      Prompt Tuning does not require specialized input design or task-specific output layers, making it applicable to a broader range of tasks with performance closer to full model fine-tuning.


  • P-tuning:

    • [21.03] GPT Understands, Too

      The original P-tuning comparison places continuous prompts in human-designed patterns and jointly fine-tunes the backbone in the cited SuperGLUE setup. That is the experimental configuration, not a requirement for every P-tuning variant.

      Prompt Tuning updates only the prompt parameters, keeping the main language model frozen and avoiding the cost of full model fine-tuning.


  • Soft Words:


  • Adapters:

    • [19.02] Parameter-Efficient Transfer Learning for NLP

      Adapters insert small bottleneck layers between frozen model layers to reduce task-specific parameters. For BERT-Large, tuning adapter layers adds only 2–4% more parameters while achieving performance close to full model fine-tuning.

      While Adapters modify model behavior by rewriting intermediate activations, Prompt Tuning adjusts input representations, leaving internal computations unchanged.

What Exactly Do Prompts Capture?

As previously discussed, since Prompt Tuning operates in continuous space rather than a discrete vocabulary space, it is difficult to directly understand how prompts influence model behavior.

The authors find nearest neighbors of prompt vectors in the frozen vocabulary embedding space using cosine distance. This gives local lexical similarity clues, not a faithful decoding of the full prompt’s function as natural-language instructions.

The experimental results showed that the top five nearest-neighbor words for each prompt token often form "semantically cohesive groups." In contrast, when random vectors are used instead of trained prompt tokens, no such semantic grouping is observed.

These observations suggest that trained prompt vectors can acquire word-like local structure. Additionally, in long prompt sequences, the authors observed that multiple prompt tokens might share the same nearest-neighbor words.

However, this raises two potential issues:

  1. Possible excess capacity: Different positions may learn overlapping information.
  2. Possible weak sequential organization: Information may not localize to specific positions. This is an alternative interpretation.

Another important observation is that the nearest-neighbor words of prompt tokens can include the class labels of the downstream task. Labels often persist when prompts are initialized from them; they can also appear at several positions with random or vocabulary initialization. The authors take this as a clue that prompts may store expected output categories as reference points for generation, rather than a decoding of the whole prompt.

Conclusion

In the tested T5.1.1 SuperGLUE development-set results, Prompt Tuning becomes comparable to full model tuning as model scale grows, with the gap narrowing at 11B XXL. In the paper's zero-shot domain-transfer experiments, a prompt trained on source-domain labels often generalizes better to target domains without target-domain labels. This is consistent with the authors' idea that freezing general language parameters and learning only small prompts can reduce overfitting.

The authors suggest that future research could focus on separating "task-specific parameters" from "general language modeling parameters." This would better control model behavior and enhance interpretability.