【NLP】【Prompt Tuning】PET (Pattern-Exploiting Training)方法介绍

【NLP】【Prompt Tuning】PET (Pattern-Exploiting Training)方法介绍

本文介绍Prompt Tuning方向的PET方法,论文标题为:Exploiting Cloze Questions for Few Shot Text Classification and Natural Language Inference,来自EACL2021。

摘要

随着GPT3的出现,通过一些具有自然语言“任务描述”的预训练语言模型,可以以完全无监督的方式解决一些NLP任务。PET是一种半监督的训练方式,它首先将input examples转化为cloze-style phrases的形式以帮助模型理解给出的任务,之后利用这些phrases为一个更大的未标注的数据集分配soft labels,最后在该数据集上执行有监督训练。

介绍

PET是一种半监督式训练程序,将任务描述与标准的监督学习相结合它使用自然语言patterninput examples转化为cloze-style phrases。如下图所示,PET 分三步工作:

  1. 针对每种pattern,在一个小的训练集 T \mathcal{T} T上对一个单独的PLM进行微调。
  2. 使用所有PLM模型的集合为一个大的未标注数据集 D \mathcal{D} D 添加soft labels
  3. 在这个soft-labeled的数据集上训练标准分类器。

在这里插入图片描述

作者还设计了 iPET,这是 PET 的一个迭代的变体,随着训练集大小的增加,这一过程会不断重复。

在多种语言的各种任务中,给定少量到中等数量的标注样本,PET 和 iPET 的表现大大优于无监督方法、有监督训练和强半监督基线。

PET

  • M M M : masked LM
  • V V V : vocabulary
  • L \mathcal{L} L : a set of labels
  • x \mathbf{x} x : input as a sequence of phrases, x = ( s 1 , … , s k ) \mathbf{x}=\left(s_1, \ldots, s_k\right) x=(s1,,sk)
  • P P P : pattern,a function, x \mathbf{x} x为输入, P ( x ) ∈ V ∗ P(\mathbf{x}) \in V^* P(x)V为输出,是一个phrasesentence, 其中包含有一个mask token。
  • v v vverbalizer,an injective function, L → V \mathcal{L} \rightarrow V LV将每个标签映射到 M M M词汇表中的一个词。

( P , v ) (P, v) (P,v)称为pattern-verbalizer pair (PVP)。

PVP Training and Inference

Auxiliary Language Modeling

Combining PVPs

Iterative PET (iPET)

在这里插入图片描述
PET (1-3) 和 iPET (a-c) 的示意图。

  • (1) 初始训练集 T \mathcal{T} T用于微调 PLM 集合。
  • (a) 对于每个模型,其他模型的随机子集通过标记 D \mathcal{D} D 中的样本来生成新的训练集。
  • (b) 使用更大的特定于模型的数据集来训练一组新的 PET 模型。
  • (c) 前两个步骤重复 k k k 次,每次将生成的训练集的大小增加 d d d 倍。
  • (2) 最终的模型集用于创建soft-labeled数据集 T C \mathcal{T}_C TC
  • (3) 在此数据集上训练分类器 C C C

With minor adjustments, iPET can even be used in a zero-shot setting

实验

4 English datasets:

  • Yelp Reviews: the task is to estimate the rating that a customer gave to a restaurant on a 1- to 5-star scale based on their review’s text.
  • AG’s News: is a news classification dataset, where given a headline a and text body b, news have to be classified as belonging to one of the categories World (1), Sports (2), Business (3) or Science/Tech (4).
  • Yahoo Questions: Given a question a and an answer b, one of ten possible categories has to be assigned: “Society”, “Science”, “Health”, “Education”, “Computer”, “Sports”, “Business”, “Entertainment”, “Relationship” and “Politics”.
  • MNLI : consists of text pairs x = (a, b). The task is to find out whether a implies b (0), a and b contradict each other (1) or neither (2).

use RoBERTa large

other languages:

  • x-stance: a multilingual stance detection dataset with German, French and Italian examples. Each example x = (a, b) consists of a question a concerning some political issue and a comment b; the task is to identify whether the writer of b supports the subject of the question (0) or not (1).

use XLM-R

结论

向预训练语言模型提供任务描述可以与标准的监督训练相结合。PET 包括的pattern-verbalizer pair 帮助利用预训练语言模型中包含的知识来完成下游任务。利用PVP对模型进行微调,并使用它们来创建可以训练标准分类器的大型标注数据集。当初始训练数据有限时,PET 比标准监督训练和强大的半监督方法有很大提升。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值