Contrastive Learning for Prompt-based Few-shot Language Learners

Yiren Jian, Soroush Vosoughi

Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies · 2022 · 30 citations · 13 references

DOIFull text

Open access

Concepts

TL;DR

The impressive performance of GPT‑3 with natural language prompts and in‑context learning has spurred research into better fine‑tuning of moderately sized models under this paradigm. We present a contrastive learning framework that clusters same‑class inputs to improve the generality of models trained with only limited examples. The framework applies supervised contrastive learning by clustering same‑class inputs across augmented views created via varied prompts and demonstrations, while repelling different‑class samples, and it requires minimal task or model assumptions. Adding contrastive loss to the standard masked language modeling loss improves performance over state‑of‑the‑art on 15 diverse language tasks in prompt‑based few‑shot learning.

Abstract

The 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.

References

13