wawawario2 / long_term_memory

A gradio web UI for running Large Language Models like GPT-J 6B, OPT, GALACTICA, LLaMA, and Pygmalion.
GNU Affero General Public License v3.0
308 stars 15 forks source link

During memory retrieval, filter similar memories #36

Open Interpause opened 1 year ago

Interpause commented 1 year ago

Over time, duplicate memories may enter the system. This makes retrieval less diverse as it will end up retrieving multiple copies of the same memory, just worded differently. It is possible to use cosine similarity between retrieved memories to filter out duplicates, then try and retrieve additional memories that arent duplicates. Optionally, memories could be randomly sampled both on the cosine similarity to add diversity to the retrieval?

Anvil-Late commented 1 year ago

Or we could make it so that if an input is too cosine-similar to a memory, it is not added to it.