-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR introduces the new vector addition feature to CAGRA. Rel: rapidsai/raft#1775 Original PR: rapidsai/raft#2157 CAGRA-Q is not supported ## Usage ```cpp auto additional_dataset = raft::make_host_matrix<float, int64_t>(res,updated_dataset_size, dim); cuvs::neighbors::cagra::extend(handle, raft::make_const_mdspan(additiona_dataset.view()), cagra_index); ``` ## Algorithm Graph degree: d The algorithm consists of two stages: rank-based reordering and reverse edge addition. 1. Rank-based reordering 1-1. Obtain d' (=2d) nearest neighbor vectors (V) of a given new vector using the CAGRA search 1-2. Count the number of detourable edges using the result of step 1 and the neighbor list of the input index. Then we prune (3*d/2) edges in the same way as the CAGRA graph optimization. Through this operation, we decide d/2 neighbors. 2. Reverse edge addition 2-1. Count the number of incoming edges for all nodes. 2-2. Add d/2 reverse edges from the nodes added to the neighbor list in Step 1 by replacing a node with a new node. To prevent the connection to the replaced node from being lost, we add the node to the neighbor list of the new node. This allow us to make a detour connection. The replaced nodes are the largest number of incoming edge nodes in the 2/d nodes from the back of the neighbor list without duplication with the nodes already in the neighbor list. ## Performance In this experiment, we first split the dataset into two parts: the initial and the additional part. Then, we extend the CAGRA index built by the initial part to include the additional part. ![search-eval](https://github.com/rapidsai/raft/assets/12711693/0fbae9e5-defc-4263-9d34-176667fb3359) We can see a larger recall drop compared to the baseline by increasing the number of added vectors. Therefore, rebuilding the CAGRA index is recommended when one wants to add a lot of vectors. Authors: - tsuki (https://github.com/enp1s0) - Tamas Bela Feher (https://github.com/tfeher) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Tamas Bela Feher (https://github.com/tfeher) - Corey J. Nolet (https://github.com/cjnolet) URL: #151
- Loading branch information
Showing
12 changed files
with
1,225 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.