memory with agents in Smallville
Hello readers! As I have completed my AWS certification, we are now back to our regularly scheduled programming! I never again want to hear or discuss data stream sharding in my lifetime (or atleast a week or two).
Today I thought I would talk about memory - a subcomponent of agent systems. Memory refers to a module that records agent experiences and is needed for agents, especially when they are performing long horizon tasks as the current context window may be unable to hold all the event stream data.
I came across this paper Generative Agents: Interactive Simulacra of Human Behavior while doing research into memory to understand more about how I can score memories effectively. It's an interesting paper and I could dedicate a whole another log to get into it completely. In brief, the researchers enabled twenty-five agents to interact with each other using natural language in a Smallville/sandbox environment to participate in social behaviors.
"For example, starting with only a single user-specified notion that one agent wants to throw a Valentine’s Day party, the agents autonomously spread invitations to the party over the next days, make new acquaintances, ask each other out on dates to the party, and coordinate to show up for the party together at the right time"
When agents are interacting in their environment, they will look at their memory stream and retrieve relevant memories to determine their next actions. These memories retrieved can help agents determine plans and they can use their memories to guide their reflections which will go back into the memory stream for future uses.
When it comes to memory, this is the scoring used in the paper: 1) recency - higher score to memory that was more recent. Can use exponential decay functions to creating scoring algos so recent memories score higher. 2) importance - higher score to memories that are more important and in this paper, they just prompted the language model to output integer scores at the time of creating the memory object. 3) relevance - higher score to memory objects related to current situation based on query memory. This is with creating embedding vectors of the memory and then creating a score for relevancy based on the current query's memory vector.
Based on many memories, reflections can be created. These are higher-level and generated periodically. The agent's recent memories can be queried to extract key insights and can be stored in the memory stream. This allows agents to reflect on memories as well as reflections.
Memory was something that was most interesting to me, but of course, memory is only one piece. Sidenote: I think it's so interesting how researchers are abstracting human processes to replicate with AI agents. I'll be exploring future pieces of the puzzle in future logs.