Repository navigation
[WIP] ANNs for clustering at training time #1938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HowardHuang1
wants to merge
22
commits into
NVIDIA:main
Choose a base branch
from
HowardHuang1:HH-ANNs-for-clustering-at-training
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
9fd71ef
add CAGRA ANN to replace brute force kmeans for prediction + test cas…
HowardHuang1 80070c4
fix test cases + fix threshold
HowardHuang1 fa6fd70
add test cases for entire IVF-PQ pipeline
HowardHuang1 d8543a6
rename variable to use_ann_for_extend since previous changes are only…
HowardHuang1 d26e916
Replace brute force with CAGRA ANN in build()
HowardHuang1 ad054af
add test cases
HowardHuang1 0f14da1
Merge remote-tracking branch 'upstream' into HH-ANNs-for-clustering-a…
HowardHuang1 e69259f
rename use_cagra and use_ann variables to use_cagra_for_cluster_assig…
HowardHuang1 1d76516
fix null list or empty trained indices error for IVF-PQ serialize cau…
HowardHuang1 8e62682
rename benchmark names so that Build_NearestCentroidLookup_Speedup mi…
HowardHuang1 167f0c4
refactor out common code shared by BM_IVFPQ_Build_NearestCentroidLook…
HowardHuang1 64586ad
add ann for cluster assignment to postfit. Added use_ann_for_build_po…
HowardHuang1 de80d26
Merge remote-tracking branch 'upstream' into HH-ANNs-for-clustering-a…
HowardHuang1 7daf9cb
add tuning script for ann_rebuild_interval balancing recall and speedup
HowardHuang1 76ebb73
Merge remote-tracking branch 'upstream' into HH-ANNs-for-clustering-a…
HowardHuang1 525cd4c
Merge remote-tracking branch 'upstream/main' into HH-ANNs-for-cluster…
HowardHuang1 1673e39
fix merge conflict with build now taking only dataset views and not d…
HowardHuang1 3951248
Replace hand-picked cluster-assignment bench args with controlled K s…
HowardHuang1 1daabbe
Add controlled fixed-K/vary-N, grid, search-only, dim, and rebuild-in…
HowardHuang1 52ddd3d
Merge remote-tracking branch 'upstream/main' into HH-ANNs-for-cluster…
HowardHuang1 3de0823
Fix benchmark plots and make fit-tuning quality metrics meaningful
HowardHuang1 73825bd
Read benchmark datasets from .fbin files and redesign plot panel 4
HowardHuang1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor out common code shared by BM_IVFPQ_Build_NearestCentroidLook…
…up_Speedup and BM_IVFPQ_Extend_NearestCentroidLookup_Speedup. Also rename use_ann_for_fit to use_ann_for_build_fit to clear up confusion because ANN for nearest cluster assignment can occur in 2 places within build(): (1) in fit and (2) post-fit
- Loading branch information
commit 167f0c458479ffc1e83d6416d824b5443fa6fe9e
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -700,7 +700,7 @@ void balancing_em_iters(const raft::resources& handle, | |
| } | ||
| // E: Expectation step - predict labels (optionally via CAGRA with batched index rebuild) | ||
| const bool use_cagra_for_cluster_assignment = | ||
| params.use_ann_for_fit && | ||
| params.use_ann_for_build_fit && | ||
| n_clusters >= cuvs::cluster::kmeans::detail::kMinClustersForAnnFit && | ||
| std::is_same_v<MathT, float> && std::is_same_v<T, float>; | ||
| if (use_cagra_for_cluster_assignment) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets restrict this PR to Lloyd's kmeans and not balanced. |
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternate the brute-force and CAGRA order in
accumulate_bf_vs_cagra_ms.Every iteration runs
run_bfand thenrun_cagra. The CAGRA run always follows a full brute-forcebuild()orextend(). At that point the memory pool has grown and the caches and clocks are warm. Thespeedup_*counters come from these totals, so the fixed order can bias the reported speedup. Swap the order on alternate iterations and record the order that ran.♻️ Proposed fix
Based on learnings: "Flag a benchmark comparison that always executes competing implementations in a fixed sequential order, unless order-dependent effects are controlled".
Source: Learnings