feat(memory): add MEMTIER five-signal retrieval scoring#4463
Merged
Conversation
66a5008 to
400d01d
Compare
Extends tiered_retrieval.rs with four new scoring signals applied after recall_routed() and before assemble_within_budget(): 1. Recency decay: exp(-ln2 / half_life_days * age_days) 2. BM25/TF-IDF: inline implementation, no new dependencies 3. Cognitive signal: fact_access_log count proxy (normalized) 4. Tier boost: additive weight for consolidated/semantic entries All new config fields in TieredRetrievalConfig default to 0.0 except similarity_weight=1.0, preserving backward-compatible behaviour. DB queries for recency and tier signals are weight-guarded — no extra SQL in default config. All three new store functions are instrumented with tracing::instrument. Closes #3987
e2f4765 to
d252ccc
Compare
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.
Summary
Implements four retrieval scoring signals from arXiv:2605.03675 (MEMTIER) in
tiered_retrieval.rs, addressing issue #3987.exp(-ln2 / half_life_days * age_days)— entries decay exponentially; lambda expressed as half-life in days for intuitive configfact_access_logcount proxy (normalized) — entries accessed more frequently after tool calls rank higherDesign
All signals are applied in a new
score_candidates()step inserted betweenrecall_routed()andassemble_within_budget(). Combined via weighted sum:All new config fields in
TieredRetrievalConfigdefault to0.0exceptsimilarity_weight = 1.0, preserving exact backward-compatible behaviour with no config changes.Performance
tracing::instrumentTest plan
Closes #3987