Repository navigation
Add rabitq inner product distance computation support - #476
Merged
MaggieQi merged 16 commits intoNov 25, 2026
Merged
Conversation
Store the centroid-corrected IP additive factor alongside unchanged L2 factors. Use six-factor codes with global/local model versions 6/7 and reject older formats instead of retaining legacy compatibility. Cover upstream estimator equivalence, ADC/SDC persistence and unsupported model rejection; update encoded-width examples and format documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 556e2fce-e45f-43c5-ae5a-77dd20b2f549
MaggieQi
reviewed
Nov 23, 2026
Restore the tracked tree to c1c8f39 without rewriting branch history. Remove later normalization, head-maintenance, PQ/OPQ encoding and evaluation changes before rerunning matched GloVe IP experiments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 556e2fce-e45f-43c5-ae5a-77dd20b2f549
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 556e2fce-e45f-43c5-ae5a-77dd20b2f549
Use L2 nearest-codeword assignment while retaining IP search scoring. Record the corrected OPQ-only rerun, preserve Float32 and RaBitQ baselines, and include the reproducible protocol and source fingerprints. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 556e2fce-e45f-43c5-ae5a-77dd20b2f549
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 556e2fce-e45f-43c5-ae5a-77dd20b2f549
Use versions 5/6 for new IP models while retaining legacy 2/3/4 layouts. Clarify query-factor counts and single-cluster comments. Restore existing posting truncation and remove out-of-scope documentation, configuration, and added tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 556e2fce-e45f-43c5-ae5a-77dd20b2f549
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 556e2fce-e45f-43c5-ae5a-77dd20b2f549
Merge users/qiazh/pre-merge-tikv-bugfix through 220605b while preserving the RaBitQ IP changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 556e2fce-e45f-43c5-ae5a-77dd20b2f549
MaggieQi
reviewed
Nov 24, 2026
| } | ||
| ret = std::make_shared<RaBitQQuantizer>(); | ||
| if (ret->LoadQuantizer(raw_bytes) != ErrorCode::Success) { | ||
| if (std::static_pointer_cast<RaBitQQuantizer>(ret)->LoadQuantizer( |
Member
There was a problem hiding this comment.
why need cast? It is already shared_ptr?
| return m_pQuantizer->L2DistanceSDC((const uint8_t*)pX, (const uint8_t*)pY); | ||
| }; | ||
| else | ||
| else if (distMethod == DistCalcMethod::InnerProduct) |
Member
There was a problem hiding this comment.
Why we need a specific InnerProductDistanceSDC and InnerProductDistance? I think they are the same as CosineDistanceSDC and CosineDistance? In fact, without quantizer, the calculation of CosineDistance is the same as InnerProductDistance since we already do normalization for CosineDistance.
| // IP scores may be negative for distinct vectors and cannot test identity. | ||
| const bool innerProduct = m_headIndex->GetDistCalcMethod() == DistCalcMethod::InnerProduct; | ||
| const bool sameHead = !theSameHead && (innerProduct ? clusterHeadVID == headID : | ||
| m_headIndex->ComputeDistanceBetweenStoredVectors( |
Member
There was a problem hiding this comment.
Maybe we can use L2Distance to judge whether it is the same or not?
MaggieQi
approved these changes
Nov 25, 2026
MaggieQi
merged commit Nov 25, 2026
62deacc
into
users/qiazh/pre-merge-tikv-bugfix
4 of 6 checks passed
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.
Changes
Benchmark results
GloVe-100: 1,183,514 base vectors, 10,000 queries, normalized inputs. Single-threaded IP search,
MaxCheck=4000,SearchInternalResultNum=64, no reranking. Recall uses strict ground-truth ID matching.OPQ was rebuilt and rerun after the encoding fix; Float32 and RaBitQ results are unchanged. Both quantized indexes have full ID coverage. Float32 has 10 missing IDs, which remain in the recall denominator.