Inline filtered search with adaptive L#1131
Conversation
…en/two-queue-adaptive-l
…en/two-queue-adaptive-l
…en/two-queue-adaptive-l
…en/two-queue-adaptive-l
hildebrandmw
left a comment
There was a problem hiding this comment.
Thanks Magdalen! In addition to my inline comments - can you also add some integration tests exercising the functionality here? These go a surprisingly long way towards protecting the algorithm.
Also, can we bikeshed InlineSearch a little? Maybe FilteredSearch? Or InlineFilteredSearch? Not a huge deal, but InlineSearch seems a little opaque to me.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1131 +/- ##
==========================================
+ Coverage 89.45% 90.56% +1.11%
==========================================
Files 484 487 +3
Lines 91407 92443 +1036
==========================================
+ Hits 81765 83722 +1957
+ Misses 9642 8721 -921
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
I've added some integration test. In addition to throwing some of the existing cases in multihop at it, I also designed a test that should return different results depending on whether or not the adaptive L feature is enabled. Regarding the naming, I named it |
There was a problem hiding this comment.
Pull request overview
This PR adds a new “inline filtered search” path (with optional adaptive L scaling) to the diskann graph search API and wires it through the benchmark harness and test suite.
Changes:
- Introduces
InlineSearch+AdaptiveLindiskann/src/graph/search/inline_filter_search.rsand re-exports them fromdiskann::graph::search. - Adds end-to-end and algorithm-focused tests for inline filtered traversal behavior.
- Extends
diskann-benchmark/diskann-benchmark-coreto support a newtopk-inline-filtersearch phase, including an example JSON and integration test.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| diskann/src/graph/test/cases/multihop.rs | Exposes test helpers/filters (pub(super)) for reuse by the new inline test suite. |
| diskann/src/graph/test/cases/mod.rs | Registers the new inline test module. |
| diskann/src/graph/test/cases/inline.rs | Adds end-to-end tests for index.search(InlineSearch { .. }), including adaptive-L behavior. |
| diskann/src/graph/search/multihop_search.rs | Alters scratch initialization (currently introduces a safety/correctness regression if scratch is reused). |
| diskann/src/graph/search/mod.rs | Adds the inline search module and publicly re-exports InlineSearch/AdaptiveL. |
| diskann/src/graph/search/inline_filter_search.rs | Implements inline filtered search and adaptive-L sizing; includes unit tests. |
| diskann-benchmark/src/main.rs | Adds an integration test that runs the new inline-filter example config. |
| diskann-benchmark/src/inputs/graph_index.rs | Adds TopkInlineFilter search phase + adaptive-L config parsing/validation. |
| diskann-benchmark/src/backend/index/spherical.rs | Registers and implements the inline-filter search plugin for spherical backend. |
| diskann-benchmark/src/backend/index/search/plugins.rs | Adds the TopkInlineFilter plugin type/kind mapping. |
| diskann-benchmark/src/backend/index/search/knn.rs | Adds Knn trait implementation for benchmark_core::search::graph::InlineSearch. |
| diskann-benchmark/src/backend/index/benchmarks.rs | Registers and implements the inline-filter search plugin for the main backend. |
| diskann-benchmark/example/graph-index-inline-filter.json | Adds a runnable benchmark example for topk-inline-filter with adaptive_l. |
| diskann-benchmark-core/src/search/graph/mod.rs | Exposes the new benchmark-core inline graph search helper module/type. |
| diskann-benchmark-core/src/search/graph/inline.rs | Adds benchmark-core InlineSearch wrapper + tests for inline filtering behavior. |
💡 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>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
hildebrandmw
left a comment
There was a problem hiding this comment.
Thanks Magdalen, my main concern here is getting in decent test coverage using the baseline testing infrastructure. It's more robust than ad-hoc metrics since it can store and validate a lot more information.
Also to bike shed, I do think InlineSearch is a bit vague. Maybe InlineFilteredSearch? Or FilteredKnn?
Refactor integration tests to (1) ensure that the piecewise regime of adaptive-L is properly hit and (2) ensure there is differentiation between the adaptive algorithm and the standard fixed algorithm. This uses a 1D grid with an exactly seeded filter to ensure the target specificities are hit during the search to the query. By putting additional filter points just outside the window that can be reached with a standard search, we can verify that the various regimes of adaptive-L are properly hit. --------- Co-authored-by: Mark Hildebrand <mhildebrand@microsoft.com>
This PR implements the recommendation in the filtered search RFC to implement inline filtering with the adaptive L method as an optional addition.