mem0(@mem0ai)

https://t.co/qqBhgN45Eb

6.9内容质量

TL;DR · AI 摘要

mem0 on X: "Measuring Whether Memory Is Working in a Consumer App" / X mem0 @mem0ai $ /$ Measuring Whether Memory Is Wor...

核心要点

  • 主题聚焦:未命名内容
  • 来源:mem0(@mem0ai),建议结合原文判断细节。
  • AI 分析暂不可用,本条为保底评分与摘要。
#AI#编程#产品#开源
打开原文

mem0 on X: "Measuring Whether Memory Is Working in a Consumer App" / X

mem0

@mem0ai

$

/$

Measuring Whether Memory Is Working in a Consumer App

4 min read

Once an app has memory, people ask whether it is working. The usual dashboards show calls, tokens, and session counts. None of them show what memory is for or what it solved: the user who didn't have to repeat themselves, the agent that got a detail right, the user who came back because the app knew them.

Those outcomes are hard to see because they are things that do not happen (counterfactuals). A user who never has to restate an allergy leaves no event in the logs. To measure memory, you have to log the moments where memory should have helped, and compare users who have it with users who do not.

Session length moves in different directions

Memory changes how long sessions last, and the direction depends on the product.

  • Support assistant. The user does not re-explain their order, plan, or past ticket. The chat gets shorter, and shorter is good.
  • Companion. Memory reduces re-explanation and helps the companion be more proactive and engaging - sessions get longer, and longer is good.
  • Coach or tutor. Fewer turns go to setup ("what's your goal again?") and more go to the plan. Length can stay flat while the session gets more useful.

A broken memory setup also changes session length. Sessions get longer when the user has to correct the agent, and shorter when the user gives up. So the same number can mean memory is working or failing. Session length is useful once you know which way your product should move, and only next to the metrics below.

Directions show what to expect when memory works. Check them in your own product with a holdout.

Metrics that track memory directly

These four come from your own logs and apply to any consumer app.

Re-ask rate. The share of user messages that restate something the app had already stored. "I'm vegetarian, remember?" is a re-ask. Lower is better. It measures whether stored memories get retrieved when they are needed.

Correction rate. The share of sessions where the user corrects the agent about themselves: "That's not my sister's name", "I moved, I told you". Lower is better. It measures how often wrong or outdated memories enter a conversation.

Memory-in-prompt rate. The share of turns where at least one stored memory goes into the prompt. This shows whether memory is used at all. A low rate with a high re-ask rate means retrieval is missing things the user already said.

Your product's outcome metric. Pick the one that matches what memory should change:

Product

Outcome metric

Direction when memory works

Support assistant

Resolution without escalation, handle time

More resolved, shorter

Companion

Sessions per week, D30 retention

More sessions, higher retention

Coach or tutor

Plan or lesson completion, D30 retention

More completed, higher retention

Read every metric by user tenure. A user in their first session has nothing to recall, so memory can only show up from the second session on. Mixing new and returning users hides the effect.

Run a holdout

The metrics above show whether memory is used. Only a holdout shows what memory changes. Compare users who get memory with users who do not, picked at random, over the same weeks.

  • Pick the holdout from new users. Existing users already expect the app to remember them, and turning memory off for them can cause a noticeable regression. Assign 2 to 5% of new signups by hashing the user_id, so a user stays in the same group on every device.
  • Keep writing memories for the holdout. Only skip putting retrieved memories into the prompt. When the test ends, holdout users switch on with their history already in place.
  • Run the search for everyone. Holdout users need the same re-ask and correction logging, or the two groups are not comparable.
  • Decide the length and the size before you start. Run the test for at least your retention window (for example, 30 days for D30). Use a standard A/B sample-size calculator with the smallest change you care about.
  • Keep the holdout small and time-boxed. Holdout users get the app without memory for the length of the test.

At the end, compare the outcome metrics between the groups, and check that re-ask and correction rates are lower in the memory group. If the outcome moves and re-asks do not, look for another cause before you credit memory.

Setting it up on Mem0

Every user goes through the same search and the same logging. Writes happen for everyone too. The holdout flag only decides whether results are injected into the prompt.

python

code
import
hashlib
from
mem0
import
MemoryClient
client
=
MemoryClient
()
def
in_holdout
(
user_id
,
percent
=
3
):
bucket
=
int
(
hashlib
.
sha256
(
user_id
.
encode
()).
hexdigest
(),
16
) %
100
return
bucket
<
percent
def
memories_for_turn
(
user_id
,
message
):
# runs before this turn's add, for every user
results
=
client
.
search
(
message
,
filters
={
"user_id"
:
user_id
},
top_k
=
5
)[
"results"
]
holdout
=
in_holdout
(
user_id
)
log_event
(
"memory_search"
,
user_id
,
holdout
=
holdout
,
memory_ids
=[
m
[
"id"
]
for
m
in
results
],
scores
=[
m
[
"score"
]
for
m
in
results
])
if
results
and
is_restatement
(
message
,
results
[
0
][
"memory"
]):
log_event
(
"re_ask"
,
user_id
,
holdout
=
holdout
,
memory_id
=
results
[
0
][
"id"
])
return
[]
if
holdout
else
results
# after the turn, for every user, holdout included
client
.
add
(
last_messages
,
user_id
=
user_id
)

Re-ask check. The check runs on the search results before the add. After the add, the message matches its own new memory. is_restatement is a yes/no call to a small model: "Does this message repeat this stored fact?" Each result also carries a score. A restated fact scores higher than an unrelated message, but the gap depends on your data, so do not reuse a cutoff from another app. Label a few hundred of your own messages first, then pick a cutoff or keep the model check.

Correction check. Detect corrections with the same kind of yes/no call on the user's message, and log the memory_id the agent used. client.history(memory_id) returns every change to that memory with its time, so you can see when the wrong fact was written.

Memory-in-prompt rate. It comes straight from the memory_search events: turns with at least one memory in the prompt, divided by all turns for memory-group users.

If you run a companion, coach or tutor on Mem0 and want help setting up a holdout, send us your outcome metric, and we will help you design it.

References

  • Mem0 app
  • Mem0, Add memories
  • Mem0, Search memories

Written by @RudrajMehta , Product, Mem0

Memory Layer for your AI agents. Open source:

github.com/mem0ai/mem0

More Articles

Join 20.8K followers

3:49 PM · Nov 24, 2026

·

3,189

Views

1

4

40

38