apache / apache/lucene

While merging quantized vector fields, how can we minimize information loss?

Open
#15,773 9 comments 0 reactions 0 assignees View on GitHub
type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

Disclosure + Credit: I work at Amazon, and this idea was suggested by a colleague familiar with vector search (thanks Karthik!)

For quantized vector fields, HNSW graphs are initially built (during indexing) with [original (unquantized) vectors](https://github.com/apache/lucene/blob/98e1c075f709c13d501f91091e1b05f032279e48/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsWriter.java#L694-L699), but later (during merging) with [quantized vectors](https://github.com/apache/lucene/blob/98e1c075f709c13d501f91091e1b05f032279e48/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsWriter.java#L405-L406) (see [ref](https://github.com/apache/lucene/blob/98e1c075f709c13d501f91091e1b05f032279e48/lucene/core/src/java/org/apache/lucene/codecs/lucene104/Lucene104ScalarQuantizedVectorsWriter.java#L568-L585)).

Would a graph built using original (unquantized) vectors every time (both indexing + merge) be higher quality, and better to search?

This is a tradeoff b/w increased indexing time (quantized computations are cheaper) v/s better recall + latency at search time.

Contributor guide

Open the contributing guide

Research direction

Start with Lucene99HnswVectorsWriter.java and Lucene104ScalarQuantizedVectorsWriter.java at the linked indexing and merge paths. Compare graph construction using original versus quantized vectors, then evaluate the indexing-cost, recall, and search-latency tradeoffs; done means a supported approach or a clear conclusion about whether a change is warranted.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.