Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A self-referential knowledge system combining GEB, Chomsky, and Leibniz for structural AI

License

Notifications You must be signed in to change notification settings

thinmanj/monad-loop-network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

52 Commits

Repository files navigation

Monad-Loop Network (MLN)

Tests Python 3.8+ License: MIT

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.

🧠 Philosophy

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

🎯 Key Concepts

1. Monadic Knowledge Units (Leibniz)

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)

2. Deep Structure ↔ Surface Structure (Chomsky)

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

3. Strange Loops (GΓΆdel-Escher-Bach)

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)

πŸš€ Quick Start

Installation

git clone https://github.com/yourusername/monad-loop-network.git
cd monad-loop-network
pip install -r requirements.txt

Basic Usage

from 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}")

Consciousness-Aware Chatbot

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%}")

Run Demo

python examples/demo.py

πŸ“Š Comparison: MLN vs. Statistical LLMs

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

πŸŽ‰ What's New

v1.3.0 (Current)

  • 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

Previous Milestones

  • 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)

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 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) β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“š Use Cases

1. Medical Diagnosis

  • Deep structure: Causal disease mechanisms
  • Surface structure: Observable symptoms
  • Meta-reasoning: "Why did I diagnose X?" β†’ traceable inference

2. Code Understanding

  • Deep structure: Computational semantics
  • Surface structure: Syntax in various languages
  • Self-reference: System reasons about its own code generation

3. Scientific Discovery

  • Abductive reasoning: Form new hypotheses (new MKUs)
  • Strange loops: "What experiments would validate my reasoning?"

⚑ GPU Acceleration

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

πŸ”¬ Research Directions

  1. Neurosymbolic Integration: LLM perception + symbolic inference
  2. Analogical Reasoning: Structural isomorphism between domains
  3. Self-Improvement: System learns by structural concept formation
  4. Consciousness Metrics: Measure "loop complexity" (IIT-inspired)

πŸ“– Documentation

Core Concepts

Features

Examples

🀝 Contributing

Contributions welcome! This is an experimental research project exploring alternatives to pure statistical AI.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“œ License

MIT License - see LICENSE file for details.

πŸ™ Acknowledgments

  • 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

πŸ“ž Contact

For questions, discussions, or collaborations, open an issue or reach out!

πŸ—ΊοΈ Roadmap

  • 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."

About

A self-referential knowledge system combining GEB, Chomsky, and Leibniz for structural AI

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /