---
title: 'DGS-MAML: Sharpness & Gradient Matching'
url: https://www.emergentmind.com/topics/dgs-maml
type: topic
---

# DGS-MAML: Sharpness & Gradient Matching

DGS-MAML, short for Domain-Generalization Sharpness-Aware Minimization Model-Agnostic Meta-Learning, is a meta-learning algorithm that integrates sharpness-aware training and gradient matching within a bi-level optimization framework in order to improve few-shot adaptation and robustness to domain shift [2508.09418]. Its central design combines SAM-style adversarial perturbations with alignment between the gradients of the empirical and perturbed objectives, so that both inner adaptation and outer meta-updates are biased toward flat minima and more consistent adaptation dynamics across train/validation splits and across perturbations. The method is introduced for settings with limited training data, and the paper supports it with PAC-Bayes analysis, convergence guarantees, benchmark experiments, and publicly available source code [2508.09418].

## 1. Problem setting and motivation

DGS-MAML is formulated for gradient-based meta-learning under few-shot adaptation, where tasks are sampled from a task distribution $T \sim p(\mathcal{T})$, and each task $m$ has a training split $\mathcal{D}_m^{train}$ and a validation split $\mathcal{D}_m^{val}$ [2508.09418]. In this setting, the meta-parameters $\theta \in \mathbb{R}^d$ define an initialization for a model $f_\theta$ that should adapt well to many tasks using few steps and few samples.

The motivating problem is that empirical risk on source tasks can admit sharp local minima that adapt quickly but generalize poorly to unseen target domains. The paper identifies two related issues in MAML-like bi-level optimization. First, stochastic gradient descent in MAML can converge to sharp basins, which exacerbates overfitting and harms cross-domain generalization. Second, conventional meta-objectives do not explicitly align how gradients behave across train versus validation splits and across neighborhoods in parameter space, so adaptation dynamics can differ under minor perturbations [2508.09418].

DGS-MAML addresses these issues by combining two mechanisms. SAM seeks flat minima by minimizing the worst-case loss in a small neighborhood around the current parameters, thereby discouraging sharp solutions. Gradient matching, described through the SAGM perspective, encourages alignment between the gradients of the unperturbed loss and the perturbed loss. When these gradients align, descending the empirical loss simultaneously reduces the worst-case perturbed loss and the surrogate gap, which the paper describes as strongly indicative of flatter minima and better domain generalization [2508.09418].

## 2. Formal construction within bi-level meta-learning

The baseline inner adaptation step follows MAML. For one step,
$$
\theta_m' = \theta - \alpha \nabla_\theta \mathcal{L}(\theta; \mathcal{D}_m^{train}),
$$
where $\alpha > 0$ is the inner learning rate. The second-order MAML meta-objective is
$$
\min_\theta \mathbb{E}_{T \sim p(\mathcal{T})}\big[\mathcal{L}(\theta'; \mathcal{D}_T^{val})\big],
$$
with gradient
$$
\nabla_\theta \mathcal{L}(\theta'; \mathcal{D}_T^{val}) =
\big(I - \alpha \nabla_\theta^2 \mathcal{L}(\theta; \mathcal{D}_T^{train})\big)^\top
\nabla_{\theta'} \mathcal{L}(\theta'; \mathcal{D}_T^{val}).
$$
A first-order approximation replaces $\big(I - \alpha \nabla_\theta^2 \mathcal{L}\big)$ by $I$ [2508.09418].

DGS-MAML augments this with SAM perturbations in both loops. For task $m$, the inner SAM perturbation is
$$
\epsilon_m =
\alpha_l \cdot
\frac{\nabla_\theta \mathcal{L}(\theta; \mathcal{D}_m^{train})}
{\|\nabla_\theta \mathcal{L}(\theta; \mathcal{D}_m^{train})\|_2},
$$
and the outer SAM perturbation is
$$
\epsilon =
\alpha_u \cdot
\frac{\nabla_\theta \big[\sum_{m=1}^M \mathcal{L}(\theta + \epsilon_m; \mathcal{D}_m^{val})\big]}
{\left\|\nabla_\theta \big[\sum_{m=1}^M \mathcal{L}(\theta + \epsilon_m; \mathcal{D}_m^{val})\big]\right\|_2}.
$$
These are the “both-loops” perturbations associated with SharpMAML [2508.09418].

The gradient-matching component is introduced through a perturbed loss
$$
\mathcal{L}_p(\theta; \mathcal{D}) :=
\mathcal{L}\big(\theta + \epsilon - \delta \nabla_\theta \mathcal{L}(\theta; \mathcal{D}); \mathcal{D}\big),
$$
where $\delta > 0$ is a gradient displacement hyperparameter, and through the surrogate gap
$$
h(\theta) := \mathcal{L}_p(\theta; \mathcal{D}) - \mathcal{L}(\theta; \mathcal{D}).
$$
The SAGM-style objective minimizes
$$
\min_\theta \big[\mathcal{L}(\theta; \mathcal{D}) + \mathcal{L}_p(\theta; \mathcal{D})\big].
$$
Under a first-order expansion around $\theta + \epsilon$, the sum becomes
$$
\mathcal{L}(\theta; \mathcal{D}) + \mathcal{L}_p(\theta; \mathcal{D})
- \alpha \cdot \nabla_\theta \mathcal{L}_p(\theta; \mathcal{D}) \cdot \nabla_\theta \mathcal{L}(\theta; \mathcal{D}),
$$
so the inner-product term encourages gradient alignment. The paper states that DGS-MAML enforces this alignment implicitly by minimizing $\mathcal{L} + \mathcal{L}_p$ with the SAM-style $\epsilon$ and displacement $\delta$ [2508.09418].

An explicit gradient-matching regularizer is also given conceptually:
$$
\mathcal{R}_{GM}(\theta; \mathcal{D}) :=
\left\|
\nabla_\theta \mathcal{L}(\theta; \mathcal{D}) -
\nabla_\theta \mathcal{L}\big(\theta + \epsilon - \delta \nabla_\theta \mathcal{L}(\theta; \mathcal{D}); \mathcal{D}\big)
\right\|_2^2,
$$
or equivalently one may maximize
$\nabla_\theta \mathcal{L}_p(\theta; \mathcal{D}) \cdot \nabla_\theta \mathcal{L}(\theta; \mathcal{D})$.
In the implemented method, however, gradient matching is realized through the summed losses rather than through a separate regularizer [2508.09418].

The task-wise inner objective is
$$
\mathcal{L}_{GM}^{train}(\theta; \mathcal{D}_m^{train}) :=
\mathcal{L}(\theta; \mathcal{D}_m^{train})
+
\mathcal{L}\big(\theta + \epsilon_m - \delta \nabla_\theta \mathcal{L}(\theta; \mathcal{D}_m^{train}); \mathcal{D}_m^{train}\big),
$$
with one inner update
$$
\theta_m^{(1)} =
\theta - \gamma \cdot \nabla_\theta \mathcal{L}_{GM}^{train}(\theta; \mathcal{D}_m^{train}),
$$
where $\gamma > 0$ is the inner-step learning rate. After $S$ steps, one obtains $\theta_m^{(S)}$ [2508.09418].

The outer objective uses the analogous validation loss
$$
\mathcal{L}_{GM}^{val}(\theta; \mathcal{D}_m^{val}) :=
\mathcal{L}(\theta; \mathcal{D}_m^{val})
+
\mathcal{L}\big(\theta + \epsilon - \delta \nabla_\theta \mathcal{L}(\theta; \mathcal{D}_m^{val}); \mathcal{D}_m^{val}\big),
$$
and the conceptual full bi-level objective is
$$
\min_\theta
\mathbb{E}_{T \sim p(\mathcal{T})}
\big[
\mathcal{L}_{GM}^{val}(U_{\alpha_l,\delta}(\theta; \mathcal{D}_T^{train}); \mathcal{D}_T^{val})
\big],
$$
where $U_{\alpha_l,\delta}$ denotes the $S$ inner steps driven by $\mathcal{L}_{GM}^{train}$ and inner SAM. A weighted form
$$
\min_\theta \mathbb{E}_T \big[\mathcal{L}^{val}(U(\theta)) + \lambda \mathcal{R}_{GM}^{val}(U(\theta))\big]
$$
is possible, but the paper uses $\lambda = 1$ through the summed losses [2508.09418].

## 3. Differentiation, optimization procedure, and computational profile

The exact meta-gradient differentiates through the unrolled inner loop:
$$
\nabla_\theta \Big[\sum_m \mathcal{L}_{GM}^{val}(\theta_m^{(S)}; \mathcal{D}_m^{val})\Big]
=
\sum_m
\left(\frac{\partial \theta_m^{(S)}}{\partial \theta}\right)^\top
\cdot
\nabla_{\theta_m^{(S)}}
\mathcal{L}_{GM}^{val}(\theta_m^{(S)}; \mathcal{D}_m^{val}),
$$
where $\partial \theta_m^{(S)} / \partial \theta$ depends on the inner-loop perturbations and on $\delta$ through $\mathcal{L}_{GM}^{train}$. A first-order approximation treats $\epsilon_m$ and $\epsilon$ as stop-gradient perturbations and ignores Hessian terms in $\partial \theta_m^{(S)} / \partial \theta$, yielding
$$
\nabla_\theta \mathcal{L}_{GM}^{val}(\theta_m^{(S)}; \cdot)
\approx
\nabla_{\theta_m^{(S)}} \mathcal{L}_{GM}^{val}(\theta_m^{(S)}; \cdot).
$$
The paper identifies this as the practical choice to match the computational profile of SharpMAML [2508.09418].

For practical differentiation of a generic $\mathcal{L}_{GM}$ term, let
$$
g(\theta; \mathcal{D}) := \nabla_\theta \mathcal{L}(\theta; \mathcal{D}),
$$
and define
$$
\tilde{\theta} := \theta + \epsilon - \delta g(\theta; \mathcal{D}).
$$
With stop-gradient on $\epsilon$ and $\delta g$, the gradient becomes
$$
\nabla_\theta \mathcal{L}_{GM}(\theta; \mathcal{D})
\approx
g(\theta; \mathcal{D}) + \nabla_\theta \mathcal{L}(\tilde{\theta}; \mathcal{D}),
$$
which requires two backward passes per evaluation, one for the unperturbed loss and one for the perturbed loss [2508.09418].

Per meta-iteration, the algorithm samples $M$ tasks and their train/validation splits. In the inner loop, it computes
$$
g_m^{train} = \nabla_\theta \mathcal{L}(\theta_t; \mathcal{D}_m^{train}),
$$
forms
$$
\epsilon_m = \alpha_l \cdot \frac{g_m^{train}}{\|g_m^{train}\|_2},
$$
constructs
$$
\mathcal{L}_{GM}^{train}(\theta_t; \mathcal{D}_m^{train})
=
\mathcal{L}(\theta_t; \mathcal{D}_m^{train})
+
\mathcal{L}(\theta_t + \epsilon_m - \delta g_m^{train}; \mathcal{D}_m^{train}),
$$
and performs one or more updates
$$
\theta_t \leftarrow \theta_t - \gamma \cdot \nabla_\theta \mathcal{L}_{GM}^{train}(\theta_t; \mathcal{D}_m^{train}).
$$
In the outer loop, it aggregates validation gradients at the perturbed inner points,
$$
G^{val}(\theta_t) = \sum_{m=1}^M \nabla_\theta \mathcal{L}(\theta_t + \epsilon_m; \mathcal{D}_m^{val}),
$$
sets
$$
\epsilon = \alpha_u \cdot \frac{G^{val}(\theta_t)}{\|G^{val}(\theta_t)\|_2},
$$
builds
$$
\mathcal{L}_{GM}^{val}(\theta_t; \mathcal{D}_m^{val})
=
\mathcal{L}(\theta_t; \mathcal{D}_m^{val})
+
\mathcal{L}\big(\theta_t + \epsilon - \delta \nabla_\theta \mathcal{L}(\theta_t; \mathcal{D}_m^{val}); \mathcal{D}_m^{val}\big),
$$
and applies the meta-update
$$
\theta_{t+1}
=
\theta_t
-
\gamma \cdot \nabla_\theta
\Big[
\sum_{m=1}^M \mathcal{L}_{GM}^{val}(\theta_t; \mathcal{D}_m^{val})
\Big].
$$

Relative to MAML, the computational overhead is limited. SAM requires two forward/backward passes per update, and DGS-MAML uses two passes because $\mathcal{L}_{GM}$ sums unperturbed and perturbed losses, while reusing the unperturbed gradient. The paper reports comparable per-epoch runtimes: on Mini-ImageNet, 60–70s for DGS-MAML versus 60–65s for SharpMAML, and on Omniglot, 60–70s for both at batch size 100. The memory footprint is near SharpMAML in the first-order implementation, whereas second-order differentiation increases memory proportional to $S$ inner steps [2508.09418].

The hyperparameters are $\gamma$ for both inner and outer updates, $\alpha_l$ and $\alpha_u$ as inner and outer SAM radii, $\delta$ for displacement along the empirical gradient, $S$ inner adaptation steps, meta-batch and task-split batch sizes, the episode distribution $p(\mathcal{T})$ for $N$-way $K$-shot configurations, initialization $\theta_0$, and the optimizer. The experiments use Adam and learning rates $\{0.1, 0.01, 0.001\}$ [2508.09418].

## 4. Theoretical analysis

The PAC-Bayes analysis is stated for a data-independent prior $P$ over initializations and a posterior $Q$ over $\theta$ after meta-training. Let $K$ be the number of tasks in meta-training, $\psi \in (0,1)$ the confidence, and assume a bounded loss $0 \le \mathcal{L}(h; \mathcal{D}) \le 1$ together with $U$-uniform stability. Then, with probability at least $1 - \psi$,
$$
\mathbb{E}_{\mathcal{D} \sim S} \mathbb{E}_{\theta \sim Q}
\big[
\mathcal{L}(h_{A(\theta; \mathcal{D})}, \mathcal{D})
\big]
\le
\frac{1}{K}
\sum_{i=1}^K
\mathbb{E}_{\theta \sim Q}
\big[
\mathcal{L}(h_{A(\theta; \mathcal{D}_i)}, \mathcal{D}_i)
\big]
+
\sqrt{
\frac{
KL(Q \| P) + \ln( 2 \sqrt{K} / \psi )
}{
2K
}
}
+ U.
$$
Uniform stability is defined as follows: for any datasets $D$ and $D'$ differing by one element,
$$
\mathbb{E}_{\theta \sim P}
\left|
\mathcal{L}(h_{A(\theta; D)}; s) -
\mathcal{L}(h_{A(\theta; D')}; s)
\right|
\le U,
\quad \forall s \in S.
$$
This is presented as Theorem 3 and Definition 1 in the paper [2508.09418].

To capture SAM and gradient matching, the paper takes
$$
P = \mathcal{N}(0, \sigma_p^2 I), \qquad
Q = \mathcal{N}(\hat{\theta}, (\alpha^2 + \delta^2) I),
$$
where $\hat{\theta}$ is a local minimizer learned by DGS-MAML. The resulting Kullback–Leibler divergence is
$$
KL(Q \| P)
=
\frac{1}{2}
\left[
\frac{(\alpha^2 + \delta^2)d + \|\hat{\theta}\|_2^2}{\sigma_p^2}
- d
+ d \ln\!\left(\frac{\sigma_p^2}{\alpha^2 + \delta^2}\right)
\right].
$$
Ensuring $KL > 0$ requires
$$
\sigma_p^2 \ge e(\alpha^2 + \delta^2).
$$
The paper states that, whereas the SharpMAML bound depends on $\alpha$, in DGS-MAML the parameter $\delta$ further regularizes the posterior dispersion, reflecting robustness to gradient displacement, and tightens the generalization bound compared to SharpMAML empirically and in this PAC-Bayes construct [2508.09418].

The convergence analysis assumes: (A1) $L$-smoothness, meaning $\nabla \mathcal{L}$ is $L$-Lipschitz; (A2) bounded stochastic gradients, with $\|\nabla \mathcal{L}(\theta_t; \mathcal{D}_m)\|_\infty \le C$ and hence $\|\nabla \mathcal{L}(\theta_t; \cdot)\|_2 \le C \sqrt{d}$; and (A3) unbiasedness and bounded variance of stochastic gradients in the bi-level setting, with variances $\sigma_1^2$ and $\sigma_2^2$ for the unperturbed and perturbed gradients [2508.09418].

Defining
$$
k := C \sqrt{d}\left(1 + \frac{\alpha}{C \sqrt{d} - \delta}\right),
$$
the single-level SAGM convergence result gives, for fixed step size $\gamma$,
$$
\frac{1}{T}\sum_{t=0}^{T-1}\|\nabla \mathcal{L}(\theta_t)\|_2^2
\le
\frac{\mathcal{L}(\theta_0)-\mathcal{L}(\theta)^*}{T}
+
\frac{1}{T}
\left[
\gamma C \sqrt{d} k
+
(\gamma^2 L + \gamma) C^2 d
+
\gamma^2 L k^2
-
\frac{\gamma^2 L}{2}
\big(k^2 + C^2 d - 2kC\sqrt{d}\big)
\right].
$$
Corollary 1 states that choosing $\alpha$, $\delta$, and $\gamma = \mathcal{O}(1/\sqrt{T})$ yields an average stationarity rate $\mathcal{O}(1/T)$, improving over the $\mathcal{O}(1/\sqrt{T})$ rate reported for SharpMAML [2508.09418].

For bi-level DGS-MAML, under (A1)–(A3), fixed $\gamma$, and the same $k$,
$$
\frac{1}{T}\sum_{t=0}^{T-1}\mathbb{E}\|\tilde{\nabla}\mathcal{L}(\theta_t; \xi_m)\|_2^2
\le
\frac{\mathcal{L}(\theta_0)-\mathcal{L}^*}{T}
+
\frac{1}{T}
\left[
\gamma \big(C^2 d + \sigma_1^2 + \sqrt{(C^2 d + \sigma_1^2)(k^2 + \sigma_2^2)}\big)
\right.
$$
$$
\left.
+
L\gamma^2
\big(
C^2 d + \sigma_1^2 + k^2 + \sigma_2^2
+ 2\sqrt{(C^2 d + \sigma_1^2)(k^2 + \sigma_2^2)}
\big)
\right].
$$
Corollary 2 states that with $\alpha$, $\delta$, and $\gamma = \mathcal{O}(1/\sqrt{T})$, the average stationarity rate is again $\mathcal{O}(1/T)$, and the inner loop does not degrade the asymptotic rate relative to single-level SAGM [2508.09418].

## 5. Experimental evaluation

The empirical study uses a Conv-4 backbone consisting of 4 blocks of $3 \times 3$ convolution with 64 filters, batch normalization, ReLU, and $2 \times 2$ max-pooling [2508.09418]. The datasets are Mini-ImageNet with a 64/12/24 train/val/test split, Omniglot following the Matching Networks splits, and MultiDigitMNIST through DoubleMNIST and TripleMNIST, with DoubleMNIST split 640/200/160 and TripleMNIST split 64/16/20. Evaluation is performed in $N$-way $K$-shot episodic classification on held-out query sets. The paper describes domain generalization here in terms of cross-dataset diversity and robustness to perturbations through SAM and gradient matching; explicit DG benchmarks such as PACS and VLCS are not included [2508.09418].

The baselines include gradient-based meta-learning methods MAML and SharpMAML, other meta-learners ANIL, REPTILE, and CAVIA, metric-based few-shot methods Matching Networks and Prototypical Networks, and SharpMAML variants with $\alpha \in \{0.005, 0.05\}$ [2508.09418].

The strongest gains are reported on Mini-ImageNet. For 5-way 1-shot, the accuracies are Matching Nets 0.4033, ProtoNet 0.4390, MAML 0.4463, SharpMAML $(\alpha = 0.05)$ 0.4509, and DGS-MAML $(\alpha = 0.05, \delta = 2.0)$ 0.4665, corresponding to gains of +2.02 percentage points over MAML and +1.56 over SharpMAML. For 5-way 5-shot, MAML reaches 0.5729, SharpMAML $(\alpha = 0.05)$ reaches 0.5759, and DGS-MAML $(\alpha = 0.05, \delta = 0.01)$ reaches 0.6360, a gain of +6.31 over MAML and +6.01 over SharpMAML. For 10-way 1-shot, MAML reaches 0.2160, SharpMAML reaches 0.2703–0.2740, and DGS-MAML $(\alpha = 0.05, \delta = 0.1)$ reaches 0.2882, with gains of +7.22 over MAML and +1.42 over the best SharpMAML. For 10-way 5-shot, MAML reaches 0.3621, SharpMAML reaches 0.3846–0.3899, and DGS-MAML reaches 0.4213–0.4264, for gains of +6.43 over MAML and up to +3.65 over SharpMAML [2508.09418].

| Setting | Baseline range | Best DGS-MAML |
|---|---:|---:|
| Mini-ImageNet 5-way 1-shot | MAML 0.4463; SharpMAML 0.4509 | 0.4665 |
| Mini-ImageNet 5-way 5-shot | MAML 0.5729; SharpMAML 0.5759 | 0.6360 |
| Mini-ImageNet 10-way 1-shot | MAML 0.2160; SharpMAML 0.2703–0.2740 | 0.2882 |
| Mini-ImageNet 10-way 5-shot | MAML 0.3621; SharpMAML 0.3846–0.3899 | 0.4213–0.4264 |

On Omniglot in the 20-way regime, MAML achieves 0.8884 for 1-shot and 0.9571 for 5-shot, while DGS-MAML reaches up to 0.8982 for 1-shot with $(\alpha = 0.005, \delta = 0.1)$ and up to 0.9604 for 5-shot with $(\alpha = 0.05, \delta = 0.1)$. On TripleMNIST and DoubleMNIST, the reported improvements are modest but consistent; one example is TripleMNIST 1-shot, where MAML attains 0.9017 and DGS-MAML $(\alpha = 0.05, \delta = 0.1)$ attains 0.9171 [2508.09418].

The ablation results identify $\delta$ as crucial. On Mini-ImageNet 5-way 5-shot, $\delta = 0.01$ yields 0.6360 accuracy, while other values from 0.002 to 0.008 are inferior, with results in the range 0.613–0.625. For Mini-ImageNet 5-way 1-shot, $\delta = 2.0$ performs best in the tuning table with 0.4651, while the reported best run reaches 0.4665. In the experiments, $\alpha_l$ and $\alpha_u$ are set equal, and the best general performance is reported at $\alpha = 0.05$ [2508.09418].

The paper states that improvements are strongest where baseline accuracy is lower, especially on Mini-ImageNet, indicating better robustness to harder episodes. At the same time, explicit OOD or domain-shift metrics such as calibration are not provided. Training uses Adam, Torchmeta for episode generation, and the learning rates $\{0.1, 0.01, 0.001\}$. Seeds and statistical tests are not reported, and mean $\pm$ standard deviation values are not provided [2508.09418].

## 6. Practical use, relation to prior work, and limitations

The paper positions DGS-MAML for few-shot adaptation under potential domain shift or noisy episodes, especially when flat minima and robustness to perturbations matter, such as in diverse image domains [2508.09418]. It recommends starting from $\alpha_l = \alpha_u \approx 0.05$, tuning $\delta$ carefully per dataset, and using 1–5 inner steps $S$ with first-order differentiation to control memory. The suggested test-time protocol follows standard MAML adaptation: adapt $\theta$ to each target task using a few inner steps on the target support set, with the DGS-MAML SAM-plus-gradient-matching inner loop carried over at test time [2508.09418].

Several practical pitfalls are explicitly noted. If $\delta$ is too large, updates can become misaligned; if $\delta$ is too small, the surrogate gap may not be reduced, so a sweep is advised. If $\alpha$ is too large, the perturbation may be excessive; if it is too small, the SAM effect is reduced. The paper therefore recommends balancing $\alpha$ and $\delta$ jointly. When second-order meta-gradients are used, memory should be monitored; otherwise, first-order differentiation is preferred [2508.09418].

In relation to prior work, DGS-MAML is described as extending MAML, which performs bi-level gradient-based meta-learning without explicit flatness control, and SharpMAML, which applies SAM in both loops. It also imports the gradient-alignment perspective of SAGM and GSAM into meta-learning by using the sum of empirical and perturbed losses to implicitly match gradients in both loops. Relative to domain generalization frameworks such as IRM, VRM, and DANN, DGS-MAML does not impose invariances across source domains directly; instead, it enforces local invariance in parameter space via SAM and gradient alignment, which the paper describes as complementary to domain-invariance penalties [2508.09418].

The reported limitations are equally explicit. Benchmarks such as PACS, VLCS, and Office-Home are not included; statistical significance is not reported; and gains diminish on easier datasets with high baseline accuracy. This suggests that the strongest empirical case is currently on harder few-shot image benchmarks rather than on standard domain generalization suites. A plausible implication is that further evaluation on explicit DG benchmarks would be necessary to establish the method’s behavior outside the episodic regimes considered in the paper [2508.09418].

The implementation is released at `https://github.com/AIResearchTopics/DGSharpMAML`, with dependencies on PyTorch, Torchmeta, and a standard Python machine learning stack. The repository provides training and evaluation code for Mini-ImageNet, Omniglot, and MultiDigitMNIST, including the Conv-4 backbone and episodic sampling; the license is not specified in the paper [2508.09418].

Source: https://www.emergentmind.com/topics/dgs-maml