Skip to content

docs: 4-bit rotational quantization (preview, 1.39) - #509

Open
g-despot wants to merge 5 commits into
v1-39/mainfrom
v1-39/rq4
Open

docs: 4-bit rotational quantization (preview, 1.39)#509
g-despot wants to merge 5 commits into
v1-39/mainfrom
v1-39/rq4

Conversation

@g-despot

@g-despot g-despot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Documents bits: 4 for rotational quantization, a headline 1.39 feature. Preview tier.

Extends the existing RQ pages rather than adding new ones: the compression config page, the quantization concepts page, both starter-guide compression pages, the RQ parameter include, and the env-var reference. Examples in Python, Go, Java and C#.

The two facts that matter most

It is HNSW-only. A flat index rejects bits: 4 with "RQ bits must be either 1 or 8", and HFresh accepts 1-bit only. A dynamic index holds a flat and an HNSW config side by side, so 4-bit can only be set on the HNSW side.

The default rescore limit undercuts the feature. bits: 4 inherits rescoreLimit 20, because the per-width default is keyed on Bits == 1 only. The recall RQ4 is sold on assumes a top-50 window, so users must raise it. The page says so.

Rescore limit is shown per client, not uniformly

Go and C# show it; both put rescoreLimit on the wire correctly. Java omits it: RQ.java serialises rescore_limit in snake_case while the server reads only rescoreLimit, so a Java-set value is silently dropped. Tracked separately.

Also corrected here

The starter guide claimed "8-bit and 1-bit RQ work with every index type in the table". That was false: HFresh accepts 1-bit only. Each index type is now stated explicitly, verified against v1.39.0.

No TypeScript tab on one section

The TypeScript client's reconfigure path has no bits parameter, so it cannot express 4-bit on an existing collection. That tab is omitted, which renders the standard "not yet available" message rather than a blank code block. Client gap tracked separately.

Verification

Build warnings identical to a freshly built base. Go, Java and C# snippets type-check against the real clients. Every rendered code block was checked for the marker-substring hazard, including a Go marker rename to remove a latent one. The bytes-per-vector figures are verified against rq4.go: 16 bytes metadata plus OutputDim/2, so 1536d gives 1552 for 8-bit and 784 for 4-bit.

Known, not fixed here

The Java 8-bit example under "RQ parameters" still sets .rescoreLimit(20), the call that is silently ignored. Pre-existing.

Docs owner is John Trengrove, who also wrote the core PR, and should review before this merges. Two claims are worth his eye specifically: the recall figures, which no in-repo benchmark asserts, and the Preview label, which is editorial since 4-bit ships ungated.

Completes the 1.39 4-bit RQ page: the Go, Java and C# tabs of the
"Enable compression for new collection" and "Enable compression for
existing collection" sections under 4-bit RQ now have real snippets,
matching the Python and TypeScript examples already in place.

- Go, C#: set bits to 4 and raise the rescore limit to 50. Both clients
  put the rescore limit on the wire under the name the server reads.
- Java: sets bits to 4 only. The Java client serialises the rescore
  limit under a name the server ignores, so an example that set it
  would not do anything (tracked separately).
- No flat-index example at 4 bits: the flat index rejects it.

Also removes the Java rescore caveat include and its usage from the
page.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

Verifier findings on the 4-bit RQ branch.

- Starter guide claimed "8-bit and 1-bit RQ work with every index type in
  the table". False for the HFresh column: hfresh accepts 1-bit only
  (entities/vectorindex/hfresh/config.go:142-144 at v1.39.0). Restate the
  support per index type: hnsw 8/4/1, flat 8/1, hfresh 1 only, dynamic per
  side.
- The shared RQ parameters include named only the flat restriction, so a
  reader on the vector index reference (where it renders directly below the
  HFresh section) was told 8, 4 and 1 are all valid for HFresh. Name all
  three index types. Also state the fixed 1-bit width on the HFresh rq row.
- Remove the TypeScript tab from the 4-bit "existing collection" example.
  It rendered an empty code block because the TS client's reconfigure path
  takes no bits value. The swizzled Tabs component now shows the honest
  "not yet available" message instead.
- Rename the Go marker UpdateSchemaToEnableRQ to 8BitUpdateSchema so no
  marker name is a prefix of another, since FilteredTextBlock matches
  markers by substring.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@g-despot
g-despot marked this pull request as ready for review August 12, 2026 13:50
…unt example

Review feedback on PR #509.

- Replace the "4-bit RQ limitations" subsection with a short note under
  "## 4-bit RQ" carrying the hnsw-only constraint. The per-index bit widths
  and the immutability of `bits` are already documented in the RQ parameters
  table and the compression starter guide.
- Keep the RQ distance metric support statement by moving it into the
  "RQ parameters" section; it applies to all RQ variants, not just 4-bit.
- Remove the 1536-dimensional byte-count example from the RQ characteristics
  section of the vector quantization concepts page.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Documents preview support for 4-bit rotational quantization in Weaviate 1.39.

Changes:

  • Adds RQ4 concepts, compatibility, sizing, and rescoring guidance.
  • Adds configuration examples across five client languages.
  • Updates index and environment-variable references.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/weaviate/starter-guides/managing-resources/compression.mdx Clarifies RQ index compatibility.
docs/weaviate/configuration/compression/rq-compression.md Adds RQ4 configuration guidance and examples.
docs/weaviate/config-refs/indexing/vector-index.mdx Documents HFresh’s fixed 1-bit RQ width.
docs/weaviate/concepts/vector-quantization.md Explains RQ4 mechanics, sizing, and recall.
docs/deploy/configuration/env-vars/index.md Adds the rq-4 default quantization value.
_includes/starter-guides/compression-types.mdx Extends the RQ overview to 4-bit.
_includes/feature-notes/rq-4bit.mdx Adds the RQ4 preview notice.
_includes/configuration/rq-compression-parameters.mdx Documents bit-width and rescoring parameters.
_includes/code/java-v6/src/test/java/ConfigureRQTest.java Adds Java RQ4 examples.
_includes/code/howto/go/docs/configure/compression.rq_test.go Adds tested Go RQ4 examples.
_includes/code/howto/configure-rq/rq-compression-v4.py Adds Python RQ4 examples.
_includes/code/howto/configure-rq/rq-compression-v3.ts Adds a TypeScript creation example.
_includes/code/csharp/ConfigureRQTest.cs Adds C# RQ4 examples.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread _includes/starter-guides/compression-types.mdx Outdated
Comment thread docs/weaviate/configuration/compression/rq-compression.md Outdated
The "RQ comes in three bit widths" paragraph linked only the 4-bit
mention. Link the first 8-bit and 1-bit mentions to the matching
headings on the RQ compression reference page, using the same absolute
path form as the existing 4-bit link. Later mentions of each width stay
unlinked, following the first-mention convention.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@g-despot
g-despot requested a review from trengrj August 13, 2026 08:44
… headroom

Two review findings from PR #509.

The compression starter-guide include claimed 98-99% recall "without any
configuration" for RQ as a whole. That is an 8-bit figure. This branch
extended the include to cover 4-bit, which inherits rescoreLimit 20 and
does not reach that recall at its defaults. Scope the claim to 8-bit and
point the narrower widths at the rescore guidance. The same broadening
had reached three neighbouring claims on the host page (memory saving,
the typical-recall list, and "RQ can run without rescoring"), so scope
those too.

The 4-bit rescoreLimit guidance said "at least the largest query limit",
which permits rescoreLimit == limit. At v1.39.0 the HNSW rescore path
truncates the candidate pool to rescoreLimit when rescoreLimit >= k, so
that setting rescores exactly as many candidates as it returns: it can
reorder the results but cannot recover a neighbour the compressed
distances dropped. A query with limit 20 against the 4-bit default of 20
lands on that zero-headroom case. Require a value strictly greater than
the largest query limit, give ef as the ceiling, and keep the warning
that 0 disables rescoring.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants