Repository navigation
fix(core): count a recall once, and only the memories it returns (#1407) - #1412
Merged
Merged
Conversation
The strategy arms (vector, fts5, hybrid, fusion) no longer touch counters: they are built from each other and work on a boost_window of candidates, so one default recall counted +3 per memory and bumped candidates that were never returned. The touch now happens once per user-level call on the final results: recall(), recall_hybrid() (cache hit or miss) and search(). recall_explained and the point-in-time candidate search are read-only. Adds a shared embedder-equipped test helper (test_support) and tests for every strategy. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
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.
What
vector,fts5,hybrid,fusion) no longer touch counters. The touch happens once per user-level call, on the final returned results:recall(),recall_hybrid()(cache hit or miss) andsearch()(unchanged).recall_inner,recall_fts5_onlyandrecall_rrflose their owntouch_recall_batch;compute_recalland the hybrid/FTS fallbacks callrecall_innerdirectly instead of the touchingrecall().recall_explained(built oncompute_recall) and the point-in-time candidate search are now read-only.explainused to bump counters like a real recall.test_support(embedder-equippedUtekewithout ONNX), reused by the room recall tests.Why
Closes #1407. One default (fusion) recall bumped
recall_countby 3 per memory (hybrid 2, vector/fts5/search 1), and the arms work on aboost_windowof up to4 * limit + 16candidates, so memories that were never returned were counted too. That made the feedback loop that #1337 weakens roughly three times stronger than intended. A repeated query served from the recall cache did not count at all; it now counts once per call like any other recall.Testing
-D warnings,cargo test --workspace(668 in uteke-core) and the vecq-only core lib tests greenlimit = 1counts exactly one memory exactly once and touches nothing else; three identical queries (cache hits) give 1, 2, 3; the public vectorrecall()counts returned results once;recall_explainedleaves every counter at 0. Three of the four fail against the oldoperations.rsdevelop3af904e vs this branch 7b4a678 (defaultstrategy, 10 shards). Aggregates identical: mean R@5 0.9800 vs 0.9800 (+0.0000), 0 questions improved, 0 regressed (compare_fast50.py); on the 43 scored questions recall_all@5 0.9767 and recall_all@10 1.0000 in both runs. 36 of 50 rows are byte-identical and 14 differ in ranking detail only (rankings are not deterministic, so only the aggregates count). The script's "GATE (+3pp)" line is a leftover of the rerank experiment and does not apply. fast50 uses one recall per question, so it shows no regression, not the effect of the counter fix.--at) candidate searches no longer count as recall hits (they used to touch every candidate); no schema or API change🤖 Generated with Claude Code