## 4 Materials and Methods
### Proto-MAML
#### 4.3.2 Proto-MAML Training Within a BERT-Enhanced QA Framework
Instead of relying solely on parameter adaptation in terms of \(\theta\), Prototypical Networks compute prototypes that more homogeneously represent the outputs \(A_{V[\text{START}]},A_{V[\text{END}]},A_{V_{j}}\), along with the representative features of \(Q_{V_{j}}\) and \(C_{V_{j}}\), thus simulating a concise and well-defined class space. Each prototype \(p_{j}\) represents a condensed and averaged form of each tuple in \(\mathcal{S}\). It synthesizes the start and end information \(A_{V[\text{START}]_{j}}\) and \(A_{V[\text{END}]_{j}}\), respectively--which define the boundaries of the class space--as well as the complete answer \(A_{V}\) within the context \(C_{V_{j}}\), along with its corresponding \(Q_{V_{j}}\). These elements are derived from the embeddings \(h_{Q_{V}}\) and \(h_{C_{V}}\), which are generated by BERT for the support examples in \(\mathcal{S}\), as indicated in Equation (13):  
\[p_{j}=\frac{1}{K}\sum_{j=1}^{K}f_{\theta}(A_{V[\text{START}]_{j}},A_{V[\text{ END}]_{j}},A_{V_{j}},Q_{V_{j}},C_{V_{j}}), \tag{13}\]  
where \(f_{\theta}\) is the prototype function that maps the key features of \(A_{V[\text{START}]_{j}}\), \(A_{V[\text{END}]_{j}}\), \(A_{V_{j}},Q_{V}\), and \(C_{V_{j}}\), conditioned by \(\theta\) in the inner loop. Proto-MAML emerges as a hybrid design that integrates the rapid adaptability of MAML with the structured representations of Prototypical Networks. Through combining these techniques, Proto-MAML addresses the limitations of gradient-based methods while leveraging metric-based representations to enhance its generalization ability, particularly in low-resource contexts [46]. Compared to other meta-learning techniques such as Latent Embedding Optimization (LEO) [46] and Task-Agnostic Meta-Learning (TAML) [48], which focus on latent-space optimization or task-agnostic adjustments, Proto-MAML provides a balance between computational efficiency and robust adaptation. Proto-MAML also surpasses Meta-Stochastic Gradient Descent (Meta-SGD) and Reptile, which prioritize faster convergence but lack the structured task embeddings that are necessary when considering dynamic and heterogeneous environments. Leveraging prototypical embeddings to minimize the number of gradient updates required, Proto-MAML ensures stable performance while avoiding overfitting on small support sets. This perspective is particularly desirable in QA scenarios involving source code vulnerability detection. In such cases, the support sets \(\mathcal{S}\) tend to be small, as specific vulnerabilities are often poorly documented and labeled examples are typically limited. For instance, identifying SQL injections or insecure references in PHP code snippets may require recognizing highly specific patterns within the context of vulnerable code. Proto-MAML, through the use of prototypical representations, is capable of generalizing to new examples of vulnerabilities with minimal supervision, maintaining significant accuracy levels in tasks where data are scarce. Moreover, the ability of Proto-MAML to integrate contextualized embeddings generated by BERT, such as \(h_{Q_{V}}\) and \(h_{C_{V}}\), enables the modeling of complex relationships between specific queries and the context of the code. This ensures that technical questions--such as _Which line of code is vulnerable?_ or _Which function needs refactoring?_--can be answered accurately even when labeled samples are sparse. Ultimately, Proto-MAML not only minimizes computational costs but also provides an efficient solution for resource-constrained environments in which adaptability and accuracy are paramount. As highlighted in Figure 5, the input flow through the \(k\) transformer layers of BERT within the Proto-MAML framework follows a structured organization, utilizing transformer blocks to generate prototypes of \(Q_{V_{j}}\), \(C_{V_{j}}\), and \(A_{V_{j}}\)[53]. As detailed in Section 4.3.1, the input embeddings \(E\) are derived as a sum of token embeddings \(T\), positional embeddings \(P\), and segment embeddings \(S\), as defined in Equation (7).