Simplify expand_beam_accept_only pre-filter predicate#1192
Open
hildebrandmw wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the FilteredAccessor::expand_beam_accept_only predicate contract to make the “pre-filter vs accepted-only mutation” distinction explicit, reducing confusion around when Accept<Self::Id> must be constructed and passed to eval_mut.
Changes:
- Change
expand_beam_accept_onlyfromP: HybridPredicate<Accept<Self::Id>>toP: Predicate<Self::Id> + PredicateMut<Accept<Self::Id>>. - Update the labeled
FilteredAccessoradaptor (ext/labeled.rs) to match the new predicate bounds and evaluation flow. - Remove now-unneeded
NotInMutimpls forPredicate<Accept<T>>/HybridPredicate<Accept<T>>.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| diskann/src/graph/glue.rs | Updates expand_beam_accept_only trait bounds/docs and prunes NotInMut impls that are no longer required by the new API. |
| diskann/src/graph/ext/labeled.rs | Adapts the QueryLabelProvider-based FilteredAccessor wrapper predicate logic and bounds to the new accept-only predicate split. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+457
to
+460
| /// The [`Predicate`] bound takes unclassified IDs and is side-effect-free, so it can | ||
| /// pre-filter IDs before paying the cost of classification. As with [`HybridPredicate`], | ||
| /// implementors can assume that [`Predicate`] and [`PredicateMut`] "get along" with | ||
| /// respect to `eval(id)` and `eval_mut(Accept::new(id))`. |
metajack
approved these changes
Jun 19, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1192 +/- ##
==========================================
+ Coverage 89.46% 90.07% +0.61%
==========================================
Files 487 487
Lines 92170 92322 +152
==========================================
+ Hits 82460 83160 +700
+ Misses 9710 9162 -548
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
magdalendobson
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#1141 introduced the
FilteredAccessortrait with twoexpand_beamstyle methods. This split existed because evaluation of theHybridPredicatediffered subtly between the "all" and "accept only" paths, but this difference was sufficient to completely tank recall in multi-hop filtered search if rejected IDs were passed to thePredicateMut. The two-method solution made this harder, but at the cost of needing to create a newAccepttype to pass toPredicateeven before a decision had been made, which is confusing.I think this cleans up that confusion by changing the bound on
expand_beam_accept_onlyfromto
This makes it clear that raw, unclassified IDs can be used for the non-mutating evaluation while only accepted IDs can be passed to
eval_mut. The docs have been updated to reflect that the rules ofHybridPredicatealso apply to this pair of traits.