You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expose Product Quantization (PQ) tuning parameters on vector index creation #3160
Summary
When creating a vector index with quantization=PRODUCT, the Java API does not expose PQ tuning knobs; PQ always uses hardcoded defaults. Please expose these parameters at index creation time and propagate them into LSMVectorIndexMetadata.
Current behavior
PQ runs with defaults derived in code:
pqSubspaces: auto min(dim/4, 512) then adjusted to evenly divide dimensions
pqClusters: 256
pqCenterGlobally: true
pqTrainingLimit: 128,000
These are set in metadata defaults and used during PQ build (see LSMVectorIndexMetadata.java and the build path in LSMVectorIndex.java).
Callers cannot override M/K/centering/training cap when constructing the index.
Expected behavior
The index builder/API should accept PQ parameters and store them in LSMVectorIndexMetadata, e.g.:
pqSubspaces (M)
pqClusters (K)
pqCenterGlobally (boolean)
pqTrainingLimit (int)
These values should be used by the PQ build instead of the defaults.
Why it matters
PQ recall/latency and compression depend on M/K and centering; workloads need to tune these.
Defaults may be suboptimal for different vector dims or recall/latency targets.
Request
Add PQ parameters to the Java index creation API (and underlying builders), persist them in LSMVectorIndexMetadata, and honor them in the PQ build.
database.getSchema()
.buildTypeIndex("Document", newString[] { "embedding" })
.withLSMVectorType()
.withDimensions(128)
.withSimilarity("COSINE")
.withQuantization(VectorQuantizationType.PRODUCT)
.withPQSubspaces(16) // Custom M value (default would be 128/4 = 32)
.withPQClusters(128) // Custom K value (default is 256)
.withPQCenterGlobally(false) // Custom centering (default is true)
.withPQTrainingLimit(50000) // Custom training limit (default is 128000)
.create();
Activity
lvca commentedon Jan 16, 2026
Good idea, working on it.
feat: Expose Product Quantization (PQ) tuning parameters on vector in…
lvca commentedon Jan 16, 2026
Works! Now you can do this:
feat: Expose Product Quantization (PQ) tuning parameters on vector in…
chore(deps): bump github/codeql-action from 3.30.3 to 3.30.5 [skip ci]
chore(deps): bump github/codeql-action from 3.30.5 to 3.30.6 [skip ci]
chore(deps): bump github/codeql-action from 3.30.6 to 4.30.8 [skip ci]
chore(deps): bump github/codeql-action from 4.30.8 to 4.30.9 [skip ci]
chore(deps): bump github/codeql-action from 4.30.9 to 4.31.0 [skip ci]
chore(deps): bump github/codeql-action from 4.31.0 to 4.31.2 [skip ci]
chore(deps): bump github/codeql-action from 4.31.2 to 4.31.3 [skip ci]
chore(deps): bump github/codeql-action from 4.31.3 to 4.31.4 [skip ci]
feat: Expose Product Quantization (PQ) tuning parameters on vector in…