GitHub user xintongsong added a comment to the discussion: Flink-Agents Memory 
Design

Cross-posting from the community sync (Aug 6).

### Memory Types

There are multiple differences between Sensory Memory, Short-Term Memory and 
Long-Term Memory.
- Retention: how long is the memory item kept
- Access Pattern / Data Structure: Lookup / Map, GetRecentN / List, Search / 
Vector
- Visibility to user

Which should be the dominating differentiator? E.g., what if the user needs 
something with the access pattern of sensory data while the retention of 
short-term memory? 
> Idea from the sync: 
> - The dominating differentiator should be retention.
> - We may consider combine the Sensory Memory and Short-Term Memory, support 
> both Lookup and GetRecentN access, and expose to users.
> - Long-Term Memory may have information loss, during compaction and semantic 
> search. Therefore, users should be able to control whether and when a memory 
> item can be moved from Short-Term Memory into Long-Term Memory. Of course 
> users can also choose not to control this and leave it to the framework.

### Hybrid State Backend

Modifying Flink's State Backend, or creating a new State Backend can be 
complicated. 

Instead, I would suggest designing our own Memory Component, which may leverage 
Flink's State Backend and other storages that we need. Flink's checkpointing 
mechanism is providing callbacks that allows to do things during making and 
restoring from checkpoints. In high-level, this should be the same as having a 
hybrid state backend.

### Redistribution of Memory

One thing that the current design did not mention is the redistribution of 
memory. Imagine we stop the Flink job, change the parallelism, and resume the 
job from a checkpoint. In that case, the distribution of the keyed data over 
the parallel tasks changes, and we would need to redistribute the memory along 
with the keyed data. Flink's MapState already supported this. We need to figure 
out how the vector store, and the history store if we don't use Flink's 
existing states for this, should be redistributed in such cases.



GitHub link: 
https://github.com/apache/flink-agents/discussions/92#discussioncomment-14019549

----
This is an automatically sent email for issues@flink.apache.org.
To unsubscribe, please send an email to: issues-unsubscr...@flink.apache.org

Reply via email to