Skip to content

Conversation

lowener
Copy link
Contributor

@lowener lowener commented Aug 23, 2025

Related issue: #107

This PR adds support for a PQ preprocessing API. It gives access to train() and transform() function that can be used to transform a dataset into PQ codes. It is re-using the VPQ functions from CAGRA-Q.

Signed-off-by: Mickael Ide <mide@nvidia.com>
Copy link

copy-pr-bot bot commented Aug 23, 2025

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@lowener lowener added feature request New feature or request non-breaking Introduces a non-breaking change C++ labels Aug 25, 2025
@@ -0,0 +1,164 @@
/*
* Copyright (c) 2024-2025, NVIDIA CORPORATION.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please only include the current year in new files

Signed-off-by: Mickael Ide <mide@nvidia.com>
pq_params.add_data_on_build = false;
pq_params.max_train_points_per_pq_code = params.max_train_points_per_pq_code;

auto pq_index = cuvs::neighbors::ivf_pq::build(res, pq_params, dataset);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried using ivf build + pq-centeres api to get the generated centroids as part of generating pq for diskann. It appears I get significant lower recall values. I think it because the pq strategy used by ivf has 2 quantizers and also ivf uses balanced kmeans which can lower the recall.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my understanding, the current VPQ also has two quantizers. @lowener correct me if I am missing something, but based on what I had seen in DiskANN, the raw vectors are PQ quantized directly, there is no coarse quantizer (VQ centroids).

Signed-off-by: Mickael Ide <mide@nvidia.com>
Signed-off-by: Mickael Ide <mide@nvidia.com>
Signed-off-by: Mickael Ide <mide@nvidia.com>
Signed-off-by: Mickael Ide <mide@nvidia.com>
Signed-off-by: Mickael Ide <mide@nvidia.com>
@lowener lowener marked this pull request as ready for review September 24, 2025 16:09
@lowener lowener requested review from a team as code owners September 24, 2025 16:09
Copy link
Member

@KyleFromNVIDIA KyleFromNVIDIA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved trivial CMake changes

Signed-off-by: Mickael Ide <mide@nvidia.com>
@lowener lowener requested a review from a team as a code owner September 26, 2025 13:52
Signed-off-by: Mickael Ide <mide@nvidia.com>
Signed-off-by: Mickael Ide <mide@nvidia.com>
@lowener lowener requested a review from a team as a code owner September 29, 2025 17:08
Signed-off-by: Mickael Ide <mide@nvidia.com>
Signed-off-by: Mickael Ide <mide@nvidia.com>
Signed-off-by: Mickael Ide <mide@nvidia.com>
Signed-off-by: Mickael Ide <mide@nvidia.com>
@lowener lowener changed the base branch from branch-25.10 to branch-25.12 October 6, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ feature request New feature or request non-breaking Introduces a non-breaking change
Projects
Development

Successfully merging this pull request may close these issues.

5 participants