YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
- ZRIA-Ultimate-PFAF: Advanced Cognitive Architecture
- ๐ง Architecture Overview
- ๐ Key Features
- ๐ File Structure
- ๐ ๏ธ Installation
- ๐ฏ Quick Start
- ๐ Knowledge Categories
- ๐ Complete Pipeline Example
- ๐ฎ Interactive Usage
- ๐ง Advanced Usage
- ๐งช Model Architecture Details
- ๐ Performance Considerations
- ๐ Troubleshooting
- ๐ค Contributing
- ๐ License
- ๐ฏ Use Cases
- ๐ง Architecture Overview
ZRIA-Ultimate-PFAF: Advanced Cognitive Architecture
A sophisticated neural architecture that implements dual-path processing for knowledge-based reasoning and execution-based tasks, with persistent model capabilities for large-scale text processing.
๐ง Architecture Overview
The ZRIA (ZRIA-Ultimate with Probabilistic Fractal Attentional Fusion) system implements:
- Dual-Path Processing: Separate knowledge and execution pathways
- Dynamic Attention: Content-aware fractal attention mechanisms
- Quantum-Inspired Fusion: Complex number operations for phase relationships
- Hierarchical Memory: Multi-scale memory systems
- Persistent Models: Save and reuse without retraining
๐ Key Features
1. Large Text File Processing
- Automatic Breakdown: Process multiple books worth of data
- Hierarchical Categorization: FACT, CONCEPT, PROCEDURE, RELATIONSHIP, etc.
- Entity Extraction: Named entities and relationships
- Sentiment Analysis: Built-in sentiment classification
- Confidence Scoring: Quality assessment of extracted knowledge
2. Persistent Model System
- Save Once, Use Forever: Train once, use repeatedly
- Interactive Prompting: Real-time interaction without retraining
- Batch Processing: Handle multiple inputs efficiently
- Auto-Routing: Intelligent task type detection
3. Advanced Cognitive Components
- Fractal Attentional Resonance: Dynamic, content-aware attention
- Quantum-Inspired Fusion: Complex-valued representations
- Hierarchical Memory: Multi-scale temporal patterns
- Neural ODE: Continuous-time dynamics
๐ File Structure
โโโ ae.py # Core ZRIA model architecture
โโโ text_processor.py # Large text file processing
โโโ persistent_model.py # Persistent model system
โโโ example_usage.py # Complete usage demonstration
โโโ requirements.txt # Dependencies
โโโ README.md # This file
๐ ๏ธ Installation
- Install Dependencies:
pip install -r requirements.txt
- Download spaCy Model:
python -m spacy download en_core_web_sm
- Download NLTK Data (automatic on first run):
import nltk
nltk.download('punkt')
nltk.download('stopwords')
nltk.download('wordnet')
๐ฏ Quick Start
1. Process Large Text Files
from text_processor import HierarchicalTextProcessor
# Initialize processor
processor = HierarchicalTextProcessor()
# Process a large text file
knowledge = processor.process_large_text_file("your_large_text_file.txt")
# Create training data
training_data = processor.create_training_data(knowledge)
# Save knowledge base
processor.save_knowledge_base(knowledge, "knowledge_base.pkl")
2. Train and Save Model
from persistent_model import create_and_train_model_from_text_file
# Train model from text file
model = create_and_train_model_from_text_file("your_large_text_file.txt", "my_model")
3. Use Persistent Model
from persistent_model import load_and_use_model
# Load trained model
model = load_and_use_model("my_model")
# Interactive prompting
result = model.prompt("artificial intelligence is amazing", 'auto')
print(f"Task: {result['task_type']}")
print(f"Prediction: {result['prediction']}")
# Start interactive mode
model.interactive_mode()
๐ Knowledge Categories
The system automatically categorizes text into:
- FACT: Factual statements, definitions, data
- CONCEPT: Abstract concepts, theories, ideas
- PROCEDURE: How-to instructions, methods, steps
- RELATIONSHIP: Connections, comparisons, associations
- ATTRIBUTE: Properties, characteristics, qualities
- EVENT: Historical events, occurrences, timelines
- LOCATION: Places, geographical information
- PERSON: People, characters, entities
๐ Complete Pipeline Example
# Run the complete demonstration
python example_usage.py
This will:
- Create a sample large text file
- Process it into structured knowledge
- Train the ZRIA model
- Demonstrate interactive usage
- Show batch processing capabilities
๐ฎ Interactive Usage
Once you have a trained model, you can use it interactively:
python persistent_model.py load my_model
Then you can:
- Type
KNOW <text>for sentiment analysis - Type
DO <text>for action tasks - Type
AUTO <text>for automatic routing - Type
helpfor commands - Type
quitto exit
๐ง Advanced Usage
Custom Model Configuration
from persistent_model import PersistentZRIAModel
model = PersistentZRIAModel("custom_model")
# Custom configuration
config = {
'dim': 256, # Model dimension
'max_seq_len': 128, # Maximum sequence length
'action_dim': 1, # Action output dimension
'batch_size': 32, # Training batch size
'epochs': 200, # Training epochs
'learning_rate': 1e-4, # Learning rate
'weight_decay': 0.01 # Weight decay
}
model.train_and_save(training_data, config)
Batch Processing
# Process multiple texts at once
texts = [
"artificial intelligence is revolutionary",
"count vowels in this example",
"machine learning is difficult"
]
results = model.batch_prompt(texts, 'auto')
for text, result in zip(texts, results):
print(f"{text}: {result['prediction']}")
Knowledge Base Analysis
from text_processor import HierarchicalTextProcessor
processor = HierarchicalTextProcessor("knowledge_base.pkl")
summary = processor.get_knowledge_summary()
print(f"Total items: {summary['total_items']}")
print(f"Categories: {summary['categories']}")
print(f"Entities: {summary['entities']}")
๐งช Model Architecture Details
Fractal Attentional Resonance
- Dynamic Bias Generation: Content-aware attention biases
- Fractal Mathematics: Multiple mathematical transformations
- Multi-Head Attention: Enhanced with fractal resonance
Quantum-Inspired Fusion
- Complex Number Operations: Real and imaginary components
- Entanglement Gates: Quantum-inspired transformations
- Phase Relationships: Captures complex interactions
Hierarchical Memory System
- Multi-Scale Memory: 32, 16, 8 token scales
- Attention-Based Retrieval: Context-aware memory access
- GRU Consolidation: Temporal pattern integration
๐ Performance Considerations
Memory Usage
- Large Text Files: Process in chunks (default: 10,000 chars)
- Model Size: ~128MB for default configuration
- GPU Acceleration: Automatic CUDA detection
Processing Speed
- Text Processing: ~1000 sentences/minute
- Model Inference: ~1000 predictions/second
- Training: ~150 epochs for convergence
๐ Troubleshooting
Common Issues
- spaCy Model Not Found:
python -m spacy download en_core_web_sm
- NLTK Data Missing:
import nltk
nltk.download('punkt')
nltk.download('stopwords')
nltk.download('wordnet')
- CUDA Out of Memory:
# Use CPU instead
device = 'cpu'
- Large File Processing:
# Reduce chunk size
knowledge = processor.process_large_text_file("file.txt", chunk_size=5000)
๐ค Contributing
This system is designed for:
- Large-scale text processing
- Persistent model deployment
- Interactive AI systems
- Research in cognitive architectures
๐ License
This project implements advanced neural architectures for research and educational purposes.
๐ฏ Use Cases
Research Applications
- Cognitive Architecture Research: Study dual-path processing
- Large-Scale Text Analysis: Process entire libraries
- Interactive AI Systems: Real-time prompting
- Knowledge Extraction: Structured information extraction
Practical Applications
- Document Processing: Large document analysis
- Content Classification: Automatic categorization
- Sentiment Analysis: Large-scale sentiment processing
- Action Recognition: Task identification and execution
Note: This system represents a sophisticated cognitive architecture that can handle both declarative knowledge and procedural execution tasks, with advanced mechanisms for integrating different types of processing.