## 3 Approach
### Demonstration Candidate Filtering
#### 3.3.2 Joint Correlation Score Function  
The superiority of demonstration learning relies on the ability to demonstrate how the language model should provide the answer to the actual prompt instantiated with the input. For example, providing a prompt of \"China's capital is \([MASK]\)\" prefaced by a few examples such as \"Great Britain's capital is London. Japan's capital is Tokyo\". These demonstrations enable strong language models to learn repetitive patterns. In this light, examples that are semantically close to the query sample in the embedding space consistently give rise to a strong performance. The existing approaches are suboptimal for few-shot text classification since they can not ensure the most similar examples are learned as well as introduce additional parameters such as SBERT [18] and increase the computation complexity. Accordingly, we propose a joint correlation scoring function that combines the cosine similarity and the point-wise mutual information. Specifically, given a query input \(x_{q}\) and a support example \(x_{i}\), we first feed them into an encoder to extract their sentence-level embeddings \(e(x_{q}),e(x_{i})\). Then, the cosine similarity score can be calculated by:  
\[\mathcal{S}(x_{q},x_{i})=dist(e(x_{q}),e(x_{i}))=\frac{e(x_{q})\cdot e(x_{i})} {||e(x_{q})||_{2}^{2}\cdot||e(x_{i})||_{2}^{2}}. \tag{8}\]  
The point-wise mutual information using data collected by information retrieval was proposed as an unsupervised measure for the evaluation of the semantic similarity of words. It is based on word co-occurrence using counts collected over the corpora. Formally, given two words \(w_{1}\) and \(w_{2}\), their PMI is measured as:  
\[PMI(w_{1},w_{2})=\log_{2}\frac{p(w_{1},w_{2})}{p(w_{1})\times p(w_{2})}, \tag{9}\]  
which indicates the degree of statistical dependence between \(w_{1}\) and \(w_{2}\), and it can be used as a measure of the semantic similarity of the two words. Then, the mutual information between two sentences, \(S_{1}\) and \(S_{2}\) can be calculated as the sum of PMI between their contained words as follows:  
\[I(S_{1},S_{2})=\sum_{w_{1}\in S_{1}}\sum_{w_{j}\in S_{2}}PMI(w_{i},w_{j}). \tag{10}\]Recall that in the situation of prompt learning, a support set is typically formulated as \(\mathcal{D}_{support}=(x_{i},y_{i})\), where \(x_{i}\) and \(y_{i}\) denote the sentence and label of the \(i\)th training sample. Considering the similarity and the mutual information calculation illustrated above, the demonstration example of each query is selected by a joint correlation scoring function as:  
\[\underset{x_{i}\in\mathcal{D}_{support}}{MAX}\big{\{}Score(x_{q},x_{i})=I(x_{q},x_{i})+\mathcal{S}(x_{q},x_{i})\big{\}}, \tag{11}\]  
We denote the concatenation of the query and the selected demonstration example as a context \(c_{m}\):  
\[c_{m}=\mathcal{T}(x_{q})\oplus\mathcal{T}(x_{i}) \tag{12}\]  
For each context \(c_{m}\), we fine-tune it on \(\mathcal{D}_{train}\) and \(\mathcal{D}_{dev}\) to pick the best performing candidate. With the filtered support set \(\mathcal{D}_{support}\), we then perform a standard prompt-based training procedure following Equation (2). We summarize the entire training procedure of our proposal in Algorithm 1. For each input tuple in the training set, we first replace the label with predefined label words in line 1. Then, we insert masked positions and special tokens into the gaps between input and labels in lines 3 to 4. After that, we employ BART to fill in the [MASK] and perform the time-tuning on each generated candidate so as to select the best-performing template in lines 5 to 6. Next, for each query, we transform them to the prompt format in line 9 and calculate the correlation score between the query and every support example in lines 11 to 13. Finally, we chose the example with the largest correlation score for demonstration learning in line 14.