Contrastive Learning for Prompt-based Few-shot Language Learners

Yiren Jian, Chongyang Gao, Soroush Vosoughi


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.
Anthology ID:
2022.naacl-main.408
Volume:
Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies
Month:
July
Year:
2022
Address:
Seattle, United States
Editors:
Marine Carpuat, Marie-Catherine de Marneffe, Ivan Vladimir Meza Ruiz
Venue:
NAACL
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
5577–5587
Language:
URL:
https://aclanthology.org/2022.naacl-main.408
DOI:
10.18653/v1/2022.naacl-main.408
Bibkey:
Cite (ACL):
Yiren Jian, Chongyang Gao, and Soroush Vosoughi. 2022. Contrastive Learning for Prompt-based Few-shot Language Learners. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5577–5587, Seattle, United States. Association for Computational Linguistics.
Cite (Informal):
Contrastive Learning for Prompt-based Few-shot Language Learners (Jian et al., NAACL 2022)
Copy Citation:
PDF:
https://aclanthology.org/2022.naacl-main.408.pdf
Video:
 https://aclanthology.org/2022.naacl-main.408.mp4
Code
 yiren-jian/lm-supcon