omega-hippocampus
Biologically-inspired hippocampal memory system with pattern separation, completion, and sharp-wave ripple replay.
Part of the ExoGenesis-Omega cognitive architecture.
Overview
omega-hippocampus implements a computational model of the hippocampal formation, the brain region critical for episodic memory and spatial navigation. The model includes:
- Dentate Gyrus (DG): Pattern separation via sparse coding
- CA3: Autoassociative network for pattern completion
- CA1: Output layer for memory consolidation
- Entorhinal Cortex: Grid cells and input/output interface
- Place Cells: Spatial memory representations
- Sharp-Wave Ripples: Memory replay during rest/sleep
Features
- Pattern Separation: Orthogonalize similar inputs using sparse DG coding
- Pattern Completion: Retrieve full patterns from partial cues via CA3
- Spatial Navigation: Place cells, grid cells, and head direction cells
- Memory Replay: Sharp-wave ripple events for consolidation
- Configurable Sparsity: Control DG expansion ratio and activity level
- Hebbian Learning: STDP-like synaptic plasticity
Installation
Add this to your Cargo.toml:
[]
= "1.0.0"
Quick Start
use ;
Architecture
┌─────────────────────────────────────────────────────────────────────┐
│ HIPPOCAMPAL FORMATION │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌────────────────────────────────────────────────────────────────┐ │
│ │ ENTORHINAL CORTEX (EC) │ │
│ │ Grid Cells │ Input/Output Interface │ │
│ └────────────────────────────────────────────────────────────────┘ │
│ ↓ Perforant Path ↑ │
│ ┌────────────────────────────────────────────────────────────────┐ │
│ │ DENTATE GYRUS (DG) │ │
│ │ Pattern Separation │ Sparse Coding │ 10x Expansion │ │
│ └────────────────────────────────────────────────────────────────┘ │
│ ↓ Mossy Fibers │
│ ┌────────────────────────────────────────────────────────────────┐ │
│ │ CA3 │ │
│ │ Autoassociative │ Pattern Completion │ Recurrent Connections │ │
│ └────────────────────────────────────────────────────────────────┘ │
│ ↓ Schaffer Collaterals │
│ ┌────────────────────────────────────────────────────────────────┐ │
│ │ CA1 │ │
│ │ Output Layer │ Consolidation │ To Neocortex │ │
│ └────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────┐ ┌──────────────────────────────────────┐ │
│ │ PLACE CELLS │ │ SHARP-WAVE RIPPLES │ │
│ │ Spatial Memory │ │ Memory Replay │ Consolidation │ │
│ └─────────────────────┘ └──────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
Pattern Separation (Dentate Gyrus)
The DG separates similar patterns into distinct representations:
use ;
// Create DG with 10x expansion
let mut dg = new; // 2% sparsity
// Encode two similar patterns
let pattern1 = vec!;
let pattern2 = pattern1.iter.map.collect; // Slight variation
let sparse1 = dg.encode;
let sparse2 = dg.encode;
// Sparse codes are more orthogonal than original patterns
let original_sim = cosine_similarity;
let sparse_sim = cosine_similarity;
println!; // ~0.99
println!; // ~0.30
Pattern Completion (CA3)
CA3 implements autoassociative memory for completing partial patterns:
use ;
let mut ca3 = new; // 4% recurrent connectivity
// Store a pattern
let pattern = vec!;
ca3.store?;
// Retrieve with only 30% of the pattern
let partial = create_partial_pattern;
let completed = ca3.complete?; // 100 iterations
// Measure completion accuracy
let accuracy = cosine_similarity;
println!; // ~0.95
Spatial Navigation
Place Cells
use ;
// Create place cell with field at (50, 50) with radius 10
let mut pc = new;
// Compute firing rate at different locations
let rate_at_center = pc.compute; // ~1.0
let rate_at_edge = pc.compute; // ~0.37
let rate_outside = pc.compute; // ~0.0
println!;
println!;
println!;
Grid Cells
use ;
// Create grid cell with 30cm spacing
let mut gc = new;
// Activation is periodic with hexagonal pattern
let a1 = gc.compute; // Peak
let a2 = gc.compute; // Trough
let a3 = gc.compute; // Adjacent peak
println!;
println!;
println!;
Head Direction Cells
use HeadDirectionCell;
use PI;
// Cell preferring 0 degrees (facing right)
let mut hd = new;
let facing_preferred = hd.compute; // ~1.0
let facing_opposite = hd.compute; // ~0.0
let facing_orthogonal = hd.compute; // ~0.5
println!;
println!;
Sharp-Wave Ripples
Memory replay during rest/sleep:
use ;
let mut buffer = new;
// Add memories to buffer
for i in 0..100
// Trigger sharp-wave ripple replay
let ripple = buffer.trigger_ripple?;
println!;
println!;
println!;
println!;
// Get replay events
let events = buffer.get_replay_events;
for event in events
Configuration
use HippocampusConfig;
let config = HippocampusConfig ;
let hippo = new;
Memory Traces
use MemoryTrace;
// Memory traces contain multi-layer representations
let trace = hippo.encode?;
println!;
println!;
println!;
println!;
println!;
println!;
println!;
Use Cases
1. Episodic Memory
// Store episodes with context
let episode = Episode ;
let memory_id = hippo.encode_episode?;
// Later, cue with partial info
let cue = encode;
let recalled = hippo.recall_episode?;
// Returns: what=met John, where=coffee shop, when=yesterday
2. Spatial Memory
// Build spatial map as agent explores
let mut spatial_map = new;
for position in agent_path
// Compute rate map for place cell
let rate_map = spatial_map.compute_rate_map;
3. Memory Consolidation
// During "sleep", consolidate important memories
hippo.initiate_consolidation?;
// Replay prioritized by importance
let consolidated = hippo.consolidate?;
println!;
Integration with Omega
omega-brain (Unified Integration)
└── omega-hippocampus (This crate)
├── Pattern separation (DG)
├── Pattern completion (CA3)
├── Memory output (CA1)
├── Spatial navigation (EC)
└── Replay during sleep
Used with:
├── omega-sleep - Triggers replay during SWS/REM
├── omega-attention - What gets encoded
└── omega-consciousness - Conscious recall
Related Crates
- omega-brain - Unified cognitive architecture
- omega-sleep - Triggers memory consolidation
- omega-memory - Higher-level memory interface
- omega-agentdb - Vector storage for embeddings
References
- Rolls, E. T. (2013). "The mechanisms for pattern completion and pattern separation in the hippocampus"
- Marr, D. (1971). "Simple memory: a theory for archicortex"
- O'Keefe, J., & Dostrovsky, J. (1971). "The hippocampus as a spatial map"
- Hafting, T., et al. (2005). "Microstructure of a spatial map in the entorhinal cortex"
- Buzsáki, G. (2015). "Hippocampal sharp wave‐ripple"
License
Licensed under the MIT License. See LICENSE for details.