S table PT : Towards Stable Prompting for Few-shot Learning via Input Separation (2024)

Abstract: Large language models have shown their ability to become effective few-shot learners with prompting, revoluting the paradigm of learning with data scarcity. However, this approach largely depends on the quality of prompt initialization and always exhibits large variability among different runs. Such property makes prompt tuning highly unreliable and vulnerable to poorly constructed prompts, which limits its extension to more real-world applications. To tackle this issue, we propose to treat the hard prompt and soft prompt as separate inputs to mitigate noise brought by the prompt initialization. Furthermore, we optimize soft prompts with contrastive learning for utilizing class-aware information in the training process to maintain model performance. Experimental results demonstrate that StablePT outperforms state-of-the-art methods by 6.97% in accuracy and reduces the standard deviation by 1.92 on average. Furthermore, extensive experiments underscore its robustness and stability across 8 datasets covering various tasks.

## introduction pre-trained language models (plms) @xcite @xcite exhibit an overwhelming capacity to understand, analyze and classify textual information. recent works suggest prompt tuning @xcite @xcite @xcite to be a plausible method for efficiently adapting abundant but general knowledge behind plms to various downstream tasks. prompt tuning reformulates downstream tasks into the same mask language modeling (mlm) problem as pre-training of plms by constructing proper templates with open slots. in this way, the tasks benefit from plms' generative capability to fill the slots. @xcite find that plms are able to learn well 1 codes are available at https://github.com/lccc0528 . from limited training templates for certain tasks. thus, it has been a practical topic to generalize plms' ability in a prompt manner with only a few samples for both training and data efficiency. current works on the construction of prompts could be roughly categorized into two branches: a) hard prompt construction, which generates a template in natural language manually @xcite or automatically @xcite @xcite . while hard prompts provide explicit guidance for plms, the performance is largely dependent on the selection of a proper template. in fact, @xcite report that different prompt formats could lead to accuracy varying from near chance to near state-of-the-art. b) soft prompt construction, which searches for appro-priate prompts in embedding space @xcite . although steering away from natural language avoids meticulous selection of manual prompts, effective initialization of soft prompts is considered crucial for gaining satisfying performance @xcite . fig. 1 illustrates the instability of vanilla prompt tuning with 10 runs on eight natural language understanding (nlu) tasks. a common solution for searching valid prompt initialization in continuous space is pre-training @xcite , which first learns the prompt on multiple datasets with diversified tasks but requires massive computing expenses. to deal with the defects of hard and soft prompt construction, we propose a stable prompt tuning method, named stablept, which is robust to prompt initialization quality and keeps out performance and stability in the meantime. instead of concatenating hard and soft prompts directly, we treat them as separate inputs to different transformers-style modules. hard prompts with contexts are embedded by plm and a single semencoder layer for context-aware representation, and a gendecoder layer takes soft prompt as input, further injecting class-aware information into cloze templates by contrastive learning. moreover, we apply supervised contrastive loss in the soft prompt optimization process, enhancing the model's ability to achieve inter-class separation and inner-class compactness, which further boosts model performance in the few-shot setting. the advantages of our method are three-folded: (i) reduce noise caused by undesired soft prompt initialization through processing hard prompt and soft prompt with different modules. (ii) soft prompts provide the verbalizer with additional class-aware information, ensuring consistent performance regardless of the discrete template expression. (iii) hard prompts offer explicit guidance on soft prompt optimization for extracting task-specific knowledge efficiently. the contribution is summarized as follows: few-shot learning with plms. prompting plms, such as gpt-3 @xcite and pet @xcite , are found to obtain surprising performance in substantial downstream tasks with few-shot settings. subsequent research efforts by @xcite and @xcite have explored reasonable few-shot settings by constraining the size of the validation set and introducing a unified framework for assessing few-shot performance. the study by @xcite em-phasizes that fine-tuning plms in few-shot learning scenarios can enhance the model's robustness to different hard prompts. however, their approaches do not address the fundamental issue of poor prompt adjustment performance in few-shot scenarios. our method overcomes this by fine-tuning trivial portions in additional layers with interaction between disentangled prompts. ## methodology we introduce a novel language model architecture named stablept that processes textual information foot_0 and soft prompts separately but keeps interaction between them. it helps stabilize model performance across different initialization of hard/soft prompts. the detailed illustration of stablept is shown in fig. 2 . ## conclusion in this work, we propose stablept, an innovative hybrid prompt-tuning framework for improving the effectiveness of prompt tuning in few-shot learning and reducing the reliance on well-chosen prompt initialization. by introducing a generative decoder module, our system allows soft prompt to interact with the output states of encoded hard prompt and input, rather than simply appending soft prompt to the input text. this approach not only overcomes the initial noise potentially introduced by soft prompts but also enhances the model's ability to capture class-aware information through the application of contrastive learning, thereby achieving better performance in nlu tasks. the results across eight datasets in four tasks demonstrate that our method maintains top performance while showing stability to different prompt initializations.