ML0094 GMM vs K-Means

How does Gaussian Mixture Model clustering differ from k-means, and why do production systems like speaker diarization prefer soft assignments?

Answer

A Gaussian Mixture Model is a probabilistic clustering model that represents the data as a weighted sum of K Gaussian distributions, each with its own mean, covariance, and mixing weight. Where k-means assigns each point to exactly one cluster (hard assignment) by nearest centroid, a GMM assigns each point a responsibility (posterior probability) for each cluster (soft assignment), so a point on the boundary between two clusters can be 60% in one and 40% in another. K-means is the limiting case of a GMM with shared spherical covariances as that shared variance goes to zero, which collapses the E-step posterior to an argmax. The GMM is fit by Expectation-Maximization: the E-step computes responsibilities, the M-step updates means, covariances, and mixing weights, iterating until convergence. Production systems use GMMs where uncertainty matters: joint diarization and separation systems pair a complex Angular Central Gaussian Mixture Model for source separation with a von Mises-Fisher mixture for diarization, so overlapping speech can be attributed to multiple speakers at once, and Flash-GMM (2026) made GMM training viable at 100x larger scale via fused Triton kernels.

(1) Hard vs Soft Assignment: k-means assigns each point to one centroid (argmin distance); GMM assigns a probability vector (responsibilities) across all clusters, so border points express uncertainty instead of being forced into one group.
(2) Spherical vs Elliptical Clusters: k-means assumes spherical, equally sized clusters (isotropic variance); GMM allows each cluster to have its own full covariance matrix, capturing elliptical and differently sized clusters.
(3) Production Soft Clustering: speaker diarization uses cACGMM and vMFMM mixture models so frame-level embeddings can belong to multiple speakers during overlap, and Flash-GMM’s fused Triton kernel achieved 20x speedup and 100x larger dataset scale, making soft GMM clustering a viable drop-in for k-means in approximate nearest-neighbor search with 2-12 point recall@10 gains.

Two panels: left shows k-means hard assignment with Voronoi boundaries and each point colored as one cluster; right shows GMM soft assignment with elliptical cluster contours and a border point labeled with 60/40 responsibility split

Figure 1: k-means forces each point into one cluster via nearest-centroid (hard assignment with spherical Voronoi cells), while a GMM assigns posterior probabilities (soft assignment) and can model elliptical clusters with per-component covariance matrices.

The EM algorithm for GMMs iterates two steps. In the E-step, each point’s responsibility for cluster k is computed as the posterior \gamma_{ik} = \pi_k \mathcal{N}(x_i \mid \mu_k, \Sigma_k) / \sum_j \pi_j \mathcal{N}(x_i \mid \mu_j, \Sigma_j). In the M-step, the parameters are updated: the mean is the responsibility-weighted average, the covariance is the responsibility-weighted scatter, and the mixing weight is the average responsibility. Each iteration is guaranteed never to decrease the log-likelihood, but it converges only to a local optimum, so multiple random restarts are standard. The key trade-off versus k-means is cost: k-means is O(nKd) per iteration with a simple distance computation, while GMM is O(nKd^2) per iteration because of the multivariate Gaussian PDF with full covariance, plus the matrix inversion in the PDF. Flash-GMM (2026) addressed this by eliminating the full responsibility matrix from GPU memory, reducing memory from O(nK) to O(KD) and enabling 100x larger datasets on a single GPU.

EM iteration flow: E-step computes responsibilities as posterior probabilities from current parameters, M-step updates means, covariances, and mixing weights from weighted statistics, with an arrow looping back to E-step until convergence

Figure 2: The EM loop for GMMs: the E-step computes soft responsibilities from current parameters, the M-step updates means, covariances, and mixing weights from responsibility-weighted statistics, and the cycle repeats until log-likelihood converges.

Mathematical Formulation:
p(x) = \sum_{k=1}^{K} \pi_k\, \mathcal{N}(x \mid \mu_k, \Sigma_k)
\gamma_{ik} = \frac{\pi_k\, \mathcal{N}(x_i \mid \mu_k, \Sigma_k)}{\sum_{j=1}^{K} \pi_j\, \mathcal{N}(x_i \mid \mu_j, \Sigma_j)}
\mu_k = \frac{\sum_i \gamma_{ik}\, x_i}{\sum_i \gamma_{ik}},\quad \Sigma_k = \frac{\sum_i \gamma_{ik}\,(x_i - \mu_k)(x_i - \mu_k)^\top}{\sum_i \gamma_{ik}}

Where:

  • \pi_k is the mixing weight of cluster k (prior probability, sums to 1), \mu_k is its mean, and \Sigma_k is its covariance matrix.
  • \gamma_{ik} is the responsibility of cluster k for point i: the posterior probability that point i was generated by component k. This is the soft assignment that k-means replaces with a hard argmax.
  • The M-step updates are weighted by responsibilities: \mu_k is the responsibility-weighted mean, \Sigma_k is the responsibility-weighted covariance, and \pi_k = \frac{1}{n}\sum_i \gamma_{ik} is the average responsibility. k-means is the limit when all \Sigma_k = \sigma^2 I and \sigma \to 0, collapsing responsibilities to 0 or 1.
Propertyk-meansGMM
AssignmentHard (argmin distance)Soft (posterior responsibilities)
Cluster ShapeSpherical, equal varianceElliptical, per-component covariance
ObjectiveMinimize within-cluster SSEMaximize log-likelihood
Cost per IterationO(nKd)O(nKd^2) with full covariance
Production UseVector quantization, image compressionSpeaker diarization (cACGMM), ANN search (Flash-GMM)

Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *