## 4 Materials and Methods
### Proto-MAML
#### 4.3.2 Proto-MAML Training Within a BERT-Enhanced QA Framework
The cumulative update of the total loss is used to adjust the parameters of BERT, as expressed in Equation (22):  
\[\min_{\theta}\sum_{\forall i\in\mathcal{T}}\mathcal{L}_{\mathcal{T}_{i}}( \mathcal{Q},\theta^{\prime}_{\mathcal{T}_{i}}), \tag{12}\]2  
where \(\gamma\) is the learning rate for the meta-optimization update, which ensures that BERT efficiently adapts its parameters with the accumulated gradients across all tasks during each epoch. Finally, Algorithm 1 describes the global meta-optimization process of Proto-MAML, leading to the progressive refinement of prototypes and robust learning of the BERT architecture. ```
1:Input: Support set \(\mathcal{S}\), query set \(\mathcal{Q}\), number of epochs \(n\), initial parameters \(\theta\)
2:for each epoch \(n\)do\(\triangleright\) Outer Loop: Global optimization across multiple epochs
3:for each task \(\mathcal{T}_{i}\)do\(\triangleright\) Inner Loop: Process for each task
4: Tokenize \(\{Q_{V},C_{V}\}\in\mathcal{S}\)
5: Unfreeze the parameters of BERT: \[\min_{\theta}\sum_{\forall i\in\mathcal{T}}\mathcal{L}_{\mathcal{T}_{i}}( \mathcal{Q},\theta^{\prime}_{\mathcal{T}_{i}}), \tag{12}\]3 (23) where \(\theta_{f}\) is the frozen state and \(\Delta\theta\) is the parameter change derived from gradient updates. 6: Compute prototypes \(p_{j}\) from \(A_{V}\) in \(\mathcal{S}\) using: \[\min_{\theta}\sum_{\forall i\in\mathcal{T}}\mathcal{L}_{\mathcal{T}_{i}}( \mathcal{Q},\theta^{\prime}_{\mathcal{T}_{i}}), \tag{12}\]4 (24) where the prototypes \(p_{j}\) represent the key features derived from the support sequences. 7: Evaluate \(\mathcal{Q}\) against the prototypes \(p_{j}\)
8: Calculate the logits \(\lambda_{[\text{START}]},\lambda_{[\text{END}]}\) for \(A_{V}\in\mathcal{S}\)
9: Convert the logits into discrete start and end positions \(A^{\prime}_{V[\text{START}]},A^{\prime}_{V[\text{END}]}\) using: \[\min_{\theta}\sum_{\forall i\in\mathcal{T}}\mathcal{L}_{\mathcal{T}_{i}}( \mathcal{Q},\theta^{\prime}_{\mathcal{T}_{i}}), \tag{12}\]5 (25)
10: Compute performance metrics: F1-score, Exact Match, and Entropy. 11: Update model parameters: Optimize using the first meta-loss: \[\min_{\theta}\sum_{\forall i\in\mathcal{T}}\mathcal{L}_{\mathcal{T}_{i}}( \mathcal{Q},\theta^{\prime}_{\mathcal{T}_{i}}), \tag{12}\]6 (26) where \(\gamma\) is the learning rate for parameter updates and \(\
abla_{\theta}\mathcal{L}^{(1)}_{\text{meta}}\) is the gradient of the meta-loss with respect to the parameters of the model. 12: Update prototypes: Backpropagate gradients to adjust prototypes using the second meta-loss: \[\min_{\theta}\sum_{\forall i\in\mathcal{T}}\mathcal{L}_{\mathcal{T}_{i}}( \mathcal{Q},\theta^{\prime}_{\mathcal{T}_{i}}), \tag{12}\]7 (27) where \(\eta\) is the learning rate for prototype updates. 13:endfor
14: Minimize global loss: Global optimization after all tasks: \[\min_{\theta}\sum_{\forall i\in\mathcal{T}}\mathcal{L}_{\mathcal{T}_{i}}( \mathcal{Q},\theta^{\prime}_{\mathcal{T}_{i}}), \tag{12}\]8 (28) where \(\gamma\) is the global learning rate and \(\mathcal{L}^{(2)}_{\text{meta}}\) corresponds to the cumulative loss during the epoch. 15:endfor
16:Output: Optimized Proto-MAML model with adjusted parameters \(\theta^{\prime}\)

## 5 Results

The performance evaluation of Proto-MAML in QA tasks followed a structured and systematic approach, assessing each phase of the training process and culminating in a final evaluation under the \(k\)-shot-\(i\)-way paradigm. As described in [54], this method involves selecting \(k\) samples for \(\mathcal{T}_{i}\) classification tasks, distributed across the support set \(\mathcal{S}\) and the query set \(\mathcal{Q}\), over \(n\) epochs. Therefore, performance indicators are calculated at two points: while the Proto-MAML estimator is trained across the inner and outer loops, resulting in a total of \(k\times i\times n\) tasks, and upon producing the final model. Typically, \(i\) is set in the range of \(5\leq i\leq 10\) in order to balance task complexity with the generalization capacity of the model.