# cuVS

> GPU-accelerated vector search and clustering from RAPIDS

- Category: Retrieval & Knowledge (RAG) / Vector Databases
- Language: C++
- Repository: https://github.com/NVIDIA/cuvs
- Website: https://docs.nvidia.com/cuvs
- Canonical page: https://ai-tldr.dev/tools/cuvs/

## In short

cuVS is a RAPIDS library that runs approximate nearest neighbor (ANN) search and clustering on NVIDIA GPUs. It implements algorithms such as CAGRA for vector similarity search, and you can call it directly or use it through databases and libraries that have integrated it. It sits in the Vector Databases category of the Retrieval & Knowledge (RAG) tools and is open-source, written in C++.

## Overview

cuVS is a RAPIDS library that runs approximate nearest neighbor (ANN) search and clustering on NVIDIA GPUs. It implements algorithms such as CAGRA for vector similarity search, and you can call it directly or use it through databases and libraries that have integrated it.

It targets developers who need fast index builds and low-latency or high-throughput vector search, as well as people doing data mining tasks like clustering, k-NN graph construction, and visualization (UMAP, t-SNE, K-means, HDBSCAN). One stated goal is interoperability: build an index on the GPU and deploy it on the CPU.

As an embedded, in-process vector engine, cuVS gives you the building blocks for similarity search rather than a standalone server. It is built on top of the RAPIDS RAFT library and offers Python, C++, and C APIs so it can be embedded into other tools and pipelines.

## What it does

- Approximate nearest neighbor search on the GPU, including the CAGRA graph-based algorithm
- Clustering and k-NN graph construction for data mining and visualization workflows
- Fast index build plus latency-critical and high-throughput search
- Interoperability: build an index on the GPU and deploy it on the CPU
- Python, C++, and C APIs for embedding into other libraries and databases
- Built on the RAPIDS RAFT library of GPU machine learning primitives

## Getting started

cuVS ships pre-built packages for conda and pip; the snippet below builds a CAGRA approximate nearest neighbors index with the Python API.

1. Install cuVS

   cuVS provides pre-built packages through conda and pip (and tarball). See the Build and Install Guide for the package that matches your CUDA version and language.

```bash
pip install cuvs
```

2. Build a CAGRA index in Python

   Load your dataset, set the index parameters, and call cagra.build to train an approximate nearest neighbors index.

```python
from cuvs.neighbors import cagra

dataset = load_data()
index_params = cagra.IndexParams()

index = cagra.build(index_params, dataset)
```

## When to use it

- Add GPU-accelerated semantic search to a RAG or recommender pipeline over embeddings
- Embed GPU vector search inside an existing vector database or application via the C/C++/Python APIs
- Build k-NN graphs to feed clustering and visualization algorithms like UMAP, t-SNE, or HDBSCAN
- Build an index on the GPU and deploy search on the CPU when GPUs are not available at serving time
