Skip to content

Add CAGRA build heuristics independent of HNSW parameters#2345

Open
achirkin wants to merge 2 commits into
NVIDIA:release/26.08from
achirkin:fea-cagra-default-heuristics
Open

Add CAGRA build heuristics independent of HNSW parameters#2345
achirkin wants to merge 2 commits into
NVIDIA:release/26.08from
achirkin:fea-cagra-default-heuristics

Conversation

@achirkin

Copy link
Copy Markdown
Contributor

Split the cagra::index_params::from_hnsw_params into a core cagra::index_params::from_dataset and a thin wrapper ``cagra::index_params::from_hnsw_params`. This solves two problems:

  1. Avoid using the HNSW parameters that do not make sense for CAGRA
  2. Allow HNSW parameter heuristics change without affecting CAGRA in future

The new parameter defaults are selected to yield exactly the same configurations at old call sites of from_hnsw_params

@tfeher tfeher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks Artem, it makes sense to separate the dataset shape dependent CAGRA heuristics to general CAGRA heuristic and HNSW specific ones. The PR looks good to me, apart from two small docstring issues.

* @param dataset The shape of the input dataset
* @param intermediate_graph_degree The intermediate (kNN) graph degree the build should target
* @param metric The distance metric to search
* @param build_quality Higher values increase the build quality (and cost) up to a point.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the range of the values the user could provide here?

Comment on lines +253 to +255
* @param graph_degree Degree of the output graph.
* @param metric The distance metric to search
* @param build_quality Higher values increase the build quality (and cost) up to a point.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please document valid range for build_quality. Also it would make sense to give a hint for graph_degree. E.g multiples of 32 is a good practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request non-breaking Introduces a non-breaking change

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants