- name
- selective-forgetting-agent-memory-biological
- description
- Biologically-inspired selective forgetting framework for LLM agent memory management. Combines hippocampal indexing theory and Ebbinghaus forgetting curve for efficient, secure, and quality-preserving memory pruning. Use for: agent memory optimization, privacy-preserving AI, memory-constrained deployment. Triggers: selective forgetting, memory pruning, agent memory, forgetting mechanism, hippocampal theory.
# FSFM: Selective Forgetting Framework for Agent Memory
> Biologically-inspired memory management framework for LLM agents, integrating hippocampal indexing/consolidation theory and Ebbinghaus forgetting curve for intelligent memory pruning.
## Metadata
- **Source**: arXiv:2604.20300v2
- **Authors**: Yingjie Gu, Wenjian Xiong, Liqiang Wang, et al.
- **Published**: 2026-04-22 (revised 2026-04-23)
- **Category**: cs.AI (Artificial Intelligence)
## Core Methodology
### Key Innovation
This framework establishes selective forgetting as a fundamental capability for LLM agents, arguing that well-designed forgetting is as crucial as remembering in resource-constrained environments. The approach bridges cognitive neuroscience and AI systems through four forgetting mechanisms inspired by human memory processes.
### Biological Foundations
1. **Hippocampal Indexing Theory**
- Hippocampus creates indices to cortical memory traces
- Enables pattern completion and reconstruction
- Supports rapid encoding with gradual consolidation
2. **Ebbinghaus Forgetting Curve**
- Memory retention decays exponentially over time
- Spacing effects enhance retention
- Forgetting enables efficient information management
3. **Memory Consolidation**
- Short-term to long-term memory transfer
- Sleep-dependent reactivation and integration
- Selective retention of important information
### Forgetting Taxonomy
| Mechanism | Trigger | Action | Biological Analog |
|-----------|---------|--------|-------------------|
| **Passive Decay** | Time elapsed | Gradual weakening | Ebbinghaus forgetting |
| **Active Deletion** | Explicit command | Permanent removal | Intentional suppression |
| **Safety-Triggered** | Security/privacy risk | Immediate purge | Threat detection |
| **Adaptive Reinforcement** | Usage patterns | Selective retention | Synaptic plasticity |
### Implementation Architecture
1. **Memory Representation Layer**
```python
class AgentMemory:
"""Vector database with forgetting metadata"""
def __init__(self):
self.memories = {} # id -> memory vector
self.metadata = {} # id -> forgetting metadata
self.access_history = {} # id -> access timestamps
def store(self, memory_id, content, importance_score):
self.memories[memory_id] = embed(content)
self.metadata[memory_id] = {
'created': timestamp(),
'importance': importance_score,
'access_count': 0,
'last_accessed': timestamp()
}
```
2. **Decay-based Forgetting**
```python
def compute_decay_factor(memory_metadata, current_time, decay_rate=0.1):
"""
Compute forgetting factor based on time and importance
Inspired by Ebbinghaus forgetting curve
"""
time_elapsed = current_time - memory_metadata['created']
importance = memory_metadata['importance']
# Higher importance = slower decay
effective_decay = decay_rate / (1 + importance)
# Exponential forgetting with access-based refresh
decay_factor = np.exp(-effective_decay * time_elapsed)
return decay_factor
```
3. **Security-Triggered Purge**
```python
def security_scan_and_purge(memory, security_policy):
"""
Active forgetting for privacy and security
"""
risk_score = assess_security_risk(memory.content, security_policy)
if risk_score > security_policy.threshold:
# Immediate purge with audit trail
purge_memory(memory.id, reason='security_risk')
log_security_event(memory.id, risk_score)
return True
return False
```
4. **Adaptive Retention**
```python
def update_retention_priority(memory_id, access_pattern):
"""
Reinforcement-based selective retention
"""
# Access frequency
frequency = access_pattern['count'] / time_window
# Recency (recent access boosts priority)
recency = 1.0 / (1 + time_since_last_access)
# Contextual relevance
relevance = compute_contextual_relevance(
memory_id,
current_context
)
# Combined retention score
retention_score = (
0.4 * frequency +
0.3 * recency +
0.3 * relevance
)
return retention_score
```
## Implementation Guide
### Integration Steps
1. **Vector Database Setup**
```python
from langchain.vectorstores import Chroma
class ForgettingVectorStore:
def __init__(self, embedding_model, forgetting_policy):
self.store = Chroma(embedding_function=embedding_model)
self.policy = forgetting_policy
self.forgetting_metadata = {}
def add_memory(self, content, metadata):
# Store with forgetting metadata
doc_id = self.store.add_texts([content], [metadata])
self.forgetting_metadata[doc_id] = {
'created': time.time(),
'importance': metadata.get('importance', 0.5),
'access_count': 0
}
return doc_id
```
2. **Memory Pruning Pipeline**
```python
class MemoryPruner:
def __init__(self, agent_memory, max_size, target_size):
self.memory = agent_memory
self.max_size = max_size
self.target_size = target_size
def prune_if_needed(self):
current_size = len(self.memory.memories)
if current_size > self.max_size:
# Compute retention scores for all memories
scores = {
mid: self.compute_retention_score(mid)
for mid in self.memory.memories.keys()
}
# Sort by score
sorted_memories = sorted(
scores.items(),
key=lambda x: x[1]
)
# Remove lowest scoring until target size
to_remove = current_size - self.target_size
for mid, _ in sorted_memories[:to_remove]:
self.memory.forget(mid)
```
3. **Privacy-Aware Forgetting**
```python
def forget_pii_entities(memory_content, pii_detector):
"""
Selective forgetting of personally identifiable information
"""
entities = pii_detector.detect(memory_content)
for entity in entities:
if entity.confidence > 0.9:
# Redact or remove
memory_content = memory_content.replace(
entity.text,
f"[{entity.type}_REDACTED]"
)
return memory_content
```
### Performance Optimization
The framework demonstrates three key benefits:
1. **Efficiency**: +8.49% access efficiency through intelligent pruning
2. **Quality**: +29.2% signal-to-noise ratio via outdated context removal
3. **Security**: 100% elimination of identified security risks
## Applications
- **Resource-Constrained Agents**: Mobile/edge deployment
- **Long-running Agents**: Persistent memory without bloat
- **Privacy-Preserving Systems**: Active data minimization
- **Multi-user Agents**: Context isolation and cleanup
- **Regulatory Compliance**: GDPR "right to be forgotten"
## Pitfalls
- **Over-forgetting**: Too aggressive pruning loses valuable context
- **Retention Bias**: Important but infrequently accessed info may be lost
- **Implementation Complexity**: Requires careful tuning of parameters
- **Audit Requirements**: Security purges need logging for compliance
- **Context Dependencies**: Cascading effects of forgetting related memories
## Related Skills
- agent-memory-framework: AI agent memory architectures
- agent-memory-management: Memory forgetting techniques
- brain-inspired-memory-ai-agents: Neuroscience-based memory systems
- cognitive-circuit-breaker-ai-reliability: AI reliability mechanisms
## Key Insights
1. **Symmetric Importance**: Forgetting is as important as remembering
2. **Biological Inspiration**: Human memory mechanisms guide AI design
3. **Multi-dimensional**: Efficiency, quality, and security benefits
4. **Practical Necessity**: Essential for real-world deployment
## References
- Gu, Y., et al. (2026). FSFM: A Biologically-Inspired Framework for Selective Forgetting of Agent Memory. arXiv:2604.20300v2
- Ebbinghaus, H. (1885). Memory: A Contribution to Experimental Psychology
- Teyler, T.J. & DiScenna, P. (1986). The hippocampal memory indexing theory
GitHub에서 보기