Bringing UMAP Closer to the Speed of Light with GPU Acceleration

Corey J. Nolet, Victor Lafargue, Edward Raff, Thejaswi Nanditale, Tim Oates, John Zedlewski, Joshua Patterson

Abstract

Uniform Manifold Approximation and Projection (UMAP) has largely overtaken t-SNE as the preferred algorithm for dimensionality reduction and high-dimensional data visualization. However, as datasets scale to millions of samples, UMAP's CPU execution time becomes a significant bottleneck for interactive exploration. This paper details a GPU-native redesign of UMAP, now part of the RAPIDS cuML library, which achieves up to 100x speedups over standard CPU implementations. By addressing memory access patterns, kernel fusion, and race conditions, the implementation ensures that massive speed gains do not come at the cost of embedding quality.

Introduction

UMAP is widely used in fields such as single-cell genomics and natural language processing. Despite its popularity, existing GPU ports often fail to deliver performance or accuracy. For instance, the GPUMAP library, a naive translation of Python code, suffered from inefficient memory access and race conditions that degraded embedding quality. We address these challenges by completely redesigning UMAP for the GPU using C++/CUDA, focusing on hardware-aware optimizations that maintain mathematical faithfulness to the original algorithm.

Methods

The cuML implementation focuses on several key GPU-specific optimizations:

  • Zero-Copy Data Transfer: Utilizing standard array interfaces like DLPack to avoid the latency of host-to-device data copying.
  • Optimized k-NN Search: Integration of the FAISS library for exact k-Nearest Neighbors searches performed entirely on the GPU.
  • Kernel Fusion & Register Caching: Fusing multiple operations into single CUDA kernels to keep data in ultra-fast local registers, resulting in a 12-15x speedup for adaptive smoothing.
  • Gradient Accumulation: To solve the "Hogwild" problem of race conditions during stochastic gradient descent, we use shared memory as a local cache for gradient updates, applying them to global memory via atomic writes.
  • Distributed Inference: A multi-GPU pipeline using Dask and GPUDirect RDMA for embedding massive out-of-sample datasets.

Results and Discussion

The evaluation of cuML UMAP across standard benchmarks (MNIST, CIFAR-100) and real-world genomics data (scRNA) demonstrates significant performance leaps.

Execution time comparison between cuML UMAP and UMAP-learn across varying data sample sizes.

As shown in the scaling analysis above, cuML UMAP maintains a significant performance advantage as data samples increase, finishing the 3-million-sample GoogleNews dataset in under 10 minutes—a task that takes hours on a CPU.

Performance and trustworthiness comparison across various datasets, showing cuML UMAP's speed and accuracy.

Beyond raw speed, the implementation maintains high "trustworthiness" scores, often exceeding those of prior GPU attempts. For example, on the scRNA dataset, cuML UMAP achieved a trustworthiness of 97.81% in roughly 4 seconds, compared to over 200 seconds for the standard CPU version. The implementation is significantly faster even on small datasets (e.g., 2,000 samples), removing the need for users to guess if their data is "big enough" for GPU acceleration.

Conclusion

The cuML implementation of UMAP proves that GPU acceleration, when done with hardware-aware precision, can transform dimensionality reduction from a batch process into an interactive one. Future work will focus on scaling the k-NN search beyond quadratic limits and applying these shared-memory caching strategies to other machine learning algorithms like word2vec.

Summary updated

BibTeX
@inproceedings{nolet2021bringing,
  author = {Corey J. Nolet and Victor Lafargue and Edward Raff and Thejaswi Nanditale and Tim Oates and John Zedlewski and Joshua Patterson},
  title = {{Bringing UMAP Closer to the Speed of Light with GPU Acceleration}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i1.16118},
}
Figure