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

Making Pre-trained Language Models Better Few-shot Learners

Automatic prompts let small language models learn from few examples

  • Problem Standard fine-tuning of masked language models fails with only a few labelled examples per class, because it adds a new classification head to learn. Hand-written prompts avoid this but take domain knowledge and trial and error to design.
  • Method LM-BFF fine-tunes the model with prompts instead of a new head. It searches label words and generates templates with T5, then adds sampled demonstrations to each input.
  • Results On SST-2 with 16 examples per class, it reached 93.0 (0.6) against 81.4 (3.8) for standard fine-tuning.

Why few-shot fine-tuning is hard for masked language models

GPT-3 makes accurate predictions from a natural-language prompt and a few demonstrations without updating its weights, but its 175B parameters make it hard to run in most settings. This study works with models of the BERT and RoBERTa kind, which can be fine-tuned on typical research hardware, and asks how far a small number of labelled examples can carry them.

The training set holds K examples per class, and the main experiments set K = 16 with RoBERTa-large.

Standard fine-tuning puts a randomly initialised classification head on the [CLS] representation. On RoBERTa-large a simple binary task adds 2,048 new parameters, which is a lot to learn from around 32 examples. Prompt-based prediction avoids the new head by recasting the task as masked-word prediction, where the model fills a label word into a template.

Good templates take domain knowledge and trial and error, and the authors expect manually written prompts to be suboptimal even when much effort goes into them.

Prompt-based fine-tuning as masked-word prediction

An input is wrapped by a template T into a sequence that contains one [MASK] token. A mapping M assigns each class y to a label word in the vocabulary, so a class is scored by the pre-softmax vector of its label word at the mask position. The probability of class y is a softmax over the label-word scores at the mask hidden state: \[ p(y \mid x_{in}) = \frac{\exp(w_{M(y)} \cdot h_{[MASK]})}{\sum_{y' \in Y} \exp(w_{M(y')} \cdot h_{[MASK]})} \] Fine-tuning then minimises the cross-entropy loss on the few labelled examples.

The scores reuse the pretrained output vectors, so the approach adds no new parameters. The authors argue that this also narrows the gap between the pre-training objective and fine-tuning, which they expect to help in the few-shot setting. Regression uses the same output machinery. The label range is treated as an interval between two poles, with a prediction written as a mixture of the two poles: \[ y = v_l \, p(y_l \mid x_{in}) + v_u \, p(y_u \mid x_{in}) \] Training pushes the predicted weight p(y_u | x_in) toward the normalised target (y - v_l)/(v_u - v_l), using a KL divergence.

How much the prompt changes accuracy

A pilot on SST-2 and SNLI varies label words and templates with a fixed backbone and few-shot data. With the template fixed on SST-2, great/terrible reached 92.7 (0.9) and terrible/great reached 83.2 (6.9), so label words that match the intended classes do best. The template matters as well: on SNLI, moving [MASK] to the end of the input, or swapping the two sentences, produced a drop of more than 10%.

Searching by hand is difficult, because the space is large and a few examples are easy to overfit.

Searching label words and generating templates

For each class, the label-word search keeps the top k vocabulary words ranked by summed log-probability at the mask over that class's training examples: \[ \text{Top-}k_{v \in V} \Big( \sum_{x_{in} \in D^{c}_{train}} \log P_L([MASK] = v \mid T(x_{in})) \Big) \] Among the pruned assignments, the top n that maximise zero-shot accuracy on Dtrain are fine-tuned, and the best one is picked by re-ranking on Ddev.

The authors note this is simpler than the verbalizer search in earlier PET work, which does not re-rank.

Template generation uses T5, which is pretrained to fill missing spans. Each training example is converted into a T5 input that places a T5 placeholder and the label word around the sentence, so T5 writes the template between those placeholders. Decoding seeks the template that maximises the summed log-likelihood over all converted training examples: \[ \sum_{(x_{in},y) \in D_{train}} \log P_{T5}(T \mid T_g(x_{in}, y)) \] Beam search with a wide beam, for example 100, produces many candidates.

Each candidate is fine-tuned on Dtrain and evaluated on Ddev, and either the single best template or the top templates are kept as an ensemble. Training many candidates is fast here because Dtrain is small, and the procedure needs no manual tuning for each dataset.

Demonstrations as selected context

Here, at each training step one example is sampled per class, converted into a filled template with the mask replaced by its label word, and concatenated after the input: \[ T(x_{in}) \oplus \tilde{T}(x^{(1)}_{in}, y^{(1)}) \oplus \cdots \oplus \tilde{T}(x^{(|Y|)}_{in}, y^{(|Y|)}) \] Training and inference both draw several demonstration sets per input, and predictions are ensembled over the sets.

Random demonstrations may be unlike the query, and then the model can ignore them. The similarity variant embeds the raw input sentences with a pretrained SBERT model, without templates. For each query and each class, training instances of that class are ranked by cosine similarity to the query, and only the top r = 50% are sampled as demonstrations.

Main results with a single prompt

Experiments cover 8 single-sentence and 7 sentence-pair tasks, with RoBERTa-large and K = 16 for the few-shot rows. On SST-2, standard fine-tuning reached 81.4 (3.8), while prompt-based fine-tuning with a manual prompt reached 92.7 (0.9). On SNLI the same two methods reached 48.4 (4.8) and 77.2 (3.7). CoLA is an exception: prompt-based fine-tuning with a manual prompt reached 9.3 (7.3) and standard fine-tuning 33.9 (14.3).

The authors suggest the inputs of this task are out of the distribution the model was trained on. On STS-B, the only regression task, prompt-based fine-tuning with the manual prompt reached 71.0 (7.0) Pearson, against 53.5 (8.5) for standard fine-tuning.

Adding demonstrations helped on most tasks. On MNLI with manual prompts the score rose from 68.3 to 70.7, while on SST-2 with manual prompts it stayed close, at 92.6 (0.5). Combining automatic templates with demonstrations reached 93.0 (0.6) on SST-2 and 77.5 (3.5) on SNLI. The authors report gains of up to 30% absolute and 11% on average across tasks compared with standard fine-tuning.

For in-context learning with RoBERTa-large, the baseline is not a parameter-updating method. On SST-2 it scored 84.8 (1.3) against 83.6 for prompt-based zero-shot prediction, and it did not always beat zero-shot prediction. The authors attribute this to smaller models not being expressive enough to use in-context examples the way GPT-3 does.

Automatic prompts against manual ones

Some generated pieces look odd: one SNLI template includes the fragment "no" in a biased way, and one generated label word for entailment on SNLI is Hi.

Ensembles and similarity-based demonstrations

Automatic search can produce as many templates as needed, so individual models can be trained and ensembled. Table 4 compares this with PET's manual prompts on MNLI and RTE. The single manual prompt reached 68.3 (2.3) on MNLI, while PET's four-prompt ensemble reached 71.9 (1.5). An ensemble of 20 automatic templates with demonstrations reached 75.4 (1.6) on MNLI.

The authors note that an ensemble of the same number of automatic templates is comparable to or better than PET's manual ensemble, and that PET's distillation with unlabelled data lies outside their scope.

Table 7 compares uniform sampling of demonstrations with selective sampling by RoBERTa-large or SBERT on four tasks. SBERT-based selection reached 92.6 on SST-2, 79.7 on SNLI, 87.5 on TREC and 77.8 on MRPC, above uniform sampling on all four. RoBERTa-based selection beat uniform sampling on SST-2, SNLI and MRPC but scored 83.4 on TREC against 85.6 for uniform sampling.

Because SBERT was trained on SNLI and MNLI, the authors also tried mean-pooled RoBERTa-large representations, and selective sampling beat uniform sampling in either case.

Accuracy as K grows

The sweep covers K from 16 up to 256 examples per class. On SST-2, LM-BFF with 32 total examples is close to saturated and comparable to standard fine-tuning on the full dataset. On SNLI, LM-BFF keeps improving as K grows and keeps a gap over standard fine-tuning until the two converge around K = 256. For lower K, the authors say the method consistently outperforms standard fine-tuning.

Limitations

Results still lag fine-tuning with thousands of examples, especially on harder tasks, and they show high variance across splits as standard fine-tuning does. The authors also find it hard to widen the search space or to generalise the search from about 32 examples.

The method still relies on manual design, either manual templates for the label-word search or manual label words for the template search. The approach suits tasks that can be posed as fill-in-the-blank problems with short inputs and few output classes, and the authors suggest longer-context models may help with input length. Structured prediction is harder to pose this way.

Model development used mainly SST-2 and SNLI, so those two tasks informed design choices.

Paper info

Authors
Tianyu Gao, Adam Fisch, Danqi Chen
Venue
arXiv · Preprint
First published
2020-12-31
Added
2026-11-12
Updated
2021-6-2
Version
v2
arXiv
2012.15723
Category
cs.CL · cs.LG
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

Tianyu Gao, Adam Fisch, Danqi Chen (2020). Making Pre-trained Language Models Better Few-shot Learners. arXiv:2012.15723v2. https://arxiv.org/abs/2012.15723v2

BibTeX
@misc{gao2020making,
  title = {{Making Pre-trained Language Models Better Few-shot Learners}},
  author = {Tianyu Gao and Adam Fisch and Danqi Chen},
  year = {2020},
  eprint = {2012.15723},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2012.15723v2}
}

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