Skip to content
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

25x performance difference in 16-bit vs 8-bit codes in IVFPQ #4129

Open
anfatima opened this issue Jan 17, 2025 · 4 comments
Open

25x performance difference in 16-bit vs 8-bit codes in IVFPQ #4129

anfatima opened this issue Jan 17, 2025 · 4 comments

Comments

@anfatima
Copy link

anfatima commented Jan 17, 2025

Keeping everything the same and just switching from 8-bit codes to 16-bit codes increases the time to build and train the index by more than 25x. The index contains around 25 million vectors. I only use GPU to train K-Means and train the IVFPQ on an Intel i9 processor 14900KS using 22 threads. Do you have any idea why there is such a significant difference in runtime?

Here is the config I am using,

{
"batch_size": 128,
"use_gpu": true,
"verbose": true,
"num_kmeans_iters": 50,
"num_centroids": 2000,
"num_bits": 16,
"num_quantizers": 16,
"skip_codebook_tables": false,
"use_precomputed_table": true
}

@anfatima anfatima changed the title Performance of 16 bit codes vs 8 bits in IVFPQ 25x performance of 16 bit codes vs 8 bits in IVFPQ Jan 17, 2025
@anfatima anfatima changed the title 25x performance of 16 bit codes vs 8 bits in IVFPQ 25x performance difference in 16 bit codes vs 8 bits in IVFPQ Jan 17, 2025
@anfatima anfatima changed the title 25x performance difference in 16 bit codes vs 8 bits in IVFPQ 25x performance difference in 16-bit vs 8-bit codes in IVFPQ Jan 17, 2025
@anfatima
Copy link
Author

Just in case, my server has 128 GB DDR5 RAM and 256 GB on NVME SSD. Both 8-bit and 16-bit indices fit in RAM.

@mengdilin
Copy link
Contributor

Can you produce the code snippet you ran for repro?

@alexanderguzhva
Copy link
Contributor

@anfatima 16-bit codes is an enormous overhead indeed. MUCH slower is expected, bcz 8-bit codebook fits in all kinds of caches, plus I expect that there are special dedicated code branches cases for 8-bit codebook,

Copy link

github-actions bot commented Feb 4, 2025

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants