enricoros / big-AGI

Generative AI suite powered by state-of-the-art models and providing advanced AI/AGI functions. It features AI personas, AGI functions, multi-model chats, text-to-image, voice, response streaming, code highlighting and execution, PDF import, presets for developers, much more. Deploy on-prem or in the cloud.
https://big-agi.com
MIT License
5.34k stars 1.21k forks source link

Memory Manager #294

Open shiribailem opened 9 months ago

shiribailem commented 9 months ago

Related to #293 and #94 , probably a long term goal, very non-trivial.

One of the big hurdles in AGI is actual persistence of knowledge. What I've thought for a while would be a great way to approach this would be a meta-ai pass that accessed and maintained a memory database.

The gist of it is that it would first take the conversation and highlight details and topics that it deems worth "remembering", condenses them into raw details and gives them some tags. On future passes it could update those memories as things relate to them, possibly editing the tags as well (such as remembering you talking about your boyfriend Zach but then updating it when you mention you broke up with him, so the tag changes from boyfriend to ex-boyfriend and expands to include what you said about the breakup)

Then on a new request, it would look at the list of tags and see if any stand out as relevant, if so, it'll pull that content and feed it into the system prompt as background information for it to "remember".

Some of the simplest benefits is that this could be used to potentially have an "infinite" conversation, as it might only need the past few messages and the rest gets supplemented with this "memory".

It also can be used significantly for long term routine conversations, like using ReAct to give a breakdown of news headlines, it can "remember" previous headlines and use them as context in the conversation.

enricoros commented 9 months ago

This is a very good idea, and something we should absolutely add. However the definition itself is still a bit vague.

Can you give this a bit of more thought and define it further? For instance: is this an abstraction, in which case what's the one memory interface to rule them all - or is this a specific technique (in which case, I'd love to see more the architecture/mechanics of it).

shiribailem commented 9 months ago

I don't have an exact concepts... haven't had the spoons to do more than just imagine how it would hypothetically work.

The gist of my thought is that it would work in a similar fashion to ReAct, with an added layer to store new data and maybe a proactive "context" system.

In concept whenever a request is made, there would be a request much like with ReAct figuring out what to do with it, but instead of searching the web it'll search a local database (the memory). That database would be populated by periodically running a sort of flatten/condense on the conversation, sorting that information into the database by context clues and tags suggested by additional requests.

The "context" system would just be emulating human memory a bit by taking various chunks that if they show up in requests then they'll be surfaced automatically (though our memory does this predominately with location), as well as linking them together so they'll pull in associated data. (This would probably be a sorting request where we'd ask the AI to note if topics should be related, or if one of the new topics/tags fits under an existing one).

I figured most of all this comment would be a place to both inspire the thought as something to work on and ground further discussion in how it might be implemented.

enricoros commented 9 months ago

Thanks for the inputs. Will circle back to this.