Adversarial Soft Prompt Tuning for Cross-Domain Sentiment Analysis (2022)

Abstract: Cross-domain sentiment analysis has achieved promising results with the help of pre-trained language models. As GPT-3 appears, prompt tuning has been widely explored to enable better semantic modeling in many natural language processing tasks. However, directly using a fixed predefined template for cross-domain research cannot model different distributions of the [MASK] token in different domains, thus making underuse of the prompt tuning technique. In this paper, we propose a novel Ad versarial S oft P rompt T uning method (AdSPT) to better model cross-domain sentiment analysis. On the one hand, AdSPT adopts separate soft prompts instead of hard templates to learn different vectors for different domains, thus alleviating the domain discrepancy of the [MASK] token in the masked language modeling task. On the other hand, AdSPT uses a novel domain adversarial training strategy to learn domain-invariant representations between each source domain and the target domain. Experiments on a publicly available sentiment analysis dataset show that our model achieves the new state-of-the-art results for both single-source domain adaptation and multi-source domain adaptation.

## introduction in recent years, with the emergence of a series of large-scale pre-trained language models (plms), such as gpt @xcite , bert @xcite , and roberta @xcite , fine-tuning plms has achieved promising results on a wide range of natural language processing (nlp) tasks. however, as plms become larger and larger, fine-tuning larger plms becomes more challenging in most real-world applications. more recently, @xcite show that designing task descriptions (a.k.a. prompts) can make accurate predictions without updating any of the it was . it is common to use a predefined template (e.g., "it was @xcite .") in prompt tuning for binary sentiment analysis, and the classification results of positive or negative depend on the probabilities of predefined label words (e.g., "{good, bad}") in the masked language modeling (mlm) task. however, the distributions of mlm prediction results can be different for different domains. an example is shown in figure 1 , the discrepancy between bookdomain review and video-domain review leads to different possibilities of label words. the highfrequency label word in book-domain review is "useful", and video-domain review is "real", neither of which is in the predefined "{good, bad}". therefore, it is unreasonable to predict predefined label words with fixed templates (a.k.a. hard prompts) for different domain datasets. the intuition is that the feature distributions corresponding to the [mask] position learned from the hard prompt are distinct among different do-mains. and the discrepancy among different domains can have serious effects on the cross-domain setting where we train a classifier on source domain data, e.g., the book reviews, and test it on the target domain, e.g., the video review. so domain adaptation @xcite based on cluster hypothesis @xcite becomes a key point of the cross-domain research. in order to improve the cross-domain sentiment analysis with the help of plms, we propose ad-spt: an adversarial soft prompt tuning method, which sheds new light on solving the domain adaptation problem. specifically, we use soft prompts composed of multiple learnable vectors and the [mask] token instead of hard templates for tuning. for different domains, we use independent soft prompts to represent domain-specific information, thus making them have the domain-aware knowledge. with different domain soft prompts, the mlm head classifier can mitigate the domain discrepancy of the [mask] token. to enhance the effectiveness of the target domain, we design a novel adversarial training strategy to learn the domain-invariant knowledge of the [mask] token, which can be seen as a two-player minimax game between the target domain and each source domain under multi-source domain adaptation setting. as a result, the collaborative effect of soft prompt tuning and domain adversarial training can more properly predict the feature distribution of the [mask] token on the ground of domain-specific soft prompts and the domain invariance of the [mask] token. in experiments, we evaluate on a publicly available sentiment analysis dataset for both singlesource domain adaptation and multi-source domain adaptation. our results show the effectiveness of collaboratively leveraging domain-specific soft prompts tuning and domain adversarial training. to summarize, the main contributions of this work are as follows: early works explore manually defined templates (a.k.a. hard templates) for text classification and natural language inference @xcite . however, suitable templates require strong domain knowledge. therefore, some automatically generated hard templates are explored @xcite @xcite . since prompt construction is to find a method that allows plms to effectively perform downstream tasks, it is not necessary to limit templates to human-interpretable natural language. some works attempt to perform prompting directly with several learnable vectors, such as soft prompt @xcite , prefix-tuning @xcite and p-tuning v2 @xcite . moreover, @xcite explore automatically identifying label words. @xcite use an external knowledge base to expand label words. this paper focuses on improving the cross-domain sentiment analysis via different soft prompts of different domains. ## problem formulation in this paper, we study cross-domain sentiment analysis in the unsupervised domain adaptation setting which contains two scenarios: a source domain and a target domain or multiple source domains and a target domain. given m(@xmath0, the l-th (@xmath1, . . . , m]) source domain contains an annotated dataset s @xmath2, y s i } n s l @xmath3, where ## method in this section, we first introduce a soft prompt tuning method for sentiment classification that utilizes soft prompts to capture domain-specific knowledge. then we present a domain adversarial training method for domain adaptation. finally, we describe the overall learning procedure. ## experiments in this section, we conduct experiments to evaluate the effectiveness of our methods. our experiments are carried out on single-source domain adaptation and multi-source domain adaptation settings ( § 5.3). in addition, we also investigate how different components in the model impact the performance of cross-domain sentiment analysis with different settings. ## conclusion in this paper, we proposed a novel adversarial soft prompt tuning method (adspt) for crossdomain sentiment analysis. firstly, we use domainspecific soft prompts instead of hard templates to represent domain-specific knowledge. the domainspecific soft prompts can alleviate the domain discrepancy w.r.t. the [mask] representations by mlm task. meanwhile, we also design a novel adversarial training strategy to learn the domaininvariant knowledge of the [mask] token among different domains. experiments on the amazon reviews dataset achieve state-of-the-art performance.