cuvs

NVIDIAApache-2.0活跃维护

基于 GPU 的向量检索与聚类库,为近似最近邻搜索和相似度计算提供 CUDA 加速,适合大规模向量数据和 LLM 检索场景。

cuVS - a library for vector search and clustering on the GPU

v26.10.00发布于 2026-10-08 01:23 UTC892star +2 / 7 天261fork同步于 2026-11-10 05:58 UTC

怎么上手

由 README 提炼,执行前请确认
conda install -c conda-forge cuvs
pip install cuvs
硬件要求按 README 说明

README 未说明具体显存要求与支持的 GPU 型号,仅说明在 GPU 上运行并依赖 NVIDIA CUDA 与 RAFT。

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

NVIDIA 的 GPU 向量检索与聚类库,用 GPU 加速近似最近邻搜索和聚类

基于 GPU 的向量检索与聚类库,为近似最近邻搜索和相似度计算提供 CUDA 加速,适合大规模向量数据和 LLM 检索场景。

核心能力

  • 在 GPU 上实现近似最近邻搜索与聚类算法
  • 提供 CAGRA 等高性能图索引的构建与搜索
  • 支持 Python、C++、C、Rust 多语言 API
  • 可在 GPU 上构建索引、在 CPU 上部署
  • 基于 RAFT 高性能机器学习原语构建

容易踩的坑

需按官方 Build and Install Guide 选择对应语言与 CUDA 版本的包;CUDA 13 与 CUDA 12 的二进制体积差异较大,体积敏感时可选静态链接的 libcuvs-static;示例中的 load_data 等函数需自行提供数据加载。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v26.10.00
  1. v26.10.00最新正式版2026-10-08 · 2026-10-08 01:23 UTC

    What's Changed

    🚨 Breaking Changes

    🐛 Bug Fixes

    📖 Documentation

    🚀 New Features

    • rust: expose cuvsVersionGet via safe Rust by @yan-za
  2. v26.08.012026-08-06 · 2026-08-06 17:52 UTC
    查看更新说明
  3. v26.08.002026-08-05 · 2026-08-05 19:38 UTC
    查看更新说明

    What's Changed

    🚨 Breaking Changes

    🐛 Bug Fixes

    📖 Documentation

  4. v26.06.002026-06-04 · 2026-06-04 00:21 UTC
    查看更新说明

    What's Changed

    🚨 Breaking Changes

    🐛 Bug Fixes

    📖 Documentation

  5. v26.04.002026-04-08 · 2026-04-08 19:23 UTC
    查看更新说明

    What's Changed

    🚨 Breaking Changes

    🐛 Bug Fixes

    📖 Documentation

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    cuVS: Vector Search and Clustering on the GPU

    Contents

    1. Useful Resources
    2. What is cuVS?
    3. Installing cuVS
    4. Getting Started
    5. Contributing
    6. References

    Useful Resources

    What is cuVS?

    cuVS contains state-of-the-art implementations of several algorithms for running approximate nearest neighbors and clustering on the GPU. It can be used directly or through the various databases and other libraries that have integrated it. The primary goal of cuVS is to simplify the use of GPUs for vector similarity search and clustering.

    Vector search is an information retrieval method that has been growing in popularity over the past few years, partly because of the rising importance of multimedia embeddings created from unstructured data and the need to perform semantic search on the embeddings to find items which are semantically similar to each other.

    Vector search is also used in data mining and machine learning tasks and comprises an important step in many clustering and visualization algorithms like UMAP, t-SNE, K-means, and HDBSCAN.

    Finally, faster vector search enables interactions between dense vectors and graphs. Converting a pile of dense vectors into nearest neighbors graphs unlocks the entire world of graph analysis algorithms, such as those found in GraphBLAS and cuGraph.

    Below are some common use-cases for vector search

    • Semantic search

      • Generative AI & Retrieval augmented generation (RAG)
      • Recommender systems
      • Computer vision
      • Image search
      • Text search
      • Audio search
      • Molecular search
      • Model training
    • Data mining

      • Clustering algorithms
      • Visualization algorithms
      • Sampling algorithms
      • Class balancing
      • Ensemble methods
      • k-NN graph construction

    Why cuVS?

    There are several benefits to using cuVS and GPUs for vector search, including

    1. Fast index build
    2. Latency critical and high throughput search
    3. Parameter tuning
    4. Cost savings
    5. Interoperability (build on GPU, deploy on CPU)
    6. Multiple language support
    7. Building blocks for composing new or accelerating existing algorithms

    In addition to the items above, cuVS shoulders the burden of keeping non-trivial accelerated code up to date as new NVIDIA architectures and CUDA versions are released. This provides a delightful development experience, guaranteeing that any libraries, databases, or applications built on top of it will always be getting the best performance and scale.

    cuVS Technology Stack

    cuVS is built on top of the NVIDIA RAFT library of high performance machine learning primitives and provides all the necessary routines for vector search and clustering on the GPU.

    cuVS is built on top of low-level CUDA libraries and provides many important routines that enable vector search and clustering on the GPU

    Installing cuVS

    cuVS comes with pre-built packages that can be installed through conda and pip or tarball. Different packages are available for the different languages supported by cuVS.

    [!NOTE] If compiled binary size is a concern, please note that the cuVS builds for CUDA 13 are roughly half the size of CUDA 12 builds. This is a result of improved compression rates in the newer supported CUDA drivers. We will be adopting the newer drivers for CUDA 12 builds in Spring of 2026, which will ultimately bring them down to roughly the size of the CUDA 13 builds. In the meantime, the NVIDIA cuVS team is continuing to shave down the binary sizes for all supported CUDA versions. If binary size is an issue for you, please consider linking to cuVS statically either by building from source or using pre-built libcuvs-static conda package.

    Please see the Build and Install Guide for more information on installing the available cuVS packages and building from source.

    Standalone C library (Docker)

    To build the standalone C library tarball (libcuvs_c.tar.gz) for use in your own C/C++ projects, see Building the standalone C library with Docker.

    Getting Started

    The following code snippets train an approximate nearest neighbors index for the CAGRA algorithm in the various different languages supported by cuVS.

    Python API

    from cuvs.neighbors import cagra
    
    dataset = load_data()
    index_params = cagra.IndexParams()
    
    index = cagra.build(index_params, dataset)
    

    C++ API

    #include <cuvs/neighbors/cagra.hpp>
    
    using namespace cuvs::neighbors;
    
    raft::device_matrix_view<float> dataset = load_dataset();
    raft::device_resources res;
    
    cagra::index_params index_params;
    
    auto index = cagra::build(res, index_params, dataset);
    

    For more code examples of the C++ APIs, including drop-in Cmake project templates, please refer to the C++ examples directory in the codebase.

    C API

    #include <cuvs/neighbors/cagra.h>
    
    cuvsResources_t res;
    cuvsCagraIndexParams_t index_params;
    cuvsCagraIndex_t index;
    
    DLManagedTensor *dataset;
    load_dataset(dataset);
    
    cuvsResourcesCreate(&res);
    cuvsCagraIndexParamsCreate(&index_params);
    cuvsCagraIndexCreate(&index);
    
    cuvsDataset_t dataset_view;
    cuvsDatasetMakeStandardView(res, dataset, &dataset_view);
    
    cuvsCagraBuild(res, index_params, dataset_view, index);
    
    cuvsDatasetDestroy(dataset_view);
    cuvsCagraIndexDestroy(index);
    cuvsCagraIndexParamsDestroy(index_params);
    cuvsResourcesDestroy(res);
    

    For more code examples of the C APIs, including drop-in Cmake project templates, please refer to the C examples

    Rust API

    use cuvs::distance::DistanceType;
    use cuvs::neighbors::cagra::{Index, IndexParams, SearchParams};
    use cuvs::{AsDlTensor, AsDlTensorMut, DLPackError, DLTensorView, DLTensorViewMut, Resources};
    
    // cuVS is agnostic about where your vectors live: `build` and `search` accept
    // any type implementing `AsDlTensor` (inputs) / `AsDlTensorMut` (outputs). Wrap
    // your own GPU buffer by implementing these traits. See `rust/cuvs/examples`
    // for a complete, runnable CUDA-backed implementation.
    struct GpuTensor;
    impl AsDlTensor for GpuTensor {
        fn as_dl_tensor(&self) -> Result<DLTensorView<'_>, DLPackError> {
            unimplemented!("wrap your device buffer; see rust/cuvs/examples")
        }
    }
    impl AsDlTensorMut for GpuTensor {
        fn as_dl_tensor_mut(&mut self) -> Result<DLTensorViewMut<'_>, DLPackError> {
            unimplemented!("wrap your device buffer; see rust/cuvs/examples")
        }
    }
    
    fn main() -> Result<(), Box<dyn std::error::Error>> {
        let res = Resources::new()?;
    
        // Build a CAGRA index over your dataset.
        let dataset = GpuTensor;
        let index_params = IndexParams::builder()
            .metric(DistanceType::L2Expanded)
            .graph_degree(64)
            .build()?;
        let index = Index::build(&res, &index_params, &dataset)?;
    
        // Search for the k nearest neighbors of each query, writing the results into
        // the neighbor and distance device buffers.
        let queries = GpuTensor;
        let (mut neighbors, mut distances) = (GpuTensor, GpuTensor);
        let search_params = SearchParams::builder().itopk_size(64).build()?;
        index.search(&res, &search_params, &queries, &mut neighbors, &mut distances)?;
    
        Ok(())
    }
    

    For more code examples of the Rust APIs, including a drop-in project templates, please refer to the Rust examples.

    Contributing

    If you are interested in contributing to the cuVS library, please read our Contributing guidelines. Refer to the Developer Guide for details on the developer guidelines, workflows, and principles.

    References

    For the interested reader, many of the accelerated implementations in cuVS are also based on research papers which can provide a lot more background. We also ask you to please cite the corresponding algorithms by referencing them in your own research.