Repository navigation
Docs: add the Quantized vector codec to the CREATE TABLE codecs page - #111128
Conversation
|
Workflow [PR], commit [84ec719] Summary: ✅ AI ReviewSummaryThis PR adds the Findings
Final Verdict
|
|
@groeneai when opening PRs which make changes only to documentation, please use a "Docs: " prefix in the PR title. Address the review feedback on this PR as well please. |
Scope the top-k shortlist/rescore acceleration to MergeTree-family tables (the useVectorSearchWithQuantizedCodes planner rewrite only matches ReadFromMergeTree plans; on other engines the setting is a no-op exact scan), and state that a NONE-category codec cannot be chained with any other codec (including encryption), not only with a compression codec. Co-Authored-By: Claude Opus 4.8 <[email protected]>
4a4c8e7 to
f0504bd
Compare
|
Done - added the "Docs:" title prefix and addressed both review comments in f0504bd (scoped the top-k acceleration to MergeTree-family tables; stated the codec cannot be chained with any other codec, including encryption). |
|
|
||
| <ExperimentalBadge/> | ||
|
|
||
| `Quantized(method, dimensions[, ...])` — A codec for vector-search columns of type `Array(Float32)`, `Array(Float64)` or `Array(BFloat16)`. It stores the full-precision vectors unchanged and, alongside them, a compact *quantized code* per vector. On `MergeTree`-family tables, enabling `vector_search_use_quantized_codes` lets a top-`k` vector-search query scan the small codes to build a shortlist and rescore only that shortlist against the full-precision vectors. This two-stage path is approximate: it reads fewer bytes than a full-precision scan but may reduce recall. The `vector_search_index_fetch_multiplier` setting controls the shortlist size and therefore the recall/performance trade-off. `dimensions` is the vector length; supported `method` values are `rabitq`, `turboquant`, `int8`, `prefix` and `product`, each a different size / accuracy / distance-function trade-off. |
There was a problem hiding this comment.
This sentence still promises the quantized-code rewrite whenever a MergeTree table has CODEC(Quantized(...)), but the implementation is narrower. src/Processors/QueryPlan/Optimizations/useVectorSearchWithQuantizedCodes.cpp returns early once ReadFromMergeTree::getVectorSearchParameters is set, and src/Processors/QueryPlan/Optimizations/optimizeTree.cpp describes this as the brute-force path for tables without a vector similarity index. A query on a MergeTree table that also has a vector index therefore keeps the index plan instead of scanning vec.quantized. Please scope the wording to brute-force / no-index queries so readers do not infer that vector_search_use_quantized_codes accelerates every top-k search on a quantized column.
|
|
||
| <ExperimentalBadge/> | ||
|
|
||
| `Quantized(method, dimensions[, ...])` — A codec for vector-search columns of type `Array(Float32)`, `Array(Float64)` or `Array(BFloat16)`. It stores the full-precision vectors unchanged and, alongside them, a compact *quantized code* per vector. On `MergeTree`-family tables, enabling `vector_search_use_quantized_codes` lets a top-`k` vector-search query scan the small codes to build a shortlist and rescore only that shortlist against the full-precision vectors. This two-stage path is approximate: it reads fewer bytes than a full-precision scan but may reduce recall. The `vector_search_index_fetch_multiplier` setting controls the shortlist size and therefore the recall/performance trade-off. `dimensions` is the vector length; supported `method` values are `rabitq`, `turboquant`, `int8`, `prefix` and `product`, each a different size / accuracy / distance-function trade-off. |
There was a problem hiding this comment.
@groeneai Link "vector_search_use_quantized_codes" to its corresponding entry in https://clickhouse.com/docs/operations/settings/settings
There was a problem hiding this comment.
@groeneai Replace "small codes" by "quantized codes"
There was a problem hiding this comment.
@groeneai Replace "This two-stage path is approximate: it reads fewer bytes than a full-precision scan but may reduce recall" by "This two-stage approximate neighbor search reads fewer bytes than a normal full-precision scan but may reduce recall."
There was a problem hiding this comment.
@groeneai Remove sentence "The vector_search_index_fetch_multiplier setting controls the shortlist size and therefore the recall/performance trade-off."
|
|
||
| `Quantized(method, dimensions[, ...])` — A codec for vector-search columns of type `Array(Float32)`, `Array(Float64)` or `Array(BFloat16)`. It stores the full-precision vectors unchanged and, alongside them, a compact *quantized code* per vector. On `MergeTree`-family tables, enabling `vector_search_use_quantized_codes` lets a top-`k` vector-search query scan the small codes to build a shortlist and rescore only that shortlist against the full-precision vectors. This two-stage path is approximate: it reads fewer bytes than a full-precision scan but may reduce recall. The `vector_search_index_fetch_multiplier` setting controls the shortlist size and therefore the recall/performance trade-off. `dimensions` is the vector length; supported `method` values are `rabitq`, `turboquant`, `int8`, `prefix` and `product`, each a different size / accuracy / distance-function trade-off. | ||
|
|
||
| The codec can only be set in `CREATE TABLE`; it cannot be added, removed, or changed through `ALTER TABLE`, including with `ADD COLUMN ... CODEC(Quantized(...))`. It is a `NONE`-category codec, so it cannot be chained with any other codec (not even an encryption codec such as `AES_128_GCM_SIV`). The two-stage shortlist-and-rescore path applies only to `MergeTree`-family tables; when `vector_search_use_quantized_codes` is off (the default), or on non-`MergeTree` engines where the setting has no effect, the same query runs as an exact scan, so the codec never changes results. For the methods, settings, and query examples, see [Vector search with quantized codecs](/engines/table-engines/mergetree-family/annindexes#vector-search-with-quantized-codecs). |
There was a problem hiding this comment.
@groeneai Remove "It is a NONE-category codec" and instead write directly "It cannot be chained with ..."
| ENGINE = MergeTree ORDER BY id; | ||
| ``` | ||
|
|
||
| :::note |
Address @rschu1ze's inline review on the create-table codecs page: link vector_search_use_quantized_codes to the settings reference, use "quantized codes", tighten the two-stage approximate-search wording, drop the vector_search_index_fetch_multiplier sentence, state the chaining restriction directly, and remove the experimental note. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Applied all six review suggestions in 5276af9:
|
|
@groeneai Do not push further commits. Humans will take over. |
| CREATE TABLE vectors | ||
| ( | ||
| id UInt32, | ||
| vec Array(Float32) CODEC(Quantized('rabitq', 1536)) |
There was a problem hiding this comment.
Change to BFloat16 - using Float32 for embeddings is an anti-pattern.
Change it across the whole documentation.
There was a problem hiding this comment.
Will do. I will switch the Array(Float32) embedding examples to Array(BFloat16) across the vector-search docs in a separate PR and link it here: annindexes.md and qbit.md now, and this codecs page once #111128 merges. I will leave the lines that intentionally compare Float32 vs BFloat16 storage sizes unchanged.
There was a problem hiding this comment.
Opened #111156 for the docs sweep: the vector-search guide embedding examples now use Array(BFloat16) (with regenerated outputs). The sample-dataset guides and the codecs-page example on line 507 here are deferred and listed in that PR (line 507 will be flipped once this PR merges, to avoid pushing to this branch).
alexey-milovidov
left a comment
There was a problem hiding this comment.
A small change needed.
Requested changes are implemented in #111156
…tized-codec Docs: add the Quantized vector codec to the CREATE TABLE codecs page
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Adds the
Quantized(...)column codec (vector-search codec, feature added in #108565) to the codecs listing on theCREATE TABLEdocs page, as requested by @rschu1ze on #111084.The entry goes under Specialized Codecs (it preprocesses vector data; it is not an encryption codec), marked experimental, and links to the full reference at Vector search with quantized codecs rather than duplicating the method/settings details that already live there.
Related: #108565 (codec feature), #111084 (negative-case tests).
Version info
26.7.1.1266(included in26.7and later)