Skip to content

Expose Product Quantization (PQ) tuning parameters on vector index creation #3160

Closed

Description

@tae898

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.
  • Document defaults and valid ranges.

Activity

  1. self-assigned this
    on Jan 16, 2026
  2. added
    enhancement
    on Jan 16, 2026
  3. added this to the 26.1.1 milestone on Jan 16, 2026
  4. lvca commented on Jan 16, 2026

    @lvca
    Member

    Good idea, working on it.

  5. added theissue type on Jan 16, 2026
  6. added
    in progress
    on Jan 16, 2026
  7. lvca commented on Jan 16, 2026

    @lvca
    Member

    Works! Now you can do this:

    database.getSchema()
              .buildTypeIndex("Document", new String[] { "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();
  8. added and removed
    in progress
    on Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions