We have two distributions, $P$ and $Q$ such that $P$ is our input distribution and $Q$ is our target distribution. The formulation of $KL = \mathbb{E}_{P}\left[\log\frac{P}{Q}\right]$ allows us to approximate Q by minimising the expectation.
According to that formulation I've created a small experiment and below there are two plots, the first one is showing the distributions of $P$ and $Q$ after the first step of the optimisation, and the second plot again at the end of the optimisation process.
Here's a more detailed explanation of how the plots where generated.
Let $\theta\sim\mathcal{N}(0, 1)$ be the parameters of interest and $Q\sim\text{softmax}(\mathcal{N}(-2.3, 1.45))$ be our target distribution.
Suppose $X\sim\mathcal{N}(2, 1.3)$ is our data and $P = \text{softmax}(\theta^{T}X)$ is our likelihood.
Then to compute the KL $\sum_{i}^{n}P_{i}*\log(\frac{P_{i}}{Q_{i}})$ loss and thus our goal is to minimise $\hat{\theta} = \arg\max_{\theta}KL$.
Running the optimisation process for 1000 steps we have the following loss
My question is the following, it seems like the approximation in the beginning and end of optimisation isn't so good in this toy example, why is that ?