Skip to main content
QUICK REVIEW

[论文解读] A Simple Zero-shot Prompt Weighting Technique to Improve Prompt Ensembling in Text-Image Models

James Urquhart Allingham, Jie Ren|arXiv (Cornell University)|Feb 13, 2023
Generative Adversarial Networks and Image Synthesis被引用 9
一句话总结

本文提出零样本提示集合(ZPE):在没有带标签数据的情况下自动对大量提示进行评分,对分数进行归一化以减少预训练/测试偏差,应用 softmax 加权或提示选择,并在 ImageNet、其变体及细粒度数据集上展示相对于手工设计提示的零样本准确度提升。

ABSTRACT

Contrastively trained text-image models have the remarkable ability to perform zero-shot classification, that is, classifying previously unseen images into categories that the model has never been explicitly trained to identify. However, these zero-shot classifiers need prompt engineering to achieve high accuracy. Prompt engineering typically requires hand-crafting a set of prompts for individual downstream tasks. In this work, we aim to automate this prompt engineering and improve zero-shot accuracy through prompt ensembling. In particular, we ask "Given a large pool of prompts, can we automatically score the prompts and ensemble those that are most suitable for a particular downstream dataset, without needing access to labeled validation data?". We demonstrate that this is possible. In doing so, we identify several pathologies in a naive prompt scoring method where the score can be easily overconfident due to biases in pre-training and test data, and we propose a novel prompt scoring method that corrects for the biases. Using our proposed scoring method to create a weighted average prompt ensemble, our method outperforms equal average ensemble, as well as hand-crafted prompts, on ImageNet, 4 of its variants, and 11 fine-grained classification benchmarks, all while being fully automatic, optimization-free, and not requiring access to labeled validation data.

研究动机与目标

  • 在没有带标签验证数据的情况下,通过对给定下游任务的大量提示进行评分,自动化零样本分类器的提示工程。
  • 开发一种偏差校正的提示评分方法,避免被预训练和测试数据频率驱动的过于自信的提示。
  • 证明使用这些分数的加权或选定提示集合在多样数据集上优于等权集合和手工设计提示的零样本分类准确性。

提出的方法

  • 使用大量提示并在无标签数据访问的情况下为每个提示计算一个零样本分数 s_p。
  • 识别由于词频偏差导致的朴素最大对数评分中的病态现象,并提出使用预训练和测试分布的期望对数来归一化。
  • 通过 logits_normalized = logits - (E_pretrain + E_test)/2 归一化对数,以减少偏差。
  • 通过对归一化对数在图像上的每个类别取最大值后取平均,来计算提示分数 s_p。
  • 对提示分数应用 softmax 加权,形成对数概率的加权集成(方程式 3/5),以减轻长尾效应。
  • 可选地通过异常值检测(中位数和 MAD)并使用阈值 tau 仅选择前提示(方程式 4)。

实验结果

研究问题

  • RQ1零样本模型是否可以从大量提示中自动选择并加权,以在没有带标签验证数据的情况下最大化下游零样本准确性?
  • RQ2如何校正提示评分以减轻预训练的词频偏差和测试数据概念频率偏差?
  • RQ3加权或选定的提示集合是否在多样数据集上优于等权集合和手工设计的提示?
  • RQ4归一化和加权方案对零样本提示集成的有效性有何影响?
  • RQ5提示集合的规模与组成如何影响在 ImageNet 及细粒度数据集上的零样本性能?

主要发现

  • 加权的 ZPE 集成在 ImageNet、ImageNet 变体及若干细粒度基准上优于等平均集成和手工设计的提示。
  • 使用 E_pretrain 和 E_test 的归一化降低词频偏差和虚假概念频率偏差,在各任务中提升零样本准确性。
  • 对提示分数的 softmax 加权通常比原始分数加权或普通最大对数方法表现更好。
  • 提示选择(基于异常值的 tau 阈值)可以带来改进,尤其是在细粒度数据集上,领域特定提示更有价值。
  • 在 CLIP ViT-B/16 和 LiT ViT-L/16 下,基于 ZPE 的加权平均取得比手工提示和朴素方法更高的平均准确率,在若干数据集上有显著提升。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。