How to differentiate through the optimization process in Model-Agnostic Meta-Learning? I'm reading the paper introducing Model-Agnostic Meta-Learning (MAML). 
As far as I understood, there is a nested optimization process in MAML. Given a task $\tau_i$ sampled from distribution $p(\tau)$, the model parameter $\theta$ will be updated by
$$\theta_i^{'} = \theta - \alpha \nabla_{\theta} \mathcal L_{\tau_i}(f_{\theta})$$
to get $\theta_i^{'}$ (subscript $i$ indicates we are using the $i \text{-th}$ task for training). 
After every $\theta_i^{'}$ is obtained, we need to minimize the meta-objective 
$$\sum_{\tau_i \sim p(\tau)} \mathcal L_{\tau_i}(f(\theta_i^{'}))$$
by using SGD
$$\theta = \theta - \beta \nabla_{\theta}\sum_{\tau_i \sim p(\tau)}\mathcal L_{\tau_i}(f(\theta_i^{'}))$$
How the gradient is taken w.r.t a set of optimized parameters? Are there some simple examples I can calculate by hand to gain some intuition? 
 A: The optimized parameters are differentiable with respect to the original set of parameters, so there's no problem with gradient descent. Here's an example.
Suppose we are trying to run MAML on two objectives: $\mathcal{L}_1(x) = x^2$ and $\mathcal{L}_2(x) = (x-1)^2$. Also suppose we have a very simple model $f(x) = x$. And suppose $x_0 = 7$. Then the update is 
$$
\begin{align}
x &= x - \beta \nabla_x \sum_i \mathcal{L}_{i} ( f(x'_i)) \\
&= \beta\nabla_x x_1'^2 + \beta\nabla_x (x_2'-1)^2 \\
\end{align}$$
Now $x'_1 = x - \alpha\nabla_x \mathcal{L}(x) = (1 - 2\alpha) x$. Similarly $x_2' = (1 - 2\alpha) x + 2\alpha$. So we plug these back in for:
$$
\begin{align}
& \quad \ \beta\nabla_x x_1'^2 + \beta\nabla_x (x_2'-1)^2 \\
&= \beta\nabla_x ((1 - 2\alpha) x)^2 + \beta\nabla_x ((1 - 2\alpha) x + 2\alpha-1)^2 \\
&= 2\beta x(1-2\alpha)^2 + 2\beta (1-2\alpha)^2(x-1) \\
&= 2\beta (1-2\alpha)^2 (2x-1) \\
&= 26 \beta(1-2\alpha)^2
\end{align}$$
So assuming $\alpha = \beta = 0.1$, $x_1 = x_0 - 26 \cdot 0.1 ( 1-2\cdot 0.1)^2 = 5.336$
