arXiv(opens in a new tab)Computer ScienceJan 2020Cited by 4 papers on PaperVantage

Manuscript Offprint

arXiv:2001.07676

Exploiting Cloze-Questions for Few-Shot Text Classification and Natural Language Inference

Timo Schick, Hinrich Schütze

Abstract

Some NLP tasks can be solved in a fully unsupervised fashion by providing a pretrained language model with “task descriptions” in natural language (Radford et al., 2019, e.g.,). While this approach underperforms its supervised counterpart, we show in this work that the two ideas can be combined: We introduce Pattern-Exploiting Training (Pet), a semi-supervised training procedure that reformulates input examples as cloze-style phrases to help language models understand a given task. These phrases are then used to assign soft labels to a large set of unlabeled examples. Finally, standard supervised training is performed on the resulting training set. For several tasks and languages, Pet outperforms supervised training and strong semi-supervised approaches in low-resource settings by a large margin.

1 Introduction

Learning from examples is the predominant approach for many NLP tasks: A model is trained on a set of labeled examples from which it then generalizes to unseen data. Due to the vast number of languages, domains and tasks and the cost of annotating data, it is common in real-world uses of NLP to have only a small number of labeled examples, making few-shot learning a highly important research area. Unfortunately, applying standard supervised learning to small training sets often performs poorly; many problems are difficult to grasp from just looking at a few examples. For instance, assume we are given the following pieces of text:

  • T1T_{1}: This was the best pizza I’ve ever had.
  • T2T_{2}: You can get better sushi for half the price.
  • T3T_{3}: Pizza was average. Not worth the price.

Furthermore, imagine we are told that the labels of T1T_{1} and T2T_{2} are ll and l′l^{\prime}, respectively, and we are asked to infer the correct label for T3T_{3}. Based only on these examples, this is impossible because plausible justifications can be found for both ll and l′l^{\prime}. However, if we know that the underlying task is to identify whether the text says anything about prices, we can easily assign l′l^{\prime} to T3T_{3}. This illustrates that solving a task from only a few examples becomes much easier when we also have a task description, i.e., a textual explanation that helps us understand what the task is about.

Best pizza ever!+1)\,{\in}\,\mathcal{T}$$(Best pizza ever!It was ____ .PLM great : 0.8 bad : 0.2 +1 : 0.8 -1 : 0.2 LCEL_{\text{CE}}(1) (2)Just gross.p∈ D{\in}\,\mathcal{D}Just gross.p +1 : 0.1 -1 : 0.9 C(3)

Figure 1: Pet for sentiment classification. (1) A number of patterns encoding some form of task description are created to convert training examples to cloze questions; for each pattern, a pretrained language model is finetuned. (2) The ensemble of trained models annotates unlabeled data. (3) A classifier is trained on the resulting soft-labeled dataset.

With the rise of pretrained language models (PLMs) such as GPT (Radford et al., 2018), BERT (Devlin et al., 2019) and RoBERTa (Liu et al., 2019), the idea of providing task descriptions has become feasible for neural architectures: We can simply append such descriptions in natural language to an input and let the PLM predict continuations that solve the task (Radford et al., 2019; Puri and Catanzaro, 2019). So far, this idea has mostly been considered in zero-shot scenarios where no training data is available at all.

In this work, we show that providing task descriptions can successfully be combined with standard supervised learning in few-shot settings: We introduce Pattern-Exploiting Training (Pet), a semi-supervised training procedure that uses natural language patterns to reformulate input examples into cloze-style phrases. As illustrated in Figure 1, Pet works in three steps: First, for each pattern a separate PLM is finetuned on a small training set T\mathcal{T}. The ensemble of all models is then used to annotate a large unlabeled dataset D\mathcal{D} with soft labels. Finally, a standard classifier is trained on the soft-labeled dataset. We also devise iPet, an iterative variant of Pet in which this process is repeated with increasing training set sizes.

On a diverse set of tasks in multiple languages, we show that given a small to medium number of labeled examples, Pet and iPet substantially outperform unsupervised approaches, supervised training and strong semi-supervised baselines.