Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Prefix-Tuning: Optimizing Continuous Prompts for Generation

  • Problem Fine-tuning changes every weight of a large pretrained language model, so each downstream task needs its own stored copy of the model.
  • Method Prefix-tuning freezes the Transformer and trains only a continuous prefix that later positions attend to as virtual tokens.

Why a full model copy per task is costly

Fine-tuning adapts a pretrained language model by updating all of its parameters, so every downstream task leaves behind a modified copy of the whole model. The cost grows with model size: the paper cites 774M parameters for GPT-2 and 175B parameters for GPT-3. Lightweight fine-tuning keeps most pretrained weights frozen and adds small trainable modules, and adapter-tuning does this by inserting task-specific layers between the layers of the pretrained model.

Adapter-tuning reaches performance comparable to fine-tuning while adding roughly 2-4% task-specific parameters.

Prompting offers another route that changes nothing in the weights: GPT-3 receives an instruction and a few examples in its input, a setup known as in-context learning. That route is bounded by context length, because a Transformer conditions only on a limited window, 2048 tokens for GPT-3, so training sets larger than the window cannot be fully used.

The open question is whether a frozen model can be steered by a learned input that is much smaller than a model copy and is not limited to real words.

A prefix that later positions attend to as virtual tokens

The method prepends a sequence of continuous, task-specific vectors to the input, and the authors call this sequence the prefix. Positions after the prefix attend to it as if it were a set of virtual tokens, but its entries are free parameters that need not match the embedding of any real word. Only the prefix is trained while the Transformer weights stay fixed, so one stored model can serve many tasks by swapping prefixes.

Figure 2 shows the layout for an autoregressive LM and for an encoder-decoder model.

For an autoregressive LM the input and output are concatenated as z = [PREFIX; x; y], and for an encoder-decoder model prefixes are placed on the encoder side and on the decoder side. Ordinary positions follow the usual recurrence, in which the activation at position i depends on the input token z_i and the activations to its left. \[ h_i = \mathrm{LM}_{\varphi}(z_i, h_{<i}) \] Prefix positions follow a different rule: their activation is copied from the trainable matrix P_θ, and all other positions still run through the frozen LM.

\[ h_i = \begin{cases} P_{\theta}[i,:] & \text{if } i \in P_{idx}, \\ \mathrm{LM}_{\varphi}(z_i, h_{<i}) & \text{otherwise} \end{cases} \]

The reasoning starts from prompting: a suitable context can steer a frozen LM toward a target word or behaviour without changing its parameters. Searching over discrete instructions is computationally hard, so the method optimizes continuous word embeddings instead, and their effects propagate upward through all Transformer layers and to later tokens.

The authors argue that intervening on all layers is more expressive than tuning only the embeddings, and the method therefore optimizes the prefix at every layer.

How the prefix is trained and reparametrized

Training uses the same log-likelihood objective as fine-tuning, summed over the output positions in Y_idx for y given x. The language model parameters φ are held fixed, and only the prefix parameters θ are updated by gradients. Because the prefix stays in the left context of every later position, the states to its right depend on θ as well.

Optimizing P_θ directly was found to be unstable and to lower performance slightly. In preliminary experiments the authors also found direct optimization very sensitive to the learning rate and the initialization. They therefore write each row of P_θ as an MLP applied to a smaller matrix P'_θ that has the same number of rows.

The width of the smaller matrix is k, set to 512 for table-to-text and 800 for summarization, and the MLP maps k to the hidden dimension of the model. After training, the reparametrization is dropped and only P_θ is saved.

Datasets, baselines and training setup

The table-to-text benchmarks are E2E, with about 50K examples, 8 distinct fields and an average output length of 22.9, WebNLG, with 22K examples, and DART, with 82K examples and an average output length of 21.6. E2E covers a single domain of restaurant reviews, WebNLG covers 14 domains, and DART is open-domain and built from Wikipedia tables.

WebNLG training and validation use 9 DBpedia categories, while the test split adds 5 unseen categories used to measure extrapolation.

E2E is scored with BLEU, NIST, METEOR, ROUGE-L and CIDEr, WebNLG with BLEU, METEOR and TER, and DART with BLEU, METEOR, TER, MoverScore, BERTScore and BLEURT. The summarization task uses XSUM, which has 225K examples of news articles averaging 431 words, with summaries averaging 23.3 words, and it is reported with ROUGE-1, ROUGE-2 and ROUGE-L.

For table-to-text the prefix is compared with fine-tuning, fine-tuning of only the top two layers (FT-TOP2) and adapter-tuning, and the summarization comparison is against fine-tuning BART. The state-of-the-art rows come from prior published systems, Shen et al. (2019) for E2E and Kale (2020) for WebNLG, and no official model is available for DART.

The authors use GPT-2 MEDIUM and GPT-2 LARGE for table-to-text, with the linearized tables as inputs, and BART LARGE for summarization, with articles truncated to 512 BPE tokens.

Training uses AdamW with a linear learning rate schedule, following the Hugging Face default setup, and the hyperparameters that were tuned include epochs, batch size, learning rate and prefix length. Prefix-tuning takes about 0.2 hours per epoch on 22K examples, against about 0.3 hours for fine-tuning, and summarization takes 1.25 hours per epoch on XSUM.

Table-to-text results

With 0.1% task-specific parameters, the prefix outperforms the lightweight baselines ADAPTER (0.1%) and FT-TOP2 and reaches performance comparable to fine-tuning on E2E, WebNLG and DART. The prefix and the adapter were given the same 0.1% budget, and on average the prefix scores 4.1 BLEU higher per dataset than ADAPTER (0.1%). The per-task cost is 250K parameters for E2E, 250K for WebNLG and 500K for DART, against 345M GPT-2 parameters.

Storing one shared Transformer plus a prefix means the stored prefix is 1000x smaller than a fine-tuned copy.

Table 1 reports these E2E scores alongside WebNLG and DART results, with the best score per model in bold.

The authors describe prefix-tuning as more Pareto efficient than adapter-tuning, since it uses far fewer parameters while improving generation quality. Going from GPT-2 MEDIUM to GPT-2 LARGE keeps the advantage, which the authors read as a sign the approach may scale to larger models with a similar architecture, such as GPT-3, a possibility they did not test.

Summarization results

The gap is larger than on the table-to-text datasets, and the authors name three differences: XSUM has about 4x more examples, its input articles are about 17x longer than linearized tables, and summarization needs reading comprehension and the identification of key content. The authors also note that fine-tuning GPT-2 underperformed fine-tuning BART in a preliminary experiment, so GPT-2 was left out of the summarization comparison.

Low-data results

For each size five datasets were sampled and two training random seeds were averaged, so each low-data estimate averages 10 models. A development split of 30% of the training size was used to choose hyperparameters and for early stopping.

Both methods tend to undergenerate in low-data regimes, leaving out table content, but the prefix output is more faithful. For example, fine-tuning trained on 100 examples falsely describes the customer rating as low, while the true rating is average, and the prefix trained on 100 and 200 examples describes it faithfully.

Extrapolation to unseen topics

For WebNLG, the models train on the 9 seen categories and are tested on the 5 unseen ones.

For XSUM the authors built two splits: news-to-sports trains on news articles and tests on sports articles, and within-news trains on the world, UK and business categories and tests on the remaining news categories. On within-news the prefix reached 39.41, 16.87 and 31.47, against 39.20, 16.35 and 31.15 for fine-tuning. The authors report that the prefix extrapolates better than fine-tuning under all metrics on both table-to-text and summarization.

Adapter-tuning also extrapolates well and is comparable with the prefix, which the authors take as evidence that keeping the LM parameters intact helps on unseen topics. The authors leave the reason for these gains open.

Prefix length and infix placement

Longer prefixes lower the training loss but give slightly worse test results, which the authors read as overfitting. Longer prefixes add little inference cost, which the authors attribute to attention over the prefix being parallelized on GPUs.

Infix-tuning places the trainable activations between x and y instead of at the start of the sequence. The authors explain the gap by noting that a prefix can affect the activations of both x and y, whereas an infix can only influence the activations of y.

Embedding-only tuning and initialization

The embedding-only ablation makes the word embeddings the free parameters while the upper layers are computed by the Transformer. The authors order the methods by expressive power: discrete prompting is less expressive than embedding-only tuning, which is less expressive than prefix-tuning.

Random initialization of the prefix gives low performance with high variance in low-data settings. The authors connect this choice to keeping the pretrained LM as close to its original state as possible.

Personalization and batching

The authors suggest personalization as a setting where each user is an independent task with a separate prefix, so data stays separated and users can be added or deleted without cross-contamination. Since the shared LM is unchanged, requests from different users can be batched together by prepending each user's prefix to the input, whereas the authors say adapter-tuning cannot batch across users.

The authors argue that preserving the pretrained parameters may help generalization to domains unseen in training, and they link this to the extrapolation results. They cite concurrent work that uses intrinsic dimension to explain why updating a small number of parameters can be enough, and they say their results show that a very small prefix can attain good generation performance.

Limitations

The experiments use GPT-2 MEDIUM and GPT-2 LARGE for table-to-text and BART LARGE for summarization. In the preliminary experiments GPT-2 and BART failed to follow natural language instructions in this setting, and GPT-3 was the only model that did, so the method was not tested with GPT-3.

The mechanism behind the extrapolation gains is an open question, and the authors do not explain it.

Long prefixes overfit, and direct optimization of the prefix is sensitive to learning rate and initialization. Timings for the two tasks come from different GPUs, so the training times for table-to-text and summarization are not directly comparable.

Paper info

Authors
Xiang Lisa Li, Percy Liang
Venue
arXiv · Preprint
First published
2021-1-1
Added
2026-10-20
Updated
2021-1-1
Version
v1
arXiv
2101.00190
Category
cs.CL
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Xiang Lisa Li, Percy Liang (2021). Prefix-Tuning: Optimizing Continuous Prompts for Generation. arXiv:2101.00190v1. https://arxiv.org/abs/2101.00190v1

BibTeX
@misc{li2021prefix,
  title = {{Prefix-Tuning: Optimizing Continuous Prompts for Generation}},
  author = {Xiang Lisa Li and Percy Liang},
  year = {2021},
  eprint = {2101.00190},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2101.00190v1}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up