[Synthetic Intelligence (Synth-Int) Framework] - A revolutionary, air-gapped Local-First Dynamic Persona Intelligence System that transforms large, heterogeneous corpuses into grounded, attributable, and conversationally explorable intelligence using deterministic generative models.
We are at a paradigm shift in artificial intelligence. Traditional "AI" systems are probabilistic, cloud-dependent, and prone to hallucination. Synthetic Intelligence represents a new engineering discipline - the construction of deterministic, local-first systems where intelligence is not a black box, but an explicit, adjustable, and evolving Persona Lens.
This system implements a Dynamic Persona Mixture-of-Experts Retrieval-Augmented Generation (MoE RAG) architecture that:
- Separates Intelligence from Identity: Uses quantified persona vectors that constrain model output to specific psychological and methodological profiles
- Operates Fully Offline: Designed for air-gapped security with zero external API dependencies
- Maintains Deterministic Outputs: Produces identical results given identical inputs and persona state
- Features Evolving Personas: Personas adapt through controlled, auditable feedback loops
- Provides Grounded Intelligence: Minimizes hallucinations through structural constraints and explicit provenance
- π Dynamic Persona Mixture-of-Experts RAG System
- π The Future of AI is Here: Synthetic Intelligence
- ποΈ System Architecture
- β¨ Key Features
- π¦ Installation
- π Quick Start
- π Usage Examples
- βοΈ Configuration
- π§© System Components
- π§ͺ Testing
- π€ Contributing
- π License
- π Acknowledgments
- π Related Work
- π Support
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Input Query βββββΆβ Entity ConstructorβββββΆβ Dynamic Graph β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Persona Store ββββββ MoE Orchestrator ββββββ Graph Traversal β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Ollama LLM ββββββ Evaluation & ββββββ Graph Snapshots β
β (Local) β β Scoring β β & Persistence β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
- Entity Constructor Agent: Extracts entities and relationships from input text using NLP and regex patterns
- Dynamic Knowledge Graph: Query-scoped graph built on-demand using NetworkX with explicit semantic relationships
- Persona Store: Manages persona lifecycle with JSON-based storage and validation
- MoE Orchestrator: Coordinates the mixture-of-experts inference cycle with expansion, evaluation, and pruning phases
- Persona Traversal: Implements different cognitive strategies (Analytical, Creative, Pragmatic)
- Evaluation & Scoring: Multi-criteria scoring system with relevance, consistency, novelty, and grounding
- Ollama Interface: Local LLM inference with deterministic configuration
- Graph Snapshots: Persistent storage and analysis of graph states
- Weighted Persona Lenses: Quantified trait vectors (0.0-1.0) that constrain model behavior
- Persona Evolution: Bounded update functions with explicit audit trails
- Lifecycle Management: Active β Stable β Experimental β Pruned progression
- Multi-Expert Collaboration: Different personas provide diverse perspectives
- Local-First Design: No external API calls or cloud dependencies
- Deterministic Operation: Reproducible results with fixed seeds
- Data Sovereignty: All processing occurs on local hardware
- Model Agnostic: Works with any locally available LLM
- Graph-Based Knowledge: Explicit relationships between entities
- Contextual Traversal: Persona-guided navigation through knowledge graphs
- Multi-Perspective Analysis: Synthesis of diverse expert viewpoints
- Hallucination Control: Structural constraints and provenance tracking
- Multi-Criteria Scoring: Relevance, consistency, novelty, and grounding metrics
- Performance Tracking: Historical persona performance with success rates
- Automated Pruning: Threshold-based persona management
- Quality Assurance: Rigorous validation and scoring frameworks
- Python 3.8+
- Ollama (for local LLM inference)
- Git
-
Clone the repository:
git clone https://github.com/kliewerdaniel/SynthInt.git cd synthint -
Run the setup script:
python setup.py
-
Start Ollama and pull a model:
# Start Ollama (in a separate terminal) ollama serve # Pull a model ollama pull llama3.2
-
Install Python dependencies:
pip install -r requirements.txt
-
Install spaCy model (optional, for enhanced entity extraction):
python -m spacy download en_core_web_sm
-
Create necessary directories:
mkdir -p data/personas/{active,stable,experimental,pruned} mkdir -p data/graph_snapshots data/results logs
-
Create a sample input file:
{ "text": "Analyze the impact of renewable energy on global economic systems." } -
Run the pipeline:
python scripts/run_pipeline.py --input sample_input.json --create-sample-personas
-
View results: The system will output detailed results including:
- Entity extraction results
- Persona expansion outputs
- Evaluation scores
- Final synthesized response
python scripts/run_pipeline.py --help
Usage: run_pipeline.py [OPTIONS]
Options:
--input TEXT Input text or path to input file
--config PATH Path to configuration directory
--log-level [DEBUG|INFO|WARNING|ERROR]
Log level
--log-file PATH Path to log file
--create-sample-personas Create sample personas for testing
--dry-run Perform a dry run without actual inference
--help Show this message and exit.# Create input file
echo '{"text": "What are the ethical implications of AI in healthcare?"}' > healthcare_query.json
# Run with sample personas
python scripts/run_pipeline.py --input healthcare_query.json --create-sample-personas# Create a text file
echo "Analyze the future of quantum computing and its potential applications." > quantum_query.txt
# Process the file
python scripts/run_pipeline.py --input quantum_query.txt# Use custom configuration
python scripts/run_pipeline.py --input query.json --config custom_configs/# Test without actual LLM calls
python scripts/run_pipeline.py --input query.json --dry-run# Global system parameters
max_iterations: 10 # Maximum iterations for pipeline
batch_size: 32 # Batch size for processing
log_level: "INFO" # Logging level
enable_caching: true # Enable caching
persona_evolution_enabled: true # Enable persona evolution
deterministic_mode: true # Ensure deterministic outputs
air_gapped_mode: true # Operate in air-gapped mode# Pruning and promotion thresholds
pruning_threshold: 0.3 # Threshold for pruning personas
promotion_threshold: 0.8 # Threshold for promoting personas
demotion_threshold: 0.5 # Threshold for demoting personas
activation_threshold: 0.6 # Threshold for activating personas
# Performance evaluation weights
relevance_weight: 0.4
consistency_weight: 0.3
novelty_weight: 0.2
grounding_weight: 0.1
# Evolution parameters
max_persona_count: 20
min_persona_count: 5
evolution_rate: 0.1# Local model configuration
model_name: "llama3.2"
temperature: 0.1
max_tokens: 2000
api_endpoint: "http://localhost:11434"
seed: 42
top_p: 0.9
frequency_penalty: 0.0
presence_penalty: 0.0
# Model selection for different tasks
reasoning_model: "llama3.2"
generation_model: "llama3.2"
evaluation_model: "llama3.2"Personas are defined using a strict JSON schema with the following structure:
{
"persona_id": "unique_identifier",
"name": "Human-readable name",
"description": "Brief description of persona characteristics",
"traits": {
"analytical_rigor": 0.8,
"creativity": 0.6,
"practicality": 0.7
},
"expertise": ["domain1", "domain2"],
"activation_cost": 0.3,
"historical_performance": {
"total_queries": 0,
"average_score": 0.0,
"last_used": null,
"success_rate": 0.0
},
"metadata": {
"created_at": "2026-01-25T10:00:00Z",
"updated_at": "2026-01-25T10:00:00Z",
"version": "1.0",
"status": "active"
}
}- Experimental: Newly created or modified personas being tested
- Active: Proven performers participating in inference
- Stable: Reliable performers, quick to activate
- Pruned: Underperforming personas, archived for potential recovery
The system implements three main traversal strategies:
- Analytical: Focuses on logical connections and evidence-based reasoning
- Creative: Emphasizes novel connections and lateral thinking
- Pragmatic: Prioritizes efficiency and practical outcomes
python test_system.py# Test specific components
python -c "from test_system import test_entity_constructor; test_entity_constructor()"
python -c "from test_system import test_persona_store; test_persona_store()"
python -c "from test_system import test_ollama_interface; test_ollama_interface()"The test script generates a detailed test_report.json file with system status and component availability.
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes with appropriate tests
- Run the test suite:
python test_system.py - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin feature-name - Create a Pull Request
- Follow PEP 8 style guidelines
- Include comprehensive docstrings
- Add tests for new functionality
- Update documentation for significant changes
- Ensure backward compatibility
This project is licensed under the MIT License - see the LICENSE file for details.
- Ollama for providing excellent local LLM inference
- NetworkX for robust graph operations
- spaCy for advanced natural language processing
- PyYAML and jsonschema for configuration management
- Local-First Dynamic Persona Intelligence System
- Synthetic Intelligence Framework
- Guide to Building a Sovereign Synthetic Intelligence System
For support and questions:
- Issues: GitHub Issues
- Documentation: This README and inline code documentation
- Testing: Run
python test_system.pyfor system validation
Traditional systems treat personas as text prompts that are concatenated to the input. Our system implements personas as weighted constraint vectors that deterministically shape model behavior:
def _build_persona_prompt(self, persona: Dict[str, Any], query: str, context: str) -> str:
traits = persona.get('traits', {})
system_prompt = f"You are a {persona.get('name', 'specialist')} with the following traits: "
trait_descriptions = []
for trait_name, trait_value in traits.items():
trait_descriptions.append(f"{trait_name} ({trait_value:.2f})")
system_prompt += ", ".join(trait_descriptions) + ". "
system_prompt += persona.get('description', 'You are an expert in your field.')
user_prompt = f"Context: {context}\n\nQuery: {query}\n\nPlease provide a response based on the context and your expertise."
return f"{system_prompt}\n\n{user_prompt}"Unlike persistent knowledge graphs that accumulate noise and become unwieldy, our system builds query-scoped graphs that are constructed fresh for each query. This ensures:
- Relevance: Only entities and relationships relevant to the current query are included
- Performance: Graphs remain manageable in size
- Accuracy: No state pollution from unrelated queries
- Security: No persistent storage of sensitive relationships
Persona evolution follows bounded update functions with explicit audit trails:
def update_persona_performance(self, persona_id: str, score: float) -> bool:
# Load current persona data
persona_data = self.load_persona_from_file(persona_file)
# Update performance metrics
performance = persona_data['historical_performance']
performance['total_queries'] += 1
performance['last_used'] = datetime.utcnow().isoformat() + 'Z'
# Calculate new average score
old_avg = performance['average_score']
total_queries = performance['total_queries']
new_avg = ((old_avg * (total_queries - 1)) + score) / total_queries
performance['average_score'] = new_avg
# Update metadata timestamp
persona_data['metadata']['updated_at'] = datetime.utcnow().isoformat() + 'Z'
# Save updated persona
return self.save_persona_to_file(persona_data, persona_file)The system implements different cognitive strategies that personas use to process information:
- Analytical: Logical, evidence-based reasoning
- Creative: Novel connections and lateral thinking
- Pragmatic: Efficiency and practical outcomes
This multi-strategy approach ensures comprehensive analysis from multiple perspectives, similar to how human experts with different backgrounds would approach the same problem.
The system implements multiple layers of hallucination control:
- Structural Constraints: Explicit entity grounding requirements
- Provenance Tracking: Every output is traceable to specific graph nodes
- Multi-Criteria Evaluation: Grounding is explicitly scored
- Contextual Validation: Outputs are validated against provided context
Built with β€οΈ for the future of local, sovereign AI systems
Repository: GitHub - Dynamic Persona MoE RAG
Author: Daniel Kliewer
License: MIT License
Contact: daniel.kliewer@gmail.com