fix(retrieval): raise relevance-budget floor 0.25 -> 0.50 so moderate lock loads don't under-serve relevance (#1023) - #1024
Conversation
… lock loads don't under-serve relevance (#1023) Empirical sweep on a real lock-saturated store (24 locks=3491 tok vs 1500 budget): 0.25->0.50 doubles surfaced relevance hits (8->16; live hook 4->8) for ~9% more total tokens (3825->4182), cheap because never-trimmed locks already dominate the injection. Widens engagement to locks >50% of budget (was >75%); lock-light corpora stay byte-identical. Adds a test pinning floor engagement + budget overflow at moderate lock load.
There was a problem hiding this comment.
Sorry @robotrocketscience, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesRelevance Budget Floor Increase
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_relevance_budget_floor.py`:
- Around line 67-88: The regression test is too loose because it only checks
RELEVANCE_BUDGET_FLOOR_FRACTION >= 0.5 and relies on an approximate lock load,
so it won’t catch drift in the knee. Tighten
test_floor_engages_at_moderate_lock_load by measuring the locked token total
produced by the inserted locked beliefs and asserting it falls in the intended
50%-75% budget window before calling retrieve; if this test is meant to freeze
the tuning, also pin RELEVANCE_BUDGET_FLOOR_FRACTION to exactly 0.5.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7f177e74-823f-4b28-b679-24db3b745094
📒 Files selected for processing (3)
CHANGELOG/v3.mdsrc/aelfrice/retrieval.pytests/test_relevance_budget_floor.py
…tion holds (#1024 review) Locks are ~250 tok each, not ~150 — 10 locks landed at 104% (saturated), failing the new 50-75% window guard. 6 locks = ~1494 tok = 62%.
|
merge-train: merged a811dc0 → |
What
Raises
RELEVANCE_BUDGET_FLOOR_FRACTION(the relevance reservation under lock saturation, #1015) from0.25to0.50. Closes #1023.Why (R&D sweep on a real lock-saturated store: 24 locks = 3491 tok vs 1500 budget)
Because the never-trimmed locks already exceed the budget, the total injection is ~3500+ tokens regardless — the fraction only decides how much more relevance to add. 0.25 → 0.50 doubles relevance coverage (8 → 16 hits) for ~9% more total tokens. Verified end-to-end in the live hook on the real store: non-lock relevance hits went 4 → 8. Diminishing BM25-relevance past ~0.5 (hits 9–16 rank below 1–8) makes it the knee, not 0.75/1.0.
Behavior-change note
This widens the engagement regime: the floor engages once
locked_used > budget × (1 − fraction), i.e. locks > 50% of budget (was > 75%). Moderately-locked stores now reserve0.5 × budgetfor relevance and may exceed the nominal budget by up to that floor — the intended trade (never go blind to the query). Locks remain never-trimmed (#379); lock-light corpora (locks < 50% budget, e.g. LoCoMo) stay byte-identical.Tests
test_floor_engages_at_moderate_lock_load: locks ~62% of budget → relevance surfaces and total output exceeds the budget (the signal that distinguishes 0.5 from 0.25, where the cap would have held).Summary by CodeRabbit