Repository navigation
feat(retrieval): SELECT EVIDENCE, budgeted covering selection - #120
Merged
Merged
Conversation
…redges SELECT EVIDENCE FOR (RANK ...) chooses a small set of hyperedges that together answer a RANK query, under a limit on the number of hyperedges, on their total member count, or both. A set's value spreads each hyperedge's relevance over its members, caps what any atom contributes, and adds the weighted coverage of the query's slots, so a near duplicate adds little. The value is monotone and submodular: a lazy greedy is within 1 - 1/e under a count limit, and cost-benefit greedy with the best single candidate within (1 - 1/e) / 2 under a budget. The message reports an upper bound on the best value from the candidates. With FROM and CONNECTED, candidates come with their expansion chains back to the seeds and a set stays connected. No issue tracks this work.
Hyperedges reached by the expansion that are not of the RANK type now have no relevance and cover no slot, so they are only chosen to connect others. With both TOP and BUDGET, greedy prices a hyperedge by the larger share of either limit it uses and is compared with a count-only greedy. Connected units are priced by how many hyperedges they add. Ranking, expansion and selection each get their own share of the budget; when selection runs out it returns the set chosen so far and says it has no bound. Gains are computed from the unit's own members, member loading is metered and capped at 10,000, and only members the reader can see count. CANDIDATES without FROM is refused. No issue tracks this work.
venkat1701
changed the base branch from
feature/hypergraph-diffusion
to
main
November 23, 2026 11:17
…ieval # Conflicts: # docs/database/hql.md # server/src/main/java/io/hstore/server/StatementLogger.java
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.
Stacked on #119 because it uses
EXPAND FROMto find connected candidates. Merge #115 and #119 first, then retarget this tomain.SELECT EVIDENCEpicks a small set of hyperedges that together answer aRANKquery, sized for handing to an agent. You give it a limit on the number of hyperedges (TOP), on their total member count (BUDGET), or both.The syntax is open for renaming before merge.
What a set is worth (
retrieve/Selection.java). Each hyperedge'sRANKscore is spread over its members and capped per atom atKAPPA. On top of that, each query slot counts once, weighted, as soon as some chosen hyperedge fills it. A near duplicate therefore adds little, and an exact copy adds nothing once its members are capped. The value is monotone and submodular.How it chooses
TOPonly, lazy greedy, which is within1 - 1/eof the best set.BUDGET, greedy by gain per member, compared with the best single candidate. That is within(1 - 1/e) / 2.objective / boundis a certified quality figure for the query.FROM … CONNECTED, each chosen hyperedge brings its expansion chain back to a seed, so the set stays connected. That mode has no ratio, but the bound still holds.Candidates
RANKtop list, plus up toCANDIDATEShyperedges reached from the seeds.Budget. Ranking, expansion and selection each get their own share of the budget. If selection runs out, it returns what it has chosen so far and says so.
Testing
SelectionTest:SelectEvidenceTest: the statement end to end: duplicates skipped, connected selections, other-type hyperedges left out, invalid clauses refused.SecurityTest#evidenceSelectionCountsOnlyTheTenantsMembersinjects another tenant's member into an edge. The edge must still cost 1 and the hidden member must not appear.Independent review. No critical issues. All five important ones are fixed, each with a test that failed before the fix:
RANKtype filterNot done here
CONNECTEDmode, aRANKcandidate the expansion did not reach cannot be chosen.