## 4 Materials and Methods
### Proto-MAML
#### 4.3.2 Proto-MAML Training Within a BERT-Enhanced QA Framework
The embeddings \(E\) serve as the foundation for the contextualized representations \(H=\{h_{1},h_{2},\ldots,h_{n}\}\), which are crucial for Proto-MAML. After generating \(E\) and \(H\), BERT applies a multi-head self-attention mechanism to capture semantic and dependency relationships within the prototypes of \(\mathcal{S}\) and \(\mathcal{Q}\). This mechanism aids in identifying local and global relationships between the samples, therefore improving the generalization capacity of the model. These relationships include token matching within \(E\) and \(H\), contextual relevance, and interactions between different segments of vulnerable code and their responses, enabling the identification of both vulnerable lines and secure code. The contextualized embeddings \(H\), which are generated through the transformer layers of BERT, are incrementally refined as they progress through multiple attention heads and feedforward networks (FFNs). This process ensures that each token embedding within \(H\) semantically and syntactically aligns with its respective context. The iterative refinement facilitated by these layers provides a robust representation, enabling precise predictions for the QA pairs. To maintain numerical stability and ensure consistent gradient flow during backpropagation, layer normalization is applied. This normalization step, as defined in Equation (14), ensures that the embeddings \(H\), including \(h_{[\text{CLS}]}\), \(h_{Q_{V}}\), and \(h_{C_{V}}\), remain balanced across all processing layers. \[\hat{h}_{V_{j}}=\frac{h_{V_{j}}-\mu_{\mathcal{S}}}{\sigma_{\mathcal{S}}+ \epsilon}, \tag{14}\]  
where \(h_{V_{j}}\) represents the original activation value for a token in the sequence, while \(\hat{h}_{V_{j}}\) is the normalized output; furthermore, the terms \(\mu_{\mathcal{S}}\) and \(\sigma_{\mathcal{S}}\) represent the mean and standard deviation computed over the prototype activations in \(\mathcal{S}\), respectively, and \(\epsilon\) is a small constant serving to prevent division by zero. During fine-tuning of the parameters towards \(\theta^{\prime}\), the predictions for answer spans--referred to as logits--are computed. These logits, \(\lambda_{[\text{START}]}\) and \(\lambda_{[\text{END}]}\), correspond to the probabilistic predictions for the start and end positions of the answer spans within \(C_{V_{j}}\), respectively. The formulas for these logits are defined in Equations (15) and (16), respectively. \[\lambda_{[\text{START}]} =\text{softmax}(W_{[\text{START}]}h_{[\text{CLS}]}+b_{[\text{START }]}), \tag{15}\] \[\lambda_{[\text{END}]} =\text{softmax}(W_{[\text{END}]}h_{[\text{CLS}]}+b_{[\text{END }]}), \tag{16}\]  
where \(W_{[\text{START}]}\) and \(W_{[\text{END}]}\) represent the weight matrices used to project \(h_{[\text{CLS}]}\)--the activation vector associated with the special classification token [CLS]--into the corresponding logits. The bias terms, \(b_{[\text{START}]}\) and \(b_{[\text{END}]}\), adjust these projections to accommodate variations in context and answer spans. Leveraging these refined logits, Proto-MAML can effectively align question-context-answer relationships to maximize its prediction accuracy. Figure 5: Input flow through the transformer layers of BERT within the Proto-MAML framework, utilizing transformer blocks to refine the relationships among prototypes \(Q_{V_{j}}\), \(C_{V_{j}}\), and \(A_{V_{j}}\), as well as for computation of the predictions. Each prototype \(p_{j}\) in \(\mathcal{S}\) is iteratively refined across the meta-episodes by evaluating the logits on \(\mathcal{Q}\), thus adjusting the relationships between \(Q_{V_{j}}\) and \(C_{V_{j}}\) within the tuple.