Create benchmarks for the flat index (full-precision in-memory implementation)#1170
Create benchmarks for the flat index (full-precision in-memory implementation)#1170arrayka wants to merge 14 commits into
Conversation
# Conflicts: # diskann-benchmark/src/backend/mod.rs
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1170 +/- ##
==========================================
+ Coverage 89.46% 89.67% +0.21%
==========================================
Files 487 506 +19
Lines 92170 96155 +3985
==========================================
+ Hits 82460 86229 +3769
- Misses 9710 9926 +216
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new end-to-end benchmark backend for diskann::flat::FlatIndex::knn_search, establishing a baseline for full-precision in-memory brute-force kNN performance (recall + latency) to support future flat-search optimizations.
Changes:
- Registers a new
flat-indexbenchmark backend and adds an integration test wired to a new example input. - Introduces a
FlatSearchinput schema and JSON examples/perf-test inputs for running flat-index benchmarks. - Implements an in-memory
DataProvider+SearchStrategythat performs a full sequential scan usingFastMemoryVectorProviderAsync.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| diskann-benchmark/src/main.rs | Registers the new flat backend; adds a flat-search integration test; renames the temp input file used by the shared integration helper. |
| diskann-benchmark/src/inputs/mod.rs | Exposes the new flat benchmark input module. |
| diskann-benchmark/src/inputs/flat.rs | Adds FlatSearch / SearchPhase input schema, validation hooks, and display formatting. |
| diskann-benchmark/src/flat/mod.rs | Adds the flat benchmark module entry point and registration function. |
| diskann-benchmark/src/flat/search.rs | Implements the flat benchmark backend (provider + scan strategy + search runner + aggregation + formatting). |
| diskann-benchmark/perf_test_inputs/wikipedia-100K-flat-index.json | Adds a perf-test job configuration for wikipedia-100K flat search. |
| diskann-benchmark/example/flat-index.json | Adds an example job configuration used by the new integration test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
arkrishn94
left a comment
There was a problem hiding this comment.
Thanks for working on this Alex. Just have one non-minor comment - we should be using a provider, visitor and DistancesUnordered implementation as is in the benchmark. Maybe this PR can include the implementation of these for the full precision provider?
| /// The visitor that iterates over all vectors in the provider. | ||
| struct FlatVisitor<'a, T: VectorRepr> { | ||
| data: &'a FastMemoryVectorProviderAsync<T>, | ||
| } |
There was a problem hiding this comment.
Same comment as above, we should have a visitor implementation for FastmemoryVectorProviderAsync and that should exist along with its definition.
Establishes a baseline benchmark for
FlatIndex::knn_search, enabling evaluation of new capabilities and innovations in DiskANN's flat-scan implementation.Why Add Flat Index Benchmarks if Exhaustive Exists?
Exhaustive benchmarks are lightweight benchmarks focused on quantizer speed and accuracy: they measure compress + distance performance in isolation, without involving the
FlatIndexmachinery or any data provider. They operate entirely outside the DiskANN provider/index abstraction.Flat benchmarks are end-to-end benchmarks that exercise
FlatIndexwith different strategy configurations. They exerciseFlatIndexthrough the actual provider and search strategy abstractions, so they capture realistic runtime behavior, and integration overhead that exhaustive benchmarks intentionally skip.This PR enables full-precision in-memory flat search. Future work may add:
Changes
diskann-benchmark/src/flatbenchmark module with:InMemProviderwrappingFastMemoryVectorProviderAsync(cache-line-aligned vector storage) with identityDataProvidermappingFlatScanStrategyandFlatVisitorimplementingSearchStrategy/DistancesUnorderedFlatSearcherimplementing theSearchtrait frombenchmark_corediskann-benchmark/src/inputs/flat.rs) with dataset, distance metric, queries, groundtruth, k, thread counts, and repsflat_search_integration) and example input (diskann-benchmark/example/flat-index.json)diskann-benchmark/perf_test_inputs/wikipedia-100K-flat-index.json)run_integration_testfromgraph-index.jsontoinput.json- the helper is shared by all backends, not just graph-indexFollows established patterns from the graph-index and exhaustive backends.
Output example: