## 4 Methodology
### Prototype Enhancement Module
#### 4.3.2 Enhanced Prototype  
In the prototype space, similar data points may be assigned to adjacent prototype vectors, and there might be some correlation between these similar prototypes. However, the basic prototypes obtained from Equation (2) overlook interactions between classes. To explore the inherent relationships between the class prototypes, SACT introduces a multi-head self-attention mechanism to consider the influence of different prototypes on each other. Self-attention allows each prototype to focus on different regions in the embedding space and gather information from other prototype vectors. The key idea behind multi-head self-attention is to utilize multiple self-attention operators to simultaneously process features from different subspaces. Each self-attention operator can capture different focal points in the input sequence and assign distinct weights to each focal point. By employing multiple self-attention operators, the model can concurrently focus on different parts of the input and merge their features together to enhance the contextual information for local features. This allows our model to better handle few-shot unknown categories and achieve accurate classification when facing new query instances.  
When the prototype network encounters FSRE, it may produce considerable noise for classes with limited samples due to insufficient training. To mitigate the impact of noise and enhance the expressiveness of the prototype network, SACT employs an information-aggregation approach. Considering each prototype as a head of the self-attention mechanism, we calculate the attention weights between each head and the others. This allows us to obtain interaction information from different prototypes. Such interaction information can be regarded as a form of global contextual information, aiding the model in better understanding the relationships and interactions between various prototypes. Consequently, when dealing with unknown categories, the model can more effectively capture their associations and common features. Finally, by aggregating the features from multiple heads, we synthesize these rich interactive pieces of information to obtain a comprehensive prototype representation. The prototype enhancement process, as shown in Figure 5, takes the basic prototypes obtained from Equation (2) as input to a multi-head self-attention model. By applying a linear transformation to the input prototype vectors, SACT obtains the query \(\mathcal{Q}\), key \(K\), and value \(V\) matrices as described in Equation (3):  
\[\begin{array}{l}\text{Query}\,=W_{\mathcal{Q}}\times p_{i}^{\text{basic}}\\ \text{Key}\,=W_{K}\times p_{i}^{\text{basic}}\\ \text{Value}\,=W_{V}\times p_{i}^{\text{basic}}\\ \end{array} \tag{3}\]where \(W_{Q}\), \(W_{K}\), and \(W_{V}\) are the learnable matrices in different linear transformations. Next, SACT computes the correlation between query and key, which involves calculating the attention scores represented by the sparse matrix \(\alpha_{ij}\) using vector dot products:  
\[\alpha_{i,j}=\text{softmax}\Bigg{(}\frac{\big{[}W_{Q}\times p_{i}\big{]}\times \big{[}W_{K}\times p_{j}\big{]}^{T}}{\sqrt{d_{k}}}\Bigg{)} \tag{4}\]  
where \(\sqrt{d_{k}}\) is the dimension of the prototype vectors, and \(p_{i}\) and \(p_{j}\) are the basic prototypes for the \(i\)-th and \(j\)-th classes, respectively. The basic prototypes are inputted into the self-attention matrix to obtain the enhanced prototypes, and the basic prototypes are integrated with the enhanced prototypes to obtain a more enriched prototype representation. The enhanced prototypes \(p_{i}^{\text{enhanced}}\) are denoted as in Equation (5):  
\[p_{i}^{\text{enhanced}}=p_{i}^{\text{basic}}+W_{p}\times p_{i}\times\alpha_{ ij} \tag{5}\]