Contrastive Learning for Prompt-Based Few-Shot Language Learners

Yiren Jian, Chongyang Gao, Soroush Vosoughi
5/3/2022
cs.CLcs.AI
contrastive-ssl

Official code: yiren-jian/LM-SupCon (22 stars, Python, MIT, last commit 2023-01-26).

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.

Show full abstract

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. The code will be made available at: https://github.com/yiren-jian/LM-SupCon.

View on arXivView PDF

Code Implementations(1)

MIT

[NAACL 2022] Contrastive Learning for Prompt-based Few-shot Language Learners

221Python, Shell3 years agoMIT
contrastive-learningfew-shot-learninglanguage-model

Similar Papers

Cite this paper

@article{jian2022contrastive,
  title  = {Contrastive Learning for Prompt-Based Few-Shot Language Learners},
  author = {Yiren Jian and Chongyang Gao and Soroush Vosoughi},
  year   = {2022},
  eprint = {2205.01308},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2205.01308}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2205.01308.svg)](https://codeofpaper.com/paper/2205.01308)

Discussion