Fine-tuning after Prompting: an Explainable Way for Classification (2024)

Abstract: Prompting is an alternative approach for utilizing pre-trained language models (PLMs) in classification tasks. In contrast to fine-tuning, prompting is more understandable for humans because it utilizes natural language to interact with the PLM, but it often falls short in terms of accuracy. While current research primarily focuses on enhancing the performance of prompting methods to compete with fine-tuning, we believe that these two approaches are not mutually exclusive, each having its strengths and weaknesses. In our study, we depart from the competitive view of prompting versus fine-tuning and instead combine them, introducing a novel method called F&P. This approach enables us to harness the advantages of F ine-tuning for accuracy and the explainability of P rompting simultaneously. Specifically, we reformulate the sample into a prompt and subsequently fine-tune a linear classifier on top of the PLM. Following this, we extract verbalizers according to the weight of this classifier. During the inference phase, we reformulate the sample in the same way and query the PLM. The PLM generates a word, which is then subject to a dictionary lookup by the verbalizer to obtain the prediction. Experiments show that keeping only 30 keywords for each class can achieve comparable performance as fine-tuning. On the other hand, both the prompt and verbalizers are constructed in natural language, making them fully understandable to humans. Hence, the F&P method offers an effective and transparent way to employ a PLM for classification tasks.

## introduction prompting @xcite is a novel method for adapting pre-trained language models (plms) to downstream classification tasks @xcite . generally, a prompt typically consists of a sample, a task description, * equal contribution. and a reserved blank. plm is required to generate an appropriate word to fill in this blank based on the task description and the sample. a verbalizer then assigns a class to this word, finalizing the sample's classification. for example, i like this movie. the sentiment is . a typical verbalizer uses a lookup table to determine the class to which the predicted word should belong @xcite @xcite . in this manner, a classification task is transformed into a language modeling task, aligning with the pre-training tasks of plms. compared with fine-tuning, prompting methods are more transparent to humans as the prompt consists of real words and is more explainable than a classifier with numerous parameters. however, prompting methods exhibit a lower performance than fine-tuning @xcite . because of the context sensitivity inherent to plms, their responses to identical queries exhibit inconsistencies when prompted in varying ways. simply altering the wording of prompts, or even making minor lexical adjustments, can result in performance variations of up to 20% @xcite . to this end, a series of studies @xcite @xcite @xcite @xcite delved into methods for formulating effective prompts. they believed that prompts are not necessarily composed of real words and proposed a novel approach called "prompt tuning," wherein a set of k trainable vectors is employed as prompts, rather than conventional natural language, e.g., i like this movie. v 1 , • • • , v k . these methods greatly enhance the capabilities of prompts, yielding performance comparable to or even surpassing that of fine-tuning. however, it is noteworthy that prompts become less explainable for humans. despite the absence of explicit research on the connection between explainability and performance, current efforts inadvertently prioritize performance over explainability when developing capable prompts. we believe that the relationship between explainability and performance is not mutually exclusive. it is feasible to enhance prompt performance while simultaneously taking into account their explainability. in this work, we depart from the competition paradigm between prompting and fine-tuning. instead, we integrate both techniques and propose a novel method f&p that attains performance on par with fine-tuning, while preserving the outstanding explainability inherent to prompting methods. specifically, referring to the prompting method, we create a task description for each classification task and leave a blank space for the plm to make predictions. we concatenate such a task description at the end of each sample, forming a prompt. next, we refer to the fine-tuning, by adding a linear layer on top of the plm to classify its output. it is worth mentioning that traditional fine-tuning methods often replace the language model head with a linear layer, whereas we add an additional linear layer on top of the language model head. therefore, the linear layer classifies the word distribution predicted by the plm rather than word embeddings. furthermore, in contrast to classifying sentence representations, such as [cls], we classify the word distribution output from the blank space in the model. after the fine-tuning, the weights of the linear layer represent the significance of words for each class. to create a verbalizer, we sort all words in the vocabulary based on these weights and select the top-k words for each class. then we remove the linear layer. during inference, given the new sample, we construct the prompt in the same way and input it into the plm. the plm's predicted word is then associated with a class based on the verbalizer. in this approach, we replace the classifier with a prompt and a verbalizer, yielding two key advantages. firstly, both the prompt and verbalizer employ real, easily understandable words, making the classification process transparent to humans. this contrasts with the use of complex classifiers, which often obscure the classification process. secondly, this approach avoids introducing additional parameters to the plm, allowing us to maintain the original plm size. consequently, it can be ap-plied to prob the linguistic knowledge embedded in the plm, a crucial technique to explain the plm @xcite . ## related work fine-tuning represents the predominant method for customizing plms to specific downstream tasks. however, these tasks often diverge significantly from the cloze test used during the plm's pre-training phase. for instance, roberta @xcite demonstrates proficiency across various tasks such as text classification, and sequence labeling. however, its pre-training task is a cloze test. the disparity between pre-training tasks and downstream applications is believed by researchers to hinder the optimal utilization of plms' knowledge @xcite . this gap poses challenges, notably the propensity for plms to exhibit overfitting on limited training samples post fine-tuning, particularly when data availability is constrained. therefore, addressing this gap is crucial to fully harnessing the potential of plms across diverse applications and ensuring robust performance in practical scenarios. prompt-based methods have been introduced as a strategic bridge between pre-training and fine-tuning stages in nlp. according to @xcite , these methods leverage the relational knowledge inherently encoded within plms, thereby demonstrating their efficacy in various tasks. additionally, @xcite substantiated that the expansive knowledge encoded within large-scale plms is substantial enough to execute tasks effectively without necessitating parameter tuning. furthermore, these methods enhance the usability of plms across different tasks by appending supplementary descriptions and examples in a cloze-style format, aligning each downstream task consistently with the structure of the pre-training tasks. this standardization not only facilitates smoother transitions between stages but also optimizes task performance. recent studies have underscored the competitive advantages of prompt-based methods, showing that they can achieve comparable or superior performance compared to traditional fine-tuning approaches @xcite @xcite @xcite @xcite . moreover, they have demonstrated remarkable efficacy in scenarios requiring minimal training data, such as few-shot or zero-shot settings. this adaptability underscores their potential to significantly advance the field of nlp by making efficient use of pre-existing model knowledge @xcite @xcite @xcite . ## methodology figure 1 illustrates the overview of f&p. a prompt p is composed of three parts, including an input x, a task description with k tokens t 1 , • • • , t k , and a symbol of mask, i.e., fed the prompt p, the plm f(•) predicts the word distribution for [mask]: in the inference, the input is wrapped into a prompt p in the same way and processed by the plm following the equation 1. the token in the verbalizer with the largest probability is the predicted word, i.e., t * = arg max p ([mask] = t i |p), t @xmath0. the final prediction is made by looking up the verbalizer, m(t * ). ## conclusions in this work, we propose an effective approach, referred to as f&p, which integrates fine-tuning and prompting to adapt plms for classification tasks. our experimental results demonstrate that f&p yields performance comparable to fine-tuning, by employing prompts and verbalizers to replace the conventional classifier. importantly, these prompts and verbalizers consist of real words that are easily understandable by humans. additionally, we propose a method for assessing the explainability of verbalizers and a variation for probing tasks. we believe that f&p not only enhances classification performance but also plays a pivotal role in demystifying the inner workings of these models.