Adversarial Knowledge Stimulated Contrastive Prompting for Few-shot Language Learners (2023)

Abstract: Prompt-based fine-tuning has boosted the performance of Pre-trained Language Models(PLMs) on few-shot Natural Language Understanding (NLU) tasks by employing task-specific prompts. Yet, PLMsare unfamiliar with prompt-style expressionsduring pre-training, which limits the few-shotlearning performance on downstream tasks. It would be desirable if the models can stimulate prompting knowledge while adaptation to specific NLU tasks. We present the Adversarial Knowledge Stimulated Contrastive Prompting (AKSCP) framework, leading to better few-shot NLU tasks for language models by implicitly stimulate knowledge from pretrained language model. In AKSCP, a novel paradigm Cloze-driven prompt is proposed for joint prompt tuning across word cloze task and prompt-based learning, forcing PLMs to stimulate prompting knowledge. We further design an Adversarial Contrastive learning method to improve the generalization ability of PLM for different downstream tasks. Experiments over a variety of NLU tasks show that AKSCP consistently outperforms state-of-the-arts for prompt-based fine-tuning.

## introduction in recent years, pretrained language models (plms) have improved performance on various natural language understanding (nlu) tasks such as general language understanding evaluation (glue) @xcite @xcite @xcite . however, during fine-tuning, plms would perform poorly with few training samples due to model over-fitting @xcite . to alleviate the above dilemma for low-resource scenarios, natural language prompts have been applied to enable few-shot or zero-shot learning with plms @xcite @xcite @xcite . to make prompts more flexible and taskadaptive, prompt tuning freezes the plm backbone and only adjusts the representations of prompts @xcite . this type of method is especially suitable for ultra-large plms that are difficult to tune. in addition, prompt-based fine-tuning has been proposed, transforming text classification tasks into cloze-style problems @xcite . to specify, taskspecific discrete templates with masked language tokens are added to input texts. the result tokens of the masked positions predicted by the masked language modeling (mlm) head are used for class label prediction. therefore, the pre-trained knowledge acquired by plms can be better utilized by "re-using" the mlm training objective. however, prompt construction is usually handcrafted or searched by gradient descent, which may lack coverage and bring considerable bias and high variances to the results @xcite . a recent work @xcite attempts to tackle the above challenge using external training knowledge data. yet, these external knowledge data could be expensive to obtain and not transferable. it would be better if plms can stimulate more internal knowledge while they are adapted to downstream tasks without any external knowledge data. a major limitation of task-based prompts is that they are too coarse-grained and fail to capture the fine-grained information in the input data. existing methods use the same prompt for all input data within a tuning task. however, the input data also contains context-specific information that can help the plm retrieve more relevant knowledge, such as the particular entity being discussed. such knowledge embedded in the input data should be fully exploited to unleash the potential of prompts. the key challenge is that there is a mismatch between prompt and pre-training, because the template used in the prompt may not be present during pre-training @xcite @xcite . to address this issue, we propose a unified paradigm named cloze driven prompt (cdp). cdp uses a word cloze task that is more compatible with plm, that is, it only masks and reconstructs the original input (see we conduct experiments over 15 public nlu benchmarks. evaluation results indicate that our model adversarial knowledge stimulated contrastive prompting (akscp) not only outperforms the performance of the state-of-the-art models, but also exhibits a good generalization ability over extensive tasks. in addition, we find that with the decrease of training data, the performance of akscp with fine-tuned parameters consistently outperforms the standard prompt learning method which freezes lm parameters. we also analysis the sample efficiency and the improvement margin difference to further verify the correctness of our motivation of akscp. in this paper, we make three main contributions: paradigm mask input pre-training 15% i just loved every minute m m film m fine-tuning 0 i just loved every minute of this film . prompt tuning 1 i just loved every minute of this film . it was m . cdp top-k i just m every minute of this m , it was m . depending on the prompt types, existing researches can be divided into two main categories: manually designed ones @xcite @xcite and automatically created ones (discrete prompts @xcite or continuous prompts @xcite ) , where continuous prompts focus on utilizing learnable continuous embeddings as prompt templates rather than label words. however, these prompts construction still lack coverage and bring considerable bias and high variances to the results. recently, @xcite propose to utilize external knowledge data to solve this issue. however, these works can not stimulate knowledge without external data directly. contrastive learning contrastive learning is a selfsupervised learning technique that aims to learn representations that are semantically similar for samples from the same class (positive pair) and semantically dissimilar for samples from different classes (negative pairs). this technique achieves this by maximizing the lower bound of the mutual information between two augmented views of the samples @xcite . various contrastive learning methods have been proposed @xcite @xcite @xcite . among them, supcon @xcite is a distinctive method that performs contrastive learning at the class level by clustering two augmented batches of samples in the feature space. this allows supcon to generate more negative pairs, which enhances the efficiency of contrastive learning in practice. i m every minute of the m . i'm not very m in m. gradient s p the i m … [sep] [sep] [sep] cloze mask prompt demo adversarial attack adv . x x  + . i m every minute of the m , it was m. the cat is very m, it was great. how m i smile? it was terrible. ## problem formalization in the low-resource nlu tasks, only a set of labeled training data @xmath0, y 1 ), . . . , (x n , y n )}. following the few-shot setting of @xcite , we assume to have access to a pre-trained language model m and d, we aim to learn a model p θ (y|x) from d without any external knowledge and related data. for all of the following experiments, there are only k examples per class in d. ## methodology this section first formulates the knowledge stimulation method for low-resource nlu task. we then introduce the two important components in proposed adversarial knowledge stimulation contrastive prompt (akscp), including i) cloze driven prompt; ii) adversarial contrastive learning. figure 1 shows the overall akscp. ## experiments this section is organized as follows. section 5.1 introduces the experimental settings. main experimental results were reported in section 5.2. in section 5.3, we perform ablation studies. and section 5.4 compares akscp and standard prompting under different settings and analyzes the sample efficiency. ## conclusion in this paper, we propose the first prompt-based knowledge stimulation model akscp for lowresource nlu tasks. we conduct experiments on 15 tasks and demonstrate the effectiveness of our approach. for future work, we plan to expand our model to other nlp tasks such as qa and nlg.