[WIP] Expose SOAR as a public cluster API - #2540
Open
ronjer30 wants to merge 2 commits into
Open
Conversation
SOAR (Spilling with Orthogonality-Amplified Residuals, https://arxiv.org/abs/2404.00774) gives each vector a second centroid chosen to complement its primary assignment rather than to be merely the next closest. Indexing a vector under both partitions improves recall for queries near a partition boundary. The implementation lived in `neighbors/scann/detail/scann_soar.cuh` and was reachable only by building a ScaNN index, even though the algorithm needs nothing beyond centroids and primary k-means labels. Promotes it to a cluster-level API. `cuvs::cluster::soar::predict` takes a dataset, centroids, and primary labels, and writes one secondary label per row. `soar::params` exposes the `lambda` weight controlling how strongly a candidate centroid is penalized for having a residual aligned with the primary one. Moves `scann_soar.cuh` to `cluster/detail/soar.cuh` and points the ScaNN builder at the relocated entry point so there is a single implementation. `compute_soar_labels` now takes its centroids as a const view. The detail header also gains `compute_residuals`, which the public API needs to derive residuals from labels; the ScaNN builder already holds residuals for quantization and keeps supplying its own, so it does not pay for a second pass over the dataset. Adds `cpp/tests/cluster/soar.cu` to `CLUSTER_TEST`, covering assignments against an exhaustive host search, the residual computation against a host reference, a hand-checked separated-cluster case, and the shape-validation errors. Adds a C++ API documentation page. Signed-off-by: Ranjit Rajan <ranjitr@nvidia.com>
`SOAR_EXAMPLE` shows the call sequence a caller needs: balanced k-means for the centroids and primary labels, then `soar::predict` to fill one secondary label per row. Signed-off-by: Ranjit Rajan <ranjitr@nvidia.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Testing
SOAR_EXAMPLE.SCANN_EXAMPLEindex build time on NVIDIA GB10, 10 runs after warm-up: 412.3 ± 4.0 ms before and 410.8 ± 6.0 ms after; no measurable regression.