shubhamvishu opened a new pull request, #16979: URL: https://github.com/apache/lucene/pull/16979
### Description Worked with Claude/AI, with a human in the loop. HNSW scoring of quantized vectors waits on memory: each target record is loaded only when it is scored, so the cache misses of a batch are paid one after the other. Touch every cache line of the batch first, through MemorySegmentAccessInput, so the misses overlap. Scores are unchanged. Opening as a draft to get early feedback. The gains look solid on Graviton3, but I still want to check other CPUs and workloads (see TODOs), and whether it is a clean win or adds more complexity than it is worth, before calling it ready. Ideas and thoughts welcome. Some TODOs: - Benchmark on other architectures and machines (x86 Intel/AMD, other ARM). - Hybrid workloads (lexical + vector). - Cap the bytes touched per batch to stay under L2? - Enable it only for low-bit encodings (1-4 bit) and ignore for larger ones? - How it interacts with prefetch - If async prefetch (madvise) is later wired in here, make touch() not wait on its page faults or skip it? #### Luceneutil Benchmark (Cohere 1M, 1024d, Graviton3, k = 100): The latency and force merge time shows the biggest gains | quantized | run | recall | latency(ms) | Δ latency | visited | index(s) | Δ index | merge wait(s) | force\_merge(s) | total(s) | Δ total | index\_size(MB) | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | 1 bit | main | 0.686 | 2.225 | | 8539 | 192.30 | | 8.16 | 217.47 | 417.93 | | 4181.86 | | 1 bit | PR | 0.686 | 1.504 | **−32.4%** | 8539 | 188.10 | −2.2% | 19.52 | 178.96 | 386.58 | **−7.5%** | 4182.23 | | 4 bit | main | 0.911 | 2.452 | | 7340 | 195.74 | | 14.77 | 236.79 | 447.30 | | 4535.56 | | 4 bit | PR | 0.911 | 1.921 | **−21.7%** | 7340 | 193.01 | −1.4% | 56.97 | 134.09 | 384.07 | **−14.1%** | 4535.21 | <!-- If this is your first contribution to Lucene, please make sure you have reviewed the contribution guide. https://github.com/apache/lucene/blob/main/CONTRIBUTING.md --> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
