In my first post
I listed what I had not measured. One item bothered me: what happens when a fact changes.
Memory Assistant replaces a fact in place when it has a key ("lives in" Pune, then "lives in" Delhi). But most facts
have no key. "My 5K personal best is 27:12", and weeks later "25:50": the store keeps both, and search ranks them by
how well they match the question. Nothing says the second one is newer.
First, measure it
LongMemEval-S has knowledge-update questions: the user said something twice with a different value, and the question
asks for the current one. The dataset marks both turns as evidence, and every session has a date, so I could split
the evidence into new and old and ask a question the usual recall metrics cannot: which one comes first?
70 questions could be scored this way. With my default (hybrid search), the new value came first in only 0.471 of
them. More than half the time, a model reading the results would see the outdated value first.
Then, write the rule before the fix
I have made this mistake before: try a fix, see a good number, call it the default. So before writing any code I
committed a rule. The method: re-order only the top 20 results, and let a newer memory move up at most 3 places
(sort by position - 3 * freshness). Two parameters, fixed in advance, no tuning. It becomes the default only if:
- the new value comes first at least 0.05 more often, and the old value alone in the top 5 does not rise;
- no other LongMemEval-S question type drops more than 0.02;
- LoCoMo recall@5 drops no more than 0.01;
- my own eval sets lose no case.
What happened
| Condition | Before | After | |
|---|---|---|---|
| New value first (70 questions) | 0.471 | 0.729 | met |
| Old value alone in the top 5 | 0.057 | 0.057 | met |
| Worst drop on another LongMemEval-S type | 0.016 | met | |
| LoCoMo recall@5 | 0.561 | 0.558 | met |
| Own eval sets | 26/27, 23/24 | 24/27, 16/24 | failed |
Three out of four, and a big win on the thing I set out to fix. And my own test set fell from 23/24 to 16/24.
The reason is simple once you see it. In my own cases, all the facts arrive in one message ("I live in Jaipur. I
work as an accountant. I like cricket..."), so they are written microseconds apart. "Newer" then just means "later in
the sentence", and recency promotes whichever fact came last. The same thing costs LoCoMo recall@1 (0.285 to 0.247),
because turns in one session are seconds apart.
So, as the rule says, it ships off by default (RECENCY=1 turns it on), and the README shows both sides.
What I took from it
- Measure the failure before you fix it. "Recall" counted both values as correct. The question that mattered was which came first, and nobody's metric asked it.
- A rule written first protects you from your own good number. +0.258 is tempting. Without the rule I would have tuned the window until my own sets passed, and called that a result.
- Recency is a guess about which fact is current. It is a good guess when facts arrive over weeks and a bad one when they arrive together. The real fix is to notice that two memories disagree about the same thing, which this does not do.
This release also added per-user access keys (a user's key gets 403 for anyone else) and Dependabot. It is the last
feature release; the project is in maintenance mode now.
Code, the rule as committed before the run, and every raw result:
https://github.com/munendra07-tech/memory-assistant (release v0.4.0)