Contrastive Learning for Prompt-based Few-shot Language Learners
21005Authors
nan
Abstract
AbstractThe impressive performance of GPT-3 using natural language prompts and in-context learning has inspired work on better fine-tuning of moderately-sized models under this paradigm. Following this line of work, we present a contrastive learning framework that clusters inputs from the same class for better generality of models trained with only limited examples. Specifically, we propose a supervised contrastive framework that clusters inputs from the same class under different augmented “views” and repel the ones from different classes. We create different “views” of an example by appending it with different language prompts and contextual demonstrations. Combining a contrastive loss with the standard masked language modeling (MLM) loss in prompt-based few-shot learners, the experimental results show that our method can improve over the state-of-the-art methods in a diverse set of 15 language tasks. Our framework makes minimal assumptions on the task or the base model, and can be applied to many recent methods with little modification.
Keywords
Full Content
Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5577 - 5587 July 10-15, 2022 ©2022 Association for Computational Linguistics Contrastive Learning for Prompt-Based Few-Shot Language Learners Yiren Jian Dartmouth College yiren.jian.gr@dartmouth.edu Chongyang Gao Northwestern University cygao@u.northwestern.edu Soroush Vosoughi Dartmouth College soroush@dartmouth.edu Abstract The impressive performance of GPT-3 using natural language prompts and in-context learn- ing has inspired work on better fine-tuning of moderately-sized models under this paradigm. Following this line of work, we present a con- trastive learning framework that clusters in- puts from the same class for better general- ity of models trained with only limited ex- amples. Specifically, we propose a super- vised contrastive framework that clusters in- puts from the same class under different aug- mented "views" and repel the ones from dif- ferent classes. We create different "views" of an example by appending it with different language prompts and contextual demonstra- tions. Combining a contrastive loss with the standard masked language modeling (MLM) loss in prompt-based few-shot learners, the experimental results show that our method can improve over the state-of-the-art methods in a diverse set of 15 language tasks. Our framework makes minimal assumptions on the task or the base model, and can be applied to many recent methods with little modifica- tion. The code will be made available at: https://github.com/yiren-jian/LM-SupCon. 1 Introduction The prompt-based fine-tuning method reduces the gap between pre-training and fine-tuning by form- ing the fine-tuning task into a masking language problem. A language prompt is a piece of text appended to the query input enabling the model to come up with better predictions (Schick and Schütze, 2021; Tam et al., 2021). For instance, by feeding a language model with "The story is not worth reading, a truly one.", the model assigns a higher probability for the blank to be filled with "terrible" than "great". Here, "a truly one." is called the template of the prompt and "terrible" or "great" is the label word. Recently, LM-BFF (Gao et al., 2021) shows that appending demonstrations (e.g."This is an amazing movie, a truly great one") to inputs can help the model to better understand the label word, leading to further improved results. In this work, we show that Supervised Con- trastive Learning (SupCon) (Khosla et al., 2020) at the feature space can be beneficial during the fine- tuning of prompt-based few-shot language learners, with proper data augmentation. Data augmentation is the key component of SupCon. While there exists many augmentation techniques like Cutmix (Yun et al., 2019), Mixup (Zhang et al., 2018) in computer vision and EDA (Wei and Zou, 2019), AEDA (Karimi et al., 2021) for text, data augmentation remains challenging. However, prompt-based few-shot learners with demonstrations actually provide us with a natural way to create multiple "views" (augmentations) of a single example, i.e., for a fixed set of label words, we can sample different templates and different demonstrations to append to the input text (shown in Figure 1). This allows us …
Content truncated to 500 words
Labeled Text
AbstractThe impressive performance of GPT-3 using natural language prompts and in-context learning has inspired work on better fine-tuning of moderately-sized models under this paradigm. Following this line of work, we present a contrastive learning framework that clusters inputs from the same class for better generality of models trained with only limited examples. Specifically, we propose a supervised contrastive framework that clusters inputs from the same class under different augmented “views” and repel the ones from different classes. We create different “views” of an example by appending it with different language prompts and contextual demonstrations. Combining a contrastive loss with the standard masked language modeling (MLM) loss in prompt-based few-shot learners, the experimental results show that our method can improve over the state-of-the-art methods in a diverse set of 15 language tasks. Our framework makes minimal assumptions on the task or the base model, and can be applied to many recent methods with little modification.
Publication Details
- Paper ID:
- 21005
- Year:
- 2022
- Publication:
- TIPSTER
- Publication Type:
- conf
- DOI:
- nan