mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

adding same memory twice deletes old memory

Open munjalmukul opened this issue 1 year ago • 7 comments

🐛 Describe the bug

When adding exact same memory multiple times it just performs delete operation and delete previous memory.

Ideal Behaviour - None of the operation should be performed and it should not call any tool when exact same memory is added multiple times

example - Existing Memories:\n[{'id': 'fe966e90-75e1-4f3d-ac6e-be3ee3f7eaeb', 'memory': 'The dog is a domesticated descendant of the wolf. Also called the domestic dog, it was domesticated from an extinct population of Pleistocene wolves over 14,000 years ago. The dog was the first species to be domesticated by humans.', 'score': 0.99999726}]

New Memory: The dog is a domesticated descendant of the wolf. Also called the domestic dog, it was domesticated from an extinct population of Pleistocene wolves over 14,000 years ago. The dog was the first species to be domesticated by humans.

operation performed

{'content': None, 'tool_calls': [{'name': 'delete_memory', 'arguments': {'memory_id': 'fe966e90-75e1-4f3d-ac6e-be3ee3f7eaeb'}}]}

munjalmukul avatar Aug 09 '24 07:08 munjalmukul

Why do I only have one memory every time? It's strange. It's very easy to lose previous memories

zouhuigang avatar Aug 09 '24 07:08 zouhuigang

its not every time the same memory will be added but if at some point I am adding exact same memory then it should not forgot that

munjalmukul avatar Aug 09 '24 08:08 munjalmukul

Hey @munjalmukul Thank you for pointing out this issue. I tried to reproduce it but couldn't get the results you got. For me, it's actually called the update_memory.

We will be working on improving the prompt here but while you find a solution please feel free to raise a PR.

Dev-Khant avatar Aug 09 '24 15:08 Dev-Khant

@Dev-Khant just observed when using gpt-4o-mini the delete operation is happing and switching to gpt-4o fixed this, but this is not a concrete solution as gpt-4o can also hallucinate and delete memory

munjalmukul avatar Aug 22 '24 07:08 munjalmukul

@Dev-Khant just observed when using gpt-4o-mini the delete operation is happing and switching to gpt-4o fixed this, but this is not a concrete solution as gpt-4o can also hallucinate and delete memory

Yes you are right, we will have to improve the prompts here. Feel free to make a PR if have a better solution or else we will work on it :)

Dev-Khant avatar Aug 25 '24 10:08 Dev-Khant

Same problem in my test. In my opinion, the memory management is the pivotal feature of mem0, and it functions effectively. However, there are lingering issues, such as this one, which perplex users. Despite relying on the library to handle memory operations, we encounter unpredictable outcomes.

Specifically, after calling mem.add(memory_info), the subsequent actions are determined by llm (via tools). Consequently, adding a new memory like I love math might result in updating I love apple to I love math, effectively deleting the memory associated with apple.

This is a complex issue that isn't easily resolved, and I simply want to emphasize it here. Hopefully, we can discover a better approach to address this.

shenxiangzhuang avatar Sep 03 '24 02:09 shenxiangzhuang

@shenxiangzhuang Apologies for the trouble you encountered with this issue. We are already working on fixing on this issue and it will be released soon. Meanwhile you can the platform if it's a critical use case.

Dev-Khant avatar Sep 03 '24 18:09 Dev-Khant

Hey this issue seems to be fixed with the new versions of mem0. Feel free to try and test it out. Thanks!

parshvadaftari avatar Oct 10 '25 22:10 parshvadaftari