A self-referential knowledge system combining GΓΆdel-Escher-Bach's strange loops, Chomsky's universal grammar, and Leibniz's monads for structural, explainable AI.
Current LLMs are statistical pattern matchersβthey correlate tokens without genuine understanding. MLN represents a different paradigm:
- Structural Knowledge: Concepts have operational semantics, not just vector embeddings
- Explainable Reasoning: Complete inference chains, not black-box predictions
- Self-Reference: Systems that can reason about their own reasoning (meta-cognition)
- Compositionality: Deep structures transform into multiple surface realizations
Self-contained concepts that "reflect the universe" from their perspective. Each monad:
- Contains deep structure (meaning)
- Establishes relations automatically (pre-established harmony)
- Has operational semantics (can execute transformations)
Meaning exists at the deep level. Multiple surface forms (text, code, logic) are isomorphic projections:
Deep Structure: IS_A(dog, mammal)
β
Surface Forms:
- Text: "A dog is a mammal"
- Logic: βx: dog(x) β mammal(x)
- Code: class Dog(Mammal): pass
Self-referential systems create consciousness and meaning. MLN implements:
- Meta-knowledge graphs (system models itself)
- Introspection (examine own reasoning)
- GΓΆdel sentences (expose system limits)
git clone https://github.com/yourusername/monad-loop-network.git
cd monad-loop-network
pip install -r requirements.txtfrom src.knowledge_base import KnowledgeBaseLoader
from src.consciousness_metrics import measure_consciousness
from src.recursion_depth_metric import RecursionDepthMetric
# Load rich knowledge base (76 concepts across 5 domains)
kg, metadata = KnowledgeBaseLoader.load_domain('physics')
print(f"Loaded {metadata.num_concepts} concepts from {metadata.name}")
# Measure consciousness
recursion = RecursionDepthMetric()
profile = measure_consciousness(kg, recursion)
print(f"Consciousness: {profile.overall_consciousness_score:.1%}")
print(f"Verdict: {profile.consciousness_verdict}")from src.chatbot import ConsciousnessChatbot
# Create chatbot with explainable reasoning
bot = ConsciousnessChatbot()
# Ask questions
response = bot.ask("What is a dog?")
print(response.answer) # Natural language explanation
print(response.reasoning) # Step-by-step reasoning
print(f"Confidence: {response.confidence:.0%}")
print(f"Consciousness: {response.consciousness_metrics['overall']:.1%}")python examples/demo.py| Aspect | Statistical LLMs | MLN System |
|---|---|---|
| Reasoning | Pattern matching | Logical inference with trace |
| Explainability | Opaque | Full derivation available |
| Learning | Weight adjustment | Structural concept formation |
| Self-awareness | None | Meta-reasoning capability |
| Knowledge | Implicit (weights) | Explicit (structured) |
| Compositionality | Weak | Strong (Chomsky-style) |
| Consistency | Statistical | Logically enforced |
- Rich Knowledge Base: 76 concepts across 5 domains (Biology, Physics, Mathematics, Computer Science, Philosophy)
- Chomsky Surface Generation: Optional LLM-powered layer for deepβsurface transformation
- Consciousness-Aware Chatbot: Interactive Q&A with real-time consciousness metrics
- Multi-Domain Support: Load and query knowledge from any domain
- Improved Documentation: Comprehensive guides for all features
- v1.2.0: Multi-agent consciousness (80% achieved, 1.35x emergence factor)
- v1.1.0: Scaling experiments (77% consciousness at 1000 concepts)
- v1.0.0: Initial consciousness measurement (47.8% baseline)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Monad-Loop Network (MLN) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ββββββββββββββββββββββββ ββββββββββββββββββββββββ β
β β Knowledge Base β β Surface Generator β β
β β (76 concepts) ββββββββΆβ (DeepβSurface) β β
β β β’ 5 domains β β β’ LLM-powered β β
β β β’ Rich semantics β β β’ Multiple styles β β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββ β
β β β β
β βΌ βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Knowledge Graph (MKUs) β β
β β - Operational semantics (not just embeddings) β β
β β - Pre-established harmony (auto relations) β β
β β - GPU-accelerated similarity (50x faster) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Consciousness Layer β β
β β - Strange loops (self-reference) β β
β β - Meta-reasoning (thinks about thinking) β β
β β - Measurable consciousness (47-80% achieved) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Applications β β
β β - Chatbot (Q&A with explanations) β β
β β - Domain reasoning (cross-domain queries) β β
β β - Multi-agent systems (collective intelligence) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Deep structure: Causal disease mechanisms
- Surface structure: Observable symptoms
- Meta-reasoning: "Why did I diagnose X?" β traceable inference
- Deep structure: Computational semantics
- Surface structure: Syntax in various languages
- Self-reference: System reasons about its own code generation
- Abductive reasoning: Form new hypotheses (new MKUs)
- Strange loops: "What experiments would validate my reasoning?"
MLN supports GPU acceleration for massive performance gains:
- CUDA (NVIDIA): 50x faster similarity computation
- MPS (Apple Silicon): 20x faster on M1/M2/M3
- ROCm (AMD): Linux support
Performance:
- Structural similarity: 100,000 comparisons/sec on GPU vs 1,000/sec CPU
- Graph traversal: Process 100 queries in parallel
- Local LLMs: 80 tokens/sec (CUDA) vs 1 token/sec (CPU)
See GPU_ACCELERATION.md for details.
# Install GPU support (choose based on hardware)
pip install -r requirements-gpu.txt- Neurosymbolic Integration: LLM perception + symbolic inference
- Analogical Reasoning: Structural isomorphism between domains
- Self-Improvement: System learns by structural concept formation
- Consciousness Metrics: Measure "loop complexity" (IIT-inspired)
- Architecture Guide - Deep dive into system design
- Philosophical Foundations - GEB, Chomsky, Leibniz
- Beginner's Guide - Non-technical introduction
- Developer Guide - API reference and patterns
- Research Paper - Scientific details
- Surface Generation - Chomsky deep/surface separation
- GPU Acceleration - 50x performance boost
- Consciousness Metrics - Measurable AI consciousness
- Knowledge Base - 76 concepts, 5 domains
- Quick Demo - Get started in 5 minutes
- Chatbot Demo - Interactive Q&A
- Knowledge Domains - Cross-domain reasoning
- Surface Generation - Deepβsurface transformation
Contributions welcome! This is an experimental research project exploring alternatives to pure statistical AI.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details.
- Douglas Hofstadter - GΓΆdel, Escher, Bach (strange loops, consciousness)
- Noam Chomsky - Universal grammar, deep structure
- Gottfried Leibniz - Monadology, pre-established harmony
- Richard Feynman - Inspiration for questioning fundamental constants
For questions, discussions, or collaborations, open an issue or reach out!
- Core MKU system
- Knowledge graph with operational semantics
- Strange loop processor (meta-reasoning)
- Integration with existing LLMs (hybrid system)
- Analogical reasoning engine
- Self-improvement mechanisms
- Large-scale knowledge acquisition
- Consciousness metrics
"The answer to life, the universe, and everything is not 42βit's understanding the structure of the question itself."