CortexGPT is a real-time learning language model inspired by human brain memory systems. It implements a three-tier memory architecture that mimics how humans process and retain information.
The architecture diagram in the README uses Mermaid syntax, which is automatically rendered by GitHub. You can view it directly in the README file.
- Multilingual Tokenizer: Supports Korean and English text processing
- BPE Encoding: Byte Pair Encoding for efficient tokenization
- Language Detection: Automatic language identification
- Multi-Head Attention: 8 attention heads for parallel processing
- Feed Forward Network: Two-layer MLP with GELU activation
- Layer Normalization: Applied before each sub-layer
- Residual Connections: Skip connections for gradient flow
- Capacity: 64 entries
- Purpose: Store recent interactions and context
- Access: O(1) fast lookup
- Features:
- Attention-based retrieval
- Automatic overflow to LTM
- Context preservation
- Capacity: 10,000 entries
- Purpose: Store consolidated knowledge from repeated patterns
- Access: FAISS-based similarity search
- Features:
- Vector similarity search
- Importance-based ranking
- Gradual consolidation from STM
- Capacity: 100,000 entries
- Purpose: Long-term storage for rarely accessed knowledge
- Access: Compressed vector search
- Features:
- Memory compression
- Lazy loading
- Periodic cleanup
- Online Learning: Updates model weights during inference
- Memory Consolidation: Transfers knowledge between memory tiers
- Self-Evaluation: Monitors performance and adjusts learning
- Features:
- Hebbian learning rules
- Confidence scoring
- Adaptive learning rates
- Token Generation: Next token prediction
- Confidence Scoring: Uncertainty estimation
- Language Detection: Output language identification
1. New input → Tokenization → Transformer processing
2. Context stored in STM for immediate recall
3. Frequently accessed STM entries → LTM consolidation
4. Rarely accessed LTM entries → Archive compression
5. Real-time learner monitors all memory operations
6. Continuous weight updates based on memory patterns
- Three-Tier Memory: Mimics human memory organization
- Real-Time Learning: No separate training/inference phases
- Memory Consolidation: Automatic knowledge transfer
- Multilingual Support: Native Korean and English processing
- Adaptive Batch Sizing: Prevents OOM errors dynamically
- Model Dimensions: 256/512/768 (configurable)
- Vocabulary Size: 10,000-50,000 tokens
- Memory Update Frequency: Every 500 steps
- Learning Rate: Adaptive (1e-3 to 3e-4)
- Attention Heads: 8
- Feed Forward Dimension: 4x hidden dimension
The architecture is implemented across several key modules:
cortexgpt/models/cortex_gpt.py: Base transformer architecturecortexgpt/models/realtime_cortex.py: Memory system and real-time learningcortexgpt/learning/realtime_learner.py: Online learning algorithmscortexgpt/tokenization/multilingual_tokenizer.py: BPE tokenizer
- Episodic Memory: Add specific event recall capability
- Working Memory: Implement task-specific temporary storage
- Sleep Consolidation: Offline memory reorganization
- Attention Visualization: Real-time attention pattern display
- Multi-Modal Support: Extend to image and audio processing