-
Notifications
You must be signed in to change notification settings - Fork 1.2k
GroupVarInt Encoding Implementation for HNSW Graphs #14932
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
base: main
Are you sure you want to change the base?
Conversation
This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog label to it and you will stop receiving this reminder on future updates to the PR. |
Hi @aylonsk ! Thank you for digging into this issue. I am sure you are still working on it, but I had some feedback:
Handling the format change can be complicated. So, my first step would be to justify the change with performance metrics. Then do all the complicated format stuff. Good luck! |
Thanks for your response! My apologies, I forgot to post my results from LuceneUtil. Because I noticed variance between each run, I decided to test each set of hyperparameters 10 times and take the median for latency, netCPU, and AvgCpuCount. Therefore, my results aren't in the standard table format. I ran 12 comparison tests in total, each a different combination of HPs. Here were the variables I kept the same: (topK=100, fanout=50, beamWidth=250, numSegments=1) Here are some specific tests: BENCHMARKS (10 runs per test):
Baseline: Candidate: Latency Improvement: ~4.11% speedup
Baseline: Candidate: Latency Improvement: ~4.3% speedup
Baseline: Candidate: Latency Improvement: ~3.17% speedup
Baseline: Candidate: Latency Improvement: 5.49% speedup
Baseline: Candidate: Latency Improvement: ~18.1% speedup While the degree of improvement varied between tests, all tests except 1 showed improvement in latency over the baseline. Considering how simple and non-intrusive this implementation is, I think it would be an easy net benefit. Thank you for letting me know about the backwards compatibility requirement. I will look into fixing that tomorrow. |
@aylonsk great looking numbers! I expect for cheaper vector ops (e.g. single bit quantization), the impact is even higher. |
Description
For HNSW Graphs, the alternate encoding I implemented was GroupVarInt encoding, which in theory should be less costly both in space and runtime. The pros of this encoding would be that it allocates all of the space for a group of 4 integers in advance, and that it can encode using all 8 bits per byte instead of the 7 for VarInt. The cons are that it can only encode integers (<=32bits), and uses the first byte to encode the size of each number. However, since we are using delta encoding to condense our integers, they will never be larger than 32bits, making this irrelevant.