# Technical Document Extraction: LLM Agent Memory System
## Diagram Overview
The image depicts a four-stage process for an LLM (Large Language Model) agent memory system. The flow involves **Note Construction**, **Link Generation**, **Memory Evolution**, and **Memory Retrieval**. Below is a detailed breakdown of components, labels, and workflow.
---
## 1. **Note Construction**
### Components:
- **Environment**: Interacts with LLM Agents (represented by a robot icon).
- **LLM Agents**: Generate responses based on environmental input.
- **Conversation 1**:
- *"Can you help me implement a custom cache system for my web application? I need it to handle both memory and disk storage."*
- **Conversation 2**:
- *"The cache system works great, but we’re seeing high memory usage in production. Can we modify it to implement an LRU eviction policy?"*
- **Note Attributes**:
- **Timestamp**
- **Content**
- **Context**
- **Keywords**
- **Tags**
- **Embedding**
### Workflow:
1. **Environment** → **LLM Agents** → **Write** (generate responses to conversations).
2. **LLM Agents** → **Note Construction** (extract attributes from conversations).
3. **Note** → **LLM** (embedding generation).
---
## 2. **Link Generation**
### Components:
- **Memory**: A database of memory boxes (e.g., `Box 1`, `Box i`, `Box j`, `Box n+1`, `Box n+2`).
- **LLM**: Processes memory retrieval and storage.
- **Top-k**: Selected memory boxes for further processing.
### Workflow:
1. **Retrieve** memory boxes (`Box 1`, `Box i`, `Box j`, etc.).
2. **LLM** → **Top-k** (select relevant memories).
3. **Store** evolved memory boxes (`Box n+1`, `Box n+2`).
---
## 3. **Memory Evolution**
### Components:
- **Top-k**: Selected memory boxes from Link Generation.
- **LLM**: Evolves memory boxes.
- **Action**: Represents the evolution process (e.g., modifying memory structure).
### Workflow:
1. **Top-k** → **LLM** → **Evolve** (modify memory boxes).
2. **Evolved Memory** → **Store** (update database with new versions).
---
## 4. **Memory Retrieval**
### Components:
- **Retrieve**: Query memory database.
- **Text Model**: Converts queries into embeddings.
- **Query**: User input for retrieval (e.g., *"How do I implement an LRU eviction policy?"*).
- **Query Embedding**: Vector representation of the query.
- **Relative Memory**: Memory boxes most relevant to the query.
### Workflow:
1. **Retrieve** → **Text Model** → **Query Embedding**.
2. **Query Embedding** → **Relative Memory** (match with stored memories).
3. **LLM Agents** → **Action** (generate response based on retrieved memory).
---
## Key Observations
- **Circular Flow**: Memory boxes are continuously retrieved, evolved, and stored, creating a feedback loop.
- **Embeddings**: Used in both Note Construction (for notes) and Memory Retrieval (for queries).
- **LLM Role**: Central to all stages, acting as a processor for conversations, memory evolution, and retrieval.
---
## Diagram Structure
- **Spatial Grounding**:
- **Note Construction**: Leftmost section.
- **Link Generation**: Middle-left.
- **Memory Evolution**: Middle-right.
- **Memory Retrieval**: Rightmost section.
- **Legend**: No explicit legend present; colors (blue boxes, gray arrows) are consistent across stages.
---
## Notes
- No numerical data or charts present; the diagram focuses on process flow and component interactions.
- All text is in English; no additional languages detected.