You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reduce the build and search time of the HNSW index so it is close to industry standard HNSW libraries on ANN-Benchmarks, and if we can't get there, mention what is causing the gap and what would need to change later.
scope
only index build time and search time
delete is out of scope
current plan
run ANN-Benchmarks on the VortexDB HNSW index
run hnswlib on the same machine with the same settings and compare the recall vs queries per second curves and build times
study where VortexDB is behind at the same recall
profile build and search with flamegraphs to see where the time is actually going
optimise the biggest time losses one at a time, re running the benchmark after each change and comparing
write up the before/after results, and for anything still behind, what is causing it and what would need to change
codebase: went through the codebase partly, the architecture, understood the HNSW insert and search path and how its different from hnswlib, three things that i plan to optimise first:
only rerank when the neighbour list is full. right now every backlink adds the new point and then recalculates the distance from the neighbour to all its existing neighbours and sorts them, even if there is space for one more.
use the diversity criterion when trimming a full list. right now a full list keeps the closest M neighbours by distance, changing this to going from closest to farthest and only keeping a candidate if it's closer to the node than to any neighbour already kept. this should improve recall at high ef.
make the writes concurrent (dont know enough rust for this yet, will approach in some days)
rust: learning rust, not done yet, so I will start writing code in about 3 to 4 days
benchmark: An ANN-Benchmarks wrapper that runs VortexDB through the gRPC server written, i ran it against hnswlib on the same machine.
settings: Fashion-MNIST (60k vectors, 784 dims, euclidean), M=16, efConstruction=200, ef from 10 to 800, k=10, single core, on Apple Silicon Mac (arm)
recall@10
hnswlib QPS
VortexDB QPS
VortexDB without gRPC (estimate)
0.95
3993
1698 (2.4x slower)
2370 (1.7x slower)
0.99
2455
1145 (2.1x slower)
1416 (1.7x slower)
0.999
1110
372 (3.0x slower)
396 (2.8x slower)
index build
82s
124s (1.5x slower)
will improve:
my mac is arm and hnswlib only has its SIMD distance code for x86, so the gap is probably wider on an Intel or amd machine.
the without gRPC column is an approximation, I measured the gRPC time on a server with only 10 vectors and subtracted the mean from each query.
next: start profiling with flamegraphs(will take sometime, still learning how to profile properly).
should i make a PR for the benchmark adaptor or keep running it locally whenever needed?
gRPC is the design so I have not built native Python bindings, is that needed in this major?
@Shashank-k15 update: benchmarks on SIFT-1M dataset. ran these on my personal linux machine, not in campus so couldn't use kratos for this. the simd working on x86 for hnswlib now.
settings: 1M × 128, M=16, M0=32, efC=200, k=10, one thread, one core. seeds 100/101/102, median over the 3 seeds:
also, for these i ran the bench in the same process as the index, no grpc. i can run it with grpc later if needed. this way is more useful to me for now, with grpc the gains from my changes were very hard to get consistent since the network request cost made them fluctuate a lot, now i can see what each change made better or worse. it's also fairer to compare with hnswlib, since that runs in process too.
i'll run the final benchmarks with the server after the major changes are in. can i keep doing it without the server till then?
Activity
pranav7002 commentedon Oct 14, 2026
update, 14 Oct
codebase: went through the codebase partly, the architecture, understood the HNSW insert and search path and how its different from hnswlib, three things that i plan to optimise first:
rust: learning rust, not done yet, so I will start writing code in about 3 to 4 days
benchmark: An ANN-Benchmarks wrapper that runs VortexDB through the gRPC server written, i ran it against hnswlib on the same machine.
settings: Fashion-MNIST (60k vectors, 784 dims, euclidean), M=16, efConstruction=200, ef from 10 to 800, k=10, single core, on Apple Silicon Mac (arm)
will improve:
next: start profiling with flamegraphs(will take sometime, still learning how to profile properly).
Shashank-k15 commentedon Oct 29, 2026
You can use Kratos for benchmarking from now on, also update the numbers once you do it.
I don't think you need to do that.
No.
Shashank-k15 commentedon Oct 29, 2026
Use the SIFT-1M dataset for the benchmarks (you can use the Fashion-MNIST or siftsmal for quick tests)
pranav7002 commentedon Nov 28, 2026
@Shashank-k15 update: benchmarks on SIFT-1M dataset. ran these on my personal linux machine, not in campus so couldn't use kratos for this. the simd working on x86 for hnswlib now.
settings: 1M × 128, M=16, M0=32, efC=200, k=10, one thread, one core. seeds 100/101/102, median over the 3 seeds:
#104 vs main:
pushwas increasing the size of the Vec by doubling it, so there was leftover capacity.also, for these i ran the bench in the same process as the index, no grpc. i can run it with grpc later if needed. this way is more useful to me for now, with grpc the gains from my changes were very hard to get consistent since the network request cost made them fluctuate a lot, now i can see what each change made better or worse. it's also fairer to compare with hnswlib, since that runs in process too.
i'll run the final benchmarks with the server after the major changes are in. can i keep doing it without the server till then?