Let Me Check the Examples: Enhancing Demonstration Learning via Explicit Imitation (2023)

Abstract: Demonstration learning aims to guide the prompt prediction by providing answered demonstrations in the few shot settings. Despite achieving promising results, existing work only concatenates the answered examples as demonstrations to the prompt template (including the raw context) without any additional operation, neglecting the prompt-demonstration dependencies. Besides, prior research found that randomly replacing the labels of demonstrations marginally hurts performance, illustrating that the model could not properly learn the knowledge brought by the demonstrations. Inspired by the human learning process, in this paper, we introduce Imitation DEMOnstration learning (Imitation-Demo) to strengthen demonstration learning via explicitly imitating human review behaviour, which includes: (1) contrastive learning mechanism to concentrate on similar demonstrations.(2) demonstration-label re-prediction method to consolidate known knowledge. Experiment results show that our proposed method achieves state-of-the-art performance on 5 out of 14 classification corpus. Further studies also prove that Imitation-Demo strengthens the associations between the prompt and demonstrations, which could provide the basis for exploring how demonstration learning works.

## introduction prompt-based learning typically works by modifying the input into cloze-style prompt templates and using the masked language models (mlms) to complete the unfilled information in probabilistic. it has achieved promising performance in various nlp tasks @xcite @xcite , especially in low-resource settings @xcite . a promising prompt engineering category is demonstration learning (gao * equal contribution. to overcome this limitation, we rethink how human beings learn from demonstrations. intuitively, when faced with a new challenging question, they typically (1) look for the most similar example to the question first, and then (2) reply to the question according to the answering steps of the retrieved example. humans tend to strengthen the learning process through review strategies, i.e., finding a better solution to select similar examples and reanswering the questions of examples to consolidate known knowledge. inspired by this, likewise, the interactions between the prompt and demonstrations could also be reinforced by imitating the human reviewing process for demonstration learning. in this paper, we propose a simple-yet-effective version of demonstration learning, named imitation demonstration learning (imitation-demo) to explicitly strengthen the two sub-steps of demonstration learning via human-like review. specifi- as illustrated in fig. 1 (a ), the prompt template x prompt consists of input sentence x sent and template x temp containing mask token, i.e., x @xmath0, x temp ]. firstly, we leverage the pre-trained sbert @xcite to retrieve the demonstrations (including context x (k) and label y (k) ) for the k-th category that has maximum semantic similarity to the raw prompt context. then, the retrieved demonstrations are concatenated to the input prompt. after that, we convert the concatenated input sentence x in to hidden vectors h in via the roberta model @xcite . the model is optimized by crossentropy loss, and the goal of demonstration learning is to predict y mask at the [m ask] position from the hidden state of mask h mask via mlm head. the whole process could be formulated as foot_0 : during training, the cross-entropy loss is utilized to calculate l great and l terri for different demonstration labels, then we sum them up to obtain the demonstration-label re-prediction loss l label : similar contrastive learning and demonstrationlabel re-prediction operations can also be performed for the multi-category classification tasks. the overall loss of imitation-demo is defined as follows: ## conclusion in this paper, we propose imitation demonstration learning (imitation-demo) to reinforce the correlations between prompt and given demonstrations. inspired by the human review process, we introduce contrastive learning to locate similar samples and demonstration-label re-prediction mechanisms to solidify known knowledge. experiments show that our method consistently outperforms other baselines on 5 out of 14 classification datasets in the few-shot settings. we hope this work could inspire the exploration of the working mechanism of demonstration learning and toward better few-shot learning abilities.