Repository navigation
Add rescore_factor to quantizer configs and rescore_limit to PQ - #2248
Merged
Merged
Conversation
Exposes the rescoreFactor setting from weaviate/weaviate#13536 on the pq, bq, sq and rq quantizers in Configure, Reconfigure and the config returned by the server. PQ also gains rescore_limit, which the server now honours for every quantizer. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Secrets | View in Orca |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev/1.41 #2248 +/- ##
===========================================
Coverage ? 89.24%
===========================================
Files ? 312
Lines ? 24820
Branches ? 0
===========================================
Hits ? 22151
Misses ? 2669
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude <noreply@anthropic.com>
dirkkul
approved these changes
Nov 11, 2026
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.
Motivation
weaviate/weaviate#13536 adds a
rescoreFactorsetting to every quantizer (PQ, BQ, SQ, RQ) and makesrescoreLimitapply to all of them, so the number of rescored candidates becomesmin(ef, max(k, rescoreLimit, ceil(k × rescoreFactor))). The Python client had no way to setrescoreFactoron create or update, or to read it back from a collection config. PQ also had norescore_limitin the client, so that is added here too to keep the four quantizers consistent.Approach
rescore_factoris threaded through the three layers that already carryrescore_limit: the create models (Configure.VectorIndex.Quantizer.*), the update models (Reconfigure.VectorIndex.Quantizer.*), and the read-side dataclasses parsed from the schema JSON.rescore_limit, so existing positional callers keep working. That is whyReconfigure...bq(rescore_limit, enabled, rescore_factor)looks oddly ordered.Optional[float]and defaults toNone, so it is dropped from the payload. The server then applies its automatic value, and requests against servers that don't know the field are unchanged.-1automatic, or>= 1; fractional values allowed). The read side returns whatever the server sends, including-1for automatic, rather than normalising it toNone.Key areas for review
weaviate/collections/classes/config_vector_index.py: thesqfactory has two@overloads plus the implementation; all three signatures gain the argument.weaviate/collections/classes/config.py:_PQConfig,_BQConfig,_SQConfig,_RQConfiggain new fields without defaults (see breaking changes).weaviate/collections/classes/config_methods.py:__get_quantizer_configuses.get(), so configs from older servers parse withrescore_factor=None.Risks
WEAVIATE_141is new on this branch, so unrelated tests may surface 1.41 differences. Add API key expiration for DB users on Weaviate 1.41+ #2249 adds the same variable with an older tag and will conflict on that line.Testing
Unit tests plus one integration test. CI now also runs the integration suite against
1.41.0-dev-483b145, the image built from the merge commit of weaviate/weaviate#13536.rescoreLimitandrescoreFactorunder HNSW, and both keys are absent from the PQ payload when not set.rescoreFactorabsent (None),-1, and2.5.test_hnsw_quantizer_rescore_factor, skipped below 1.41): for each of PQ, BQ, SQ and RQ on HNSW, create withrescore_limitandrescore_factor, read both back, updaterescore_factorand checkrescore_limitis preserved.rescore_factorsets the new value and preserves the existingrescoreLimit.Breaking changes
None for the public API. The read-side dataclasses gain required fields, so code constructing
PQConfig/BQConfig/SQConfig/RQConfigdirectly needs the new arguments.🤖 Generated with Claude Code