Pattern-exploiting training (PET) is a semi-supervised few-shot learning method that reformulates a classification task as a cloze-style question and fine-tunes a pretrained masked language model to fill in a word that stands for each label. In the training of models for artificial intelligence, it showed that small models with good task descriptions can rival much larger models prompted with a few examples.
PET combines three ingredients: hand-written patterns that turn an input into a fill-in-the-blank sentence, verbalizers that map each label to a vocabulary word, and knowledge distillation over unlabeled data. The method and its iterative variant iPET were introduced in 2020 and became an influential precursor of prompt-based fine-tuning.
How patterns and verbalizers reframe a task
PET rests on the pattern-verbalizer pair (PVP). A pattern is a function that wraps the input in natural language containing exactly one mask token, and a verbalizer assigns each class a single word that the model can predict at that position. Classification then becomes comparing the model’s scores for the verbalizer words.
For sentiment analysis of a review, a pattern might produce the text “Great food, slow service. All in all, it was [MASK].” with a verbalizer that maps positive to “good” and negative to “bad”. Because pretraining already taught the model what fits such blanks, it starts with useful prior knowledge instead of a randomly initialized output layer.
The table below shows how different task types are typically turned into PVPs.
| Task | Example pattern | Example verbalizer |
|---|---|---|
| Sentiment classification | Review text. It was [MASK]. | positive: good, negative: bad |
| Topic classification | [MASK] News: headline text | sports: Sports, business: Business |
| Natural language inference | Premise? [MASK], hypothesis | entailment: Yes, contradiction: No |
| Question answering, yes or no | Passage. Question? [MASK]. | true: Yes, false: No |
The three stages of pattern-exploiting training
Pattern-exploiting training proceeds in three consecutive stages that move from a tiny labeled set to a conventional classifier. The design uses unlabeled data to compensate for weak individual patterns.
| Stage | Input | Output |
|---|---|---|
| 1. PVP fine-tuning | Few labeled examples, several PVPs | One fine-tuned model per PVP |
| 2. Soft labeling | Unlabeled examples, ensemble of models | Probability distribution per example |
| 3. Distillation | Soft-labeled data | Standard sequence classifier |
In the first stage, each model is trained with a cross-entropy loss over the verbalizer words, usually combined with an auxiliary masked language modeling loss that keeps the model from drifting away from its pretrained behavior. In the second stage, the ensemble’s predictions are combined, often weighted by each model’s accuracy on the training set before fine-tuning.
In the third stage, a regular classifier is trained on the soft labels with a distillation loss. This final model needs no pattern at inference, runs at the cost of a single network and typically outperforms most individual PVP models.
iPET and the role of unlabeled data
iPET is the iterative extension of pattern-exploiting training. Instead of labeling all unlabeled data once, it trains several generations of PVP models, and in each generation every model receives a training set enlarged with examples labeled by the other models of the previous generation.
The added examples are chosen to keep the label distribution balanced and are selected from the most confident predictions. Over generations, the models teach each other, which is particularly helpful when the initial labeled set contains only 10 to 100 examples and individual patterns disagree.
Both variants depend on a pool of unlabeled in-domain text. Without it, the method reduces to fine-tuning an ensemble of prompt-based models, which still helps but loses much of the benefit of self-training and distillation.
PET compared with related approaches
PET occupies a position between in-context learning and standard supervised fine-tuning. It updates all model weights like fine-tuning but borrows the natural language task description that in-context prompting relies on.
| Method | Weights updated | Labels needed | Main idea |
|---|---|---|---|
| Pattern-exploiting training | All weights | Few plus unlabeled data | Cloze patterns, ensemble, distillation |
| In-context learning | None | Few, in the prompt | Examples placed in the context window |
| Standard fine-tuning | All weights | Hundreds to thousands | New classification head |
| Prompt tuning | Soft prompt only | Few to many | Learned continuous prompt vectors |
| Pseudo-labeling | All weights | Few plus unlabeled data | Self-training without patterns |
The best-known result is that PET applied to ALBERT with about 223 million parameters and only 32 labeled examples per task surpassed GPT-3 few-shot prompting on the SuperGLUE benchmark, despite the latter having roughly 175 billion parameters. The comparison was not perfectly symmetric, since PET also used unlabeled data and gradient updates, but it changed how researchers viewed few-shot learning.
Limitations and practical considerations
Pattern-exploiting training is sensitive to the wording of patterns and verbalizers; two reasonable patterns can differ by several accuracy points, which is why PET relies on ensembles. Practical limitations include the following.
- Manual pattern design requires task insight and some trial and error.
- Standard verbalizers need single-token label words; multi-token labels need special decoding.
- Training one model per pattern multiplies compute in the first stage.
- The method assumes a masked language model, so it does not transfer directly to decoder-only models.
- Results depend on unlabeled data from the same domain as the target task.
Later work automated parts of the process, for example by searching for patterns and label words automatically or replacing discrete patterns with learned continuous prompts. Instruction-tuned large language models have since reduced the need for PET in many settings, but the method remains attractive when compute and labels are both scarce.
A plain-language summary
A language model has read huge amounts of text. It is very good at filling in a missing word. Pattern-exploiting training turns a new task into a fill-in-the-blank question. To judge a review, it asks the model to finish the sentence “It was ___” with “good” or “bad”.
This lets the model learn from only a handful of examples. Several versions of the question are tried. Their combined answers then label more data. A final, simpler model learns from all of it.
An example from practice
A customer support team wants to route incoming tickets into five categories, such as billing, delivery and technical problems. They have about 50 tickets labeled by hand and roughly 20,000 unlabeled tickets from the past year. Standard fine-tuning of a mid-sized masked language model on 50 examples gives unstable results.
An engineer writes three patterns, for example “Ticket text. This message is about [MASK].”, and maps the categories to single words such as “payment” and “shipping”. She fine-tunes one model per pattern, uses the ensemble to soft-label the unlabeled tickets and then trains a compact classifier on them.
On a held-out set of 300 tickets, the distilled classifier clearly outperforms the plain fine-tuned baseline and varies far less between random seeds. Because the final model needs no pattern at inference, it runs as fast as an ordinary classifier in the routing system.