Field-Theoretic Memory System - PDE-based memory for AI agents with natural diffusion and thermodynamic forgetting
Project description
rotalabs-fieldmem
Field-Theoretic Memory System - Field-theoretic memory for AI agents with natural decay and consolidation.
Overview
FieldMem implements a physics-inspired approach to AI memory, treating memories as continuous fields that evolve according to partial differential equations. This enables:
- Natural forgetting: Memories decay over time following thermodynamic principles
- Semantic diffusion: Related memories influence each other spatially
- Importance-weighted retention: Important memories resist decay
- Collective intelligence: Multi-agent memory sharing through field coupling
Based on the heat equation:
∂u/∂t = α∇²u - γu + η(t)
Where:
u: Memory field stateα: Diffusion rate (memory spreading)γ: Decay rate (natural forgetting)η(t): Thermal noise (stochastic fluctuations)
Installation
pip install rotalabs-fieldmem
Optional dependencies
# For sentence-transformers embeddings
pip install rotalabs-fieldmem[embeddings]
# For visualization
pip install rotalabs-fieldmem[viz]
# For Google Cloud/Vertex AI integration
pip install rotalabs-fieldmem[gcp]
# All optional dependencies
pip install rotalabs-fieldmem[all]
Quick Start
Basic Memory Field
from rotalabs_fieldmem import MemoryField, FieldConfig
# Create a memory field
config = FieldConfig(
shape=(128, 128),
diffusion_rate=0.01,
temperature=0.05,
)
field = MemoryField(config)
# Inject a memory
import jax.numpy as jnp
embedding = jnp.ones(64) # Example embedding
field.inject_memory(embedding, position=(64, 64), importance=0.8)
# Evolve the field (memories diffuse and decay)
field.step()
# Query memories
values, positions = field.query_memories(embedding, k=5)
FTCS Agent
from rotalabs_fieldmem import FTCSAgent, AgentConfig
# Create an agent with field-theoretic memory
config = AgentConfig(
memory_field_shape=(128, 128),
diffusion_rate=0.003,
temperature=0.05,
)
agent = FTCSAgent(agent_id="agent_1", config=config)
# Store memories
agent.store_memory("The capital of France is Paris.", importance=0.9)
agent.store_memory("Python is a programming language.", importance=0.7)
# Retrieve relevant memories
results = agent.retrieve_memories("What European capitals do you know?")
for memory in results:
print(f"- {memory['content']} (score: {memory['combined_score']:.2f})")
Importance Scoring
from rotalabs_fieldmem import SemanticImportanceAnalyzer, QuickImportanceScorer
# Detailed semantic analysis
analyzer = SemanticImportanceAnalyzer()
scores = analyzer.analyze("URGENT: Meeting tomorrow at 3 PM!")
print(f"Total importance: {scores.total:.2f}")
print(f"Temporal score: {scores.temporal:.2f}")
# Quick scoring for real-time use
scorer = QuickImportanceScorer()
importance = scorer.compute_importance("Remember to call John Smith.")
Key Features
1. Field-Theoretic Memory
Memories are stored as energy distributions in a continuous field that evolves over time:
- Diffusion: Memories spread to nearby regions, creating semantic neighborhoods
- Decay: Low-importance memories fade naturally
- Noise: Thermal fluctuations add stochastic forgetting
2. Importance-Weighted Dynamics
The SemanticImportanceAnalyzer scores memories based on:
- Entity detection: Names, dates, locations
- Causal relationships: "because", "therefore", "leads to"
- Temporal markers: Deadlines, urgency, recurring events
- Instructional content: How-to, step-by-step procedures
- Emotional significance: Personal preferences, strong opinions
3. Multi-Agent Collective Intelligence
from rotalabs_fieldmem import MultiAgentSystem, MultiAgentConfig
# Create a multi-agent system
config = MultiAgentConfig(
num_agents=4,
consensus_threshold=0.6,
)
system = MultiAgentSystem(config)
# Agents share knowledge through field coupling
response = system.collective_query("What do we know about machine learning?")
4. Field Coupling Topologies
- Fully Connected: All agents share equally
- Nearest Neighbor: Spatial locality
- Small World: Local + random long-range connections
- Adaptive: Coupling strength based on semantic similarity
Architecture
src/rotalabs_fieldmem/
├── fields/ # Core field implementations
│ ├── memory_field.py # PDE-based memory field
│ ├── sparse.py # Sparse optimization (42x memory reduction)
│ └── operations.py # Field operations
├── agents/ # FieldMem-enabled agents
│ ├── ftcs_agent.py # Single agent
│ ├── multi_agent.py # Multi-agent system
│ ├── coordinator.py # Agent coordination
│ ├── collective.py # Collective memory pool
│ └── coupling.py # Field coupling
├── memory/ # Memory processing
│ ├── importance.py # Semantic importance scoring
│ ├── consolidation.py # Memory consolidation
│ └── forgetting.py # Thermodynamic forgetting
├── utils/ # Utilities
│ ├── metrics.py # Quality metrics
│ ├── embeddings.py # Embedding management
│ └── persistence.py # State persistence
└── viz/ # Visualization (optional)
└── plotting.py # Field visualization
Benchmark Results
Evaluated on standard long-context conversation benchmarks:
LongMemEval (ICLR 2025)
| Memory Ability | FieldMem | Baseline | Improvement | Significance |
|---|---|---|---|---|
| Multi-session | 0.042 F1 | 0.020 F1 | +116% | p<0.01, d=3.06 |
| Temporal reasoning | 0.120 F1 | 0.084 F1 | +43.8% | p<0.001, d=9.21 |
| Preference tracking | 0.268 F1 | 0.168 F1 | +59.1% | p<0.001, d=8.96 |
| Knowledge update | 0.147 recall | 0.115 recall | +27.8% | p<0.001 |
LoCoMo (ACL 2024)
| Category | FieldMem | Baseline | Improvement |
|---|---|---|---|
| Category 3 (F1) | 0.017 | 0.016 | +9.5%* (p<0.05) |
| Category 4 (EM) | 0.271 | 0.256 | +6.1% |
Computational Performance
| Metric | FieldMem | Traditional |
|---|---|---|
| Memory efficiency | 42x reduction | baseline |
| JAX JIT speedup | 518x | baseline |
| Multi-agent sharing | Native | Manual |
Scientific Background
FieldMem builds on the Field-Theoretic Context System (FTCS) published in Technical Disclosure Commons. The full methodology and benchmark analysis are available in our arXiv paper.
Links
- Paper: arXiv:cs.ET (FieldMem: Field-Theoretic Memory for AI Agents)
- Prior Work: FTCS Technical Disclosure
- Website: https://rotalabs.ai
- GitHub: https://github.com/rotalabs/rotalabs-fieldmem
- Documentation: https://rotalabs.github.io/rotalabs-fieldmem/
- Contact: research@rotalabs.ai
License
MIT License - see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rotalabs_fieldmem-0.1.0.tar.gz.
File metadata
- Download URL: rotalabs_fieldmem-0.1.0.tar.gz
- Upload date:
- Size: 962.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc1013024eaebd57cee13da398b9a076a1049c040eafa134ac82ed3ec1db6d7d
|
|
| MD5 |
595f64cb1200dcceda4c2aaf334107ad
|
|
| BLAKE2b-256 |
1756e36c4b4f204484d163ce59b556c4dd3fbc9aab4e9f57dc88ad52b15d29b1
|
File details
Details for the file rotalabs_fieldmem-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rotalabs_fieldmem-0.1.0-py3-none-any.whl
- Upload date:
- Size: 72.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd666c8fbb708096926d998a1182488b5e0249aeb4cea55843630e92007a2017
|
|
| MD5 |
281b04d34849e0b12db0b4394e855c64
|
|
| BLAKE2b-256 |
46046a92cb314ebb683d9ee8740fd977b5857fcb871d7add0fda5e6c0101c1a8
|