-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Description
One of the biggest pain points of HNSW is that the graph and vectors must be in memory.
Since the vectors are stored off heap and read in via byte streams, it seems like we could reduce the memory requirements by half for a typical use case if we stored the vector dimensions in 2 bytes instead of 4.
When the bytes are read into heap for comparison, we would still be required to use float (until the JVM supports a native float16 type).
I guess the open questions are:
- Do we think this is worth it? It seems like users could get 2x memory savings with almost no configuration change.
- How big a hit on performance is this. I am assuming decoding a
bfloat16bytes will take longer than decoding afloatasfloatdecoding can use intrinsics.
I recognize that in the future Lucene will likely support a separate vector codec that uses less memory and is more disk-friendly, but I would argue even such a structure could benefit from only storing bfloat16 instead of float32.