# Implement gaussian mixture model with stochastic variational inference

I am trying to implement Gaussian Mixture model with stochastic variational inference, following this paper.

This is the pgm of Gaussian Mixture.

According to the paper, the full algorithm of stochastic variational inference is:

And I am still very confused of the method to scale it to GMM.

First, I thought the local variational parameter is just $q_z$ and others are all global parameters. Please correct me if I was wrong. What does the step 6 mean by as though Xi is replicated by N times? What am I supposed to do to achieve this?