Generative Calibration for In-context Learning

📄 arXiv: 2310.10266v1 📥 PDF

作者: Zhongtao Jiang, Yuanzhe Zhang, Cao Liu, Jun Zhao, Kang Liu

分类: cs.CL

发布日期: 2023-10-16

备注: Findings of EMNLP2023


💡 一句话要点

提出生成校准方法以解决上下文学习中的标签偏移问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 上下文学习 生成校准 标签偏移 文本分类 大型语言模型

📋 核心要点

  1. 现有的上下文学习方法对提示的选择和顺序非常敏感,导致性能不稳定。
  2. 本文提出的生成校准方法通过调整标签边际来解决上下文模型的标签偏移问题。
  3. 在12个文本分类任务中,所提方法在宏观F1分数上相较于现有方法提升了最多27%。

📝 摘要(中文)

在大型语言模型(LLMs)中,上下文学习是一项引人注目的特性,但其性能对提示配置高度敏感。本文首次理论和实证地识别出这一悖论主要源于上下文模型与数据分布之间的标签偏移。我们提出了一种生成校准方法,通过调整标签边际来校准上下文预测分布。实验结果表明,该方法在12个文本分类任务中显著优于现有的上下文学习和最先进的校准方法,宏观F1分数提升幅度可达27%。

🔬 方法详解

问题定义:本文旨在解决大型语言模型在上下文学习中由于标签偏移导致的性能不稳定问题。现有方法在不同提示配置下表现不佳,无法有效应对标签边际的变化。

核心思路:论文的核心思路是通过生成校准来调整上下文预测分布中的标签边际。具体而言,利用蒙特卡洛采样技术估计标签边际,从而实现对模型输出的校准。

技术框架:整体方法包括数据采集、标签边际估计和模型校准三个主要模块。首先,通过生成模型生成样本,然后进行标签边际的估计,最后将其应用于上下文学习的预测分布中。

关键创新:最重要的创新点在于首次将生成校准应用于上下文学习,解决了标签偏移问题,并且在多个任务上展示了显著的性能提升。与现有方法相比,该方法在稳定性和准确性上均有显著改善。

关键设计:在参数设置上,采用了多种生成模型进行标签边际的估计,损失函数设计上关注于优化标签边际的准确性,确保生成的样本能够有效反映真实数据分布。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,所提出的生成校准方法在12个文本分类任务中表现优异,相较于传统上下文学习方法和最先进的校准方法,宏观F1分数提升幅度可达27%。该方法在不同提示配置下也表现出良好的稳定性,证明了其有效性。

🎯 应用场景

该研究的潜在应用领域包括文本分类、情感分析和其他自然语言处理任务。通过提高上下文学习的稳定性和准确性,生成校准方法能够帮助开发更高效的智能助手和自动化系统,具有重要的实际价值和广泛的应用前景。

📄 摘要(原文)

As one of the most exciting features of large language models (LLMs), in-context learning is a mixed blessing. While it allows users to fast-prototype a task solver with only a few training examples, the performance is generally sensitive to various configurations of the prompt such as the choice or order of the training examples. In this paper, we for the first time theoretically and empirically identify that such a paradox is mainly due to the label shift of the in-context model to the data distribution, in which LLMs shift the label marginal $p(y)$ while having a good label conditional $p(x|y)$. With this understanding, we can simply calibrate the in-context predictive distribution by adjusting the label marginal, which is estimated via Monte-Carlo sampling over the in-context model, i.e., generation of LLMs. We call our approach as generative calibration. We conduct exhaustive experiments with 12 text classification tasks and 12 LLMs scaling from 774M to 33B, generally find that the proposed method greatly and consistently outperforms the ICL as well as state-of-the-art calibration methods, by up to 27% absolute in macro-F1. Meanwhile, the proposed method is also stable under different prompt configurations.