## 4 Materials and Methods
### Proto-MAML
#### 4.3.2 Proto-MAML Training Within a BERT-Enhanced QA Framework  
The parameters of BERT, denoted as \(\theta\), are transferred to the MAML architecture [24; 51]--an adaptive meta-learning algorithm renowned for its data-agnostic nature. Unlike traditional methods that require training a model from scratch using batch-based schemes and extensive labeling, MAML generalizes class spaces \(K\) through progressive learning with small pairs of examples and outputs. This process provides an initial representation of the desired final model for each task \(\mathcal{T}_{i}\). The framework incorporates a dual optimization mechanism, where the model learns from the sample space via an inner loop that locally adjusts the parameters of the BERT model for \(\mathcal{T}_{i}\). Simultaneously, a global adjustment is carried out through an outer loop, which is iterated across multiple epochs, enabling the model to internalize context and propagate it comprehensively. In each episode of \(\mathcal{T}_{i}\), \(\theta\) is adjusted by refining the parameters to minimize the loss over the support set \(\mathcal{S}\), allowing efficient updates for new groups \(j\) of \((Q_{v_{j}},C_{v_{j}})\), \((A_{V_{j}},A_{V[\text{START}]_{j}},A_{V[\text{END}]_{j}})\) to be obtained. This process ensures that the inner loop generalizes the QA system, verifying the effectiveness of predictions on the set \(\mathcal{Q}\), in terms of correctly associating questions with predicted answers. The parameters adjusted for each \(\mathcal{T}_{i}\) are denoted as \(\theta^{\prime}_{\mathcal{T}_{i}}\), as illustrated in Equation (11):  
\[\theta^{\prime}_{\mathcal{T}_{i}}=\theta-\alpha\
abla_{\theta}f_{\mathcal{T}_ {i}}(\mathcal{S},\theta), \tag{11}\]  
where \(\theta\) represents the initial parameters of the BERT model; \(\alpha\) is the learning rate, which regulates the magnitude of parameter updates during the adaptation process; and \(\
abla\) denotes the gradient of \(f_{\mathcal{T}_{i}}\), which corresponds to the loss function for each task within its group \(\mathcal{S}\), serving as the guide for necessary adjustments. Simultaneously, the query set \(\mathcal{Q}\) in the inner loop of MAML adjusts the parameters \(\theta\) by optimizing the loss over the comparison with \(\mathcal{S}\), as presented in Equation (12):  
\[\min_{\theta}\sum_{\forall i\in\mathcal{T}}\mathcal{L}_{\mathcal{T}_{i}}( \mathcal{Q},\theta^{\prime}_{\mathcal{T}_{i}}), \tag{12}\]  
where \(\min_{\theta}\) represents determining the value that minimizes the task loss \(\mathcal{L}_{\mathcal{T}_{i}}\), evaluating \(\mathcal{Q}\) with the updated parameters \(\theta^{\prime}\). Although MAML facilitates the rapid adaptation of parameters, as observed in Equations (11) and (12), it may encounter limitations in tasks requiring precise discrimination, especially when working with discrete data and multiple outputs, such as the start and end indices of answers \(A_{V[\text{START}]_{j}}\) and \(A_{V[\text{END}]_{j}}\). As MAML is designed for class spaces \(K\) with few labels, this challenge may compromise its ability to correctly adjust the relationships between the answer positions \(A_{V_{j}}\) within the context \(C_{V_{j}}\) and the queries \(Q_{V_{j}}\), leading to inaccurate predictions if the parameters \(\theta^{\prime}\) degrade during adjustments in the inner loop [52], due to the heterogeneity of the indices to be calculated. Building on foundational principles of meta-learning, Prototypical Networks [47; 48] offer an effective mechanism for encoding structured task representations. Unlike traditional gradient-based methods, which rely on point-wise parameter adjustments, these networks define task relationships through prototypical embeddings, enabling better generalization across heterogeneous distributions. To mitigate these limitations, Prototypical Networks complement the MAML scheme by providing additional structure in the tuples of \(\mathcal{S}\).