arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2212.02216cs.CL
收藏

通过最近邻校正提高语言模型的Few-Shot性能

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

Tencent Inc(腾讯公司);University of Cambridge(剑桥大学);Tencent AI Lab(腾讯人工智能实验室)

Feng Nie, Meixi Chen, Zhirui Zhang, Xu Cheng

摘要:

当在自然语言提示中提供一些示例作为测试实例的演示时,预训练的语言模型(PLM)表现出显著的少样本学习能力,即,上下文学习。然而,上下文学习的性能容易受到提示格式、训练样本和训练样本顺序的选择的影响。在本文中,我们提出了一种新的最近邻校准框架的上下文学习,以缓解这个问题。它的灵感来自于一个现象,即上下文学习范式在推断训练实例时产生不正确的标签,这提供了一个有用的监督信号来校准预测。因此,我们的方法直接增加了预测与$k$ -最近邻($k$ NN)分类器在缓存的Few-Shot实例表示PLM和它们相应的标签。然后引入自适应邻域选择和特征正则化模块,充分利用少量的支持实例来降低$k$神经网络检索噪声。各种Few-Shot文本分类任务的实验表明,我们的方法显着提高了上下文学习,同时甚至在一些情感分析任务中实现了与最先进的基于调优的方法相当的性能。

英文摘要:

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 ($k$NN) 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 $k$NN 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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑