# Why do we use $q_{\phi}(z \mid x^{(i)})$ in the objective function of amortized variational inference, while sometimes we use $q(z)$?

In page 21 here, it states:

General Idea of Amortization: if same inference problem needs to be solved many times, can we parameterize a neural network to solve it?

Our case: for all $$x^{(i)}$$ we want to solve: $$\min _{q(z)} \mathrm{KL}\left(q(z) \| p_{\theta}\left(z \mid x^{(i)}\right)\right.$$ Amortized formulation: $$\min _{\phi} \sum \operatorname{KL}\left(q_{\phi}\left(z \mid x^{(i)}\right) \| p_{\theta}\left(z \mid x^{(i)}\right)\right)$$

One thing I am trying to wrap my mind around is $$q(z)$$ in the 1st formulation vs $$q_{\phi}(z \mid x^{(i)})$$ in the second.

Why is one a conditioned on $$x^{(i)}$$ and the other is not? I know in the 1st formulation, we are trying to find a different $$q(z)$$ for each datapoint.

I also recall that in VAEs,which uses amortized inference we consider $$q(z)$$ to be aggregated posterior, like

$$q_{\phi}(z)=\int q_{\phi}(x, z) d x \quad \text { Marginal of } q_{\phi}(x, z) \text { on } z$$

$$q_{\phi}(x, z) \equiv p_{\mathcal{D}}(x) q_{\phi}(z \mid x)$$

(formulas taken from here)