shubhamvishu commented on code in PR #16092:
URL: https://github.com/apache/lucene/pull/16092#discussion_r3283934002
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene104/Lucene104ScalarQuantizedVectorsReader.java:
##########
@@ -197,6 +213,14 @@ public RandomVectorScorer getRandomVectorScorer(String
field, float[] target) th
if (fi == null) {
return null;
}
+ // Rotate the query vector to match the rotated stored vectors.
+ float[] scoringTarget = target;
+ if (isRotationEnabled(field) && target != null) {
+ HadamardRotation rotation = rotationFor(field, fi.dimension);
+ float[] rotated = new float[target.length];
+ rotation.rotate(target, rotated);
Review Comment:
@benwtrent I see, yeah I think moving in upstream and doing it once makes
sense to me. Maybe just moving it to KnnQuery as Trevor mentioned below?
> To see the significance of the performance impact, you will need many
vectors spread over many segments
That could be the case yes. Sharing below the cohere v3 run I put with multi
segment and it seems to have not much impact but larger segments of 30M might
move the needle.
<details>
<summary><b>Result : Cohere V3 without forceMerge </b></summary>
#### Baseline :
```
Results:
NOTE: nDoc = 500000 for all runs; skipping column
NOTE: searchType = KNN for all runs; skipping column
NOTE: topK = 100 for all runs; skipping column
NOTE: fanout = 100 for all runs; skipping column
NOTE: resultSimilarity = N/A for all runs; skipping column
NOTE: decay = N/A for all runs; skipping column
NOTE: resultCount = 100.000 for all runs; skipping column
NOTE: maxConn = 64 for all runs; skipping column
NOTE: beamWidth = 250 for all runs; skipping column
NOTE: force_merge(s) = 0.00 for all runs; skipping column
NOTE: filterStrategy = null for all runs; skipping column
NOTE: filterSelectivity = N/A for all runs; skipping column
NOTE: overSample = 1.000 for all runs; skipping column
NOTE: bp-reorder = false for all runs; skipping column
NOTE: indexType = HNSW for all runs; skipping column
NOTE: rerank = no for all runs; skipping column
recall latency(ms) netCPU avgCpuCount quantized visited index(s)
index_docs/s num_segments index_size(MB) vec_disk(MB) vec_RAM(MB)
0.695 1.916 5.285 2.758 1 bits 54581 94.09
5314.12 5 2092.52 2020.836 67.711
0.817 1.887 6.052 3.208 2 bits 50314 95.73
5223.08 5 2147.02 2081.871 128.746
0.921 2.107 7.275 3.453 4 bits 50877 97.97
5103.60 6 2266.48 2204.895 251.770
0.976 3.300 12.843 3.892 7 bits 61241 101.92
4906.00 9 2506.59 2449.036 495.911
0.983 3.280 12.810 3.905 8 bits 61080 99.65
5017.51 9 2506.62 2449.036 495.911
```
#### Candidate:
```
Results:
NOTE: nDoc = 500000 for all runs; skipping column
NOTE: searchType = KNN for all runs; skipping column
NOTE: topK = 100 for all runs; skipping column
NOTE: fanout = 100 for all runs; skipping column
NOTE: resultSimilarity = N/A for all runs; skipping column
NOTE: decay = N/A for all runs; skipping column
NOTE: resultCount = 100.000 for all runs; skipping column
NOTE: maxConn = 64 for all runs; skipping column
NOTE: beamWidth = 250 for all runs; skipping column
NOTE: force_merge(s) = 0.00 for all runs; skipping column
NOTE: filterStrategy = null for all runs; skipping column
NOTE: filterSelectivity = N/A for all runs; skipping column
NOTE: overSample = 1.000 for all runs; skipping column
NOTE: bp-reorder = false for all runs; skipping column
NOTE: indexType = HNSW for all runs; skipping column
NOTE: rerank = no for all runs; skipping column
recall latency(ms) netCPU avgCpuCount quantized visited index(s)
index_docs/s num_segments index_size(MB) vec_disk(MB) vec_RAM(MB)
0.729 1.845 5.056 2.740 1 bits 51755 96.87
5161.40 5 2090.45 2020.836 67.711
0.843 1.870 5.904 3.157 2 bits 49123 98.38
5082.18 5 2146.54 2081.871 128.746
0.940 2.089 7.143 3.419 4 bits 50584 95.99
5209.04 6 2266.39 2204.895 251.770
0.988 3.255 12.872 3.955 7 bits 60998 100.92
4954.52 9 2506.59 2449.036 495.911
0.993 3.244 12.887 3.973 8 bits 60955 100.85
4958.01 9 2506.60 2449.036 495.911
```
</details>
--
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]