Flash-GMM: A Memory-Efficient Kernel for Scalable Soft Clustering

Gal Bloch, Ariel Gera, Matan Orbach, Ohad Eytan, Assaf ToledoarXiv 2026

TL;DR

Flash-GMM introduces a memory-efficient, fused Triton kernel that scales Gaussian Mixture Model (GMM) training to datasets 100× larger than previously possible on a single GPU while delivering a 20× speedup. By eliminating the need to store a massive intermediate matrix in GPU memory, it makes soft clustering a viable, high-performance drop-in replacement for $k$-means in large-scale vector search.

What Problem Does This Paper Address?

Gaussian Mixture Models (GMMs) are powerful probabilistic tools for soft clustering because they assign continuous probabilities (responsibilities) rather than hard labels to data points. However, standard Expectation-Maximization (EM) training requires materializing an $N \times K$ responsibility matrix (where $N$ is the number of data points and $K$ is the number of clusters).

For a modest dataset of 10 million vectors and 2,048 clusters, this matrix alone consumes around 80 GB of memory, instantly causing Out-Of-Memory (OOM) errors on most modern GPUs. While CPU-based alternatives avoid this memory ceiling, they are orders of magnitude too slow for production scales. This memory bottleneck has effectively locked GMMs out of large-scale applications like Approximate Nearest Neighbor (ANN) search, forcing the industry to rely on less flexible hard-clustering methods like $k$-means.

Methods

The authors introduce Flash-GMM, a tile-based, IO-aware GPU kernel implemented in Triton. Inspired by the tiling strategy of FlashAttention, Flash-GMM breaks the input data matrix into small, contiguous blocks.

Crucially, the kernel computes the log-likelihoods and normalizes them entirely on-chip using a numerically stable online log-sum-exp algorithm. Instead of writing the massive $N \times K$ responsibility matrix back to the GPU's main memory (HBM), the kernel keeps intermediate values in registers and SRAM, directly accumulating the per-tile sufficient statistics needed for the M-step. This reduces peak memory consumption from $O(NK)$ to $O(KD)$, making memory usage independent of the dataset size $N$.

Additionally, they leverage Flash-GMM for Inverted File (IVF) indexing in ANN search by introducing a GMM Multi-Assignment strategy. If a data point lies near a cluster boundary (i.e., its responsibility exceeds a uniform prior threshold $\tau = 1/K$), it is indexed into multiple posting lists, preventing boundary vectors from being prematurely discarded during queries.

Datasets

The method was evaluated on three standard vector search benchmarks:

  • SIFT1M: 1 million SIFT descriptors ($D=128$).
  • Deep10M: 10 million vectors from the deep-image-96 dataset ($D=96$).
  • GloVe-100: 1.18 million GloVe word embeddings ($D=100$).

Key Insights and Ideas

  • The Memory Bottleneck is an IO Problem: Just like attention matrices in Transformers, the bottleneck in GMMs isn't compute—it's the memory bandwidth wasted by round-tripping a massive intermediate matrix to HBM. Fusing the E and M steps into a single pass completely bypasses this issue.
  • Soft Boundaries Matter for Vector Search: Hard $k$-means forces ambiguous vectors near cluster boundaries into a single arbitrary cluster. GMMs naturally quantify this ambiguity, allowing a principled, data-driven approach to multi-assignment that significantly boosts search recall.
  • Orthogonality to Quantization: The benefits of soft clustering are orthogonal to downstream compression techniques like Product Quantization (PQ), meaning it can be dropped into existing high-performance vector search pipelines without modification.

Key Results

  • Speed & Scale: Flash-GMM achieves a 19–32× speedup over TorchGMM and is up to 1,782× faster than CPU-based SciPy. While TorchGMM crashes (OOM) at $N > 1\text{M}$, Flash-GMM easily scales to $N = 10^8$ vectors on the same A100 GPU.
Flash-GMM Runtime Comparison
  • Memory Footprint: At $1\text{M}$ data points, TorchGMM requires 21 GB of memory, whereas Flash-GMM requires only 4.5 MB—a 4,668× reduction in kernel memory footprint.
  • Search Performance: When used for IVF indexing, GMM multi-assignment achieves the same recall targets with up to 1.7× fewer distance computations (DCO) than $k$-means, or provides a +2 to 12 point boost in recall@10 at an equivalent compute budget.
Figure 1: Recall@10 vs. DCO (K = 1024). Each point corresponds to one nprobe value. GMM multi dominates both baselines across the full latency budget. Dashed reference lines mark recall targets 0.90, 0.95, 0.99.

Limitations and Future Work

  • Training Overhead: Flash-GMM is still 2–3× slower than highly optimized hard $k$-means implementations (like FAISS). While this is an offline, one-time cost, it could impact applications requiring frequent re-indexing.
  • Index Inflation: Multi-assignment increases the final index size by 1.49× to 1.78× because boundary vectors are stored in multiple lists.
  • Isotropic Covariance: The current implementation is restricted to isotropic (scalar) covariance matrices. Full covariance matrices remain mathematically and computationally challenging at standard IVF scales due to underdetermined cluster fits.
  • Billion-Scale Streaming: For datasets larger than $N=10^8$, the raw input data exceeds single-GPU memory capacity. The authors suggest streaming chunks from SSDs directly to the kernel as a promising direction for future work.

Summary updated

BibTeX
@misc{bloch2026flash,
  author = {Gal Bloch and Ariel Gera and Matan Orbach and Ohad Eytan and Assaf Toledo},
  title = {{Flash-GMM: A Memory-Efficient Kernel for Scalable Soft Clustering}},
  year = {2026},
  eprint = {2606.10896},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.10896},
}
Figure