Improving Few-Shot Performance of Language Models via Nearest Neighbor Calibration

12/05/2022
by   Feng Nie, et al.
0

Pre-trained language models (PLMs) have exhibited remarkable few-shot learning capabilities when provided a few examples in a natural language prompt as demonstrations of test instances, i.e., in-context learning. However, the performance of in-context learning is susceptible to the choice of prompt format, training examples and the ordering of the training examples. In this paper, we propose a novel nearest-neighbor calibration framework for in-context learning to ease this issue. It is inspired by a phenomenon that the in-context learning paradigm produces incorrect labels when inferring training instances, which provides a useful supervised signal to calibrate predictions. Thus, our method directly augments the predictions with a k-nearest-neighbor (kNN) classifier over a datastore of cached few-shot instance representations obtained by PLMs and their corresponding labels. Then adaptive neighbor selection and feature regularization modules are introduced to make full use of a few support instances to reduce the kNN retrieval noise. Experiments on various few-shot text classification tasks demonstrate that our method significantly improves in-context learning, while even achieving comparable performance with state-of-the-art tuning-based approaches in some sentiment analysis tasks.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/12/2019

SimpleShot: Revisiting Nearest-Neighbor Classification for Few-Shot Learning

Few-shot learners aim to recognize new object classes based on a small n...
research
10/18/2020

Explaining and Improving Model Behavior with k Nearest Neighbor Representations

Interpretability techniques in NLP have mainly focused on understanding ...
research
03/24/2023

kNN Prompting: Beyond-Context Learning with Calibration-Free Nearest Neighbor Inference

In-Context Learning (ICL), which formulates target tasks as prompt compl...
research
12/19/2017

Learning with Imprinted Weights

Human vision is able to immediately recognize novel visual categories af...
research
02/19/2021

Calibrate Before Use: Improving Few-Shot Performance of Language Models

GPT-3 can perform numerous tasks when provided a natural language prompt...
research
02/17/2023

Like a Good Nearest Neighbor: Practical Content Moderation with Sentence Transformers

Modern text classification systems have impressive capabilities but are ...
research
07/28/2023

Investigating the Learning Behaviour of In-context Learning: A Comparison with Supervised Learning

Large language models (LLMs) have shown remarkable capacity for in-conte...

Please sign up or login with your details

Forgot password? Click here to reset