MycoPhysarum Cognitive Architecture (MPCA)

A Novel, Bio-Inspired AI Framework
Inspired by the decentralized intelligence of slime molds and mycorrhizal networks.
MPCA Architecture Diagram

MPCA represents knowledge not as static data, but as a dynamic, living graph that evolves through interaction and self-reflection.

Core Philosophy

The core of MPCA is the "Cognitive Mycelium," a graph-based knowledge structure. Unlike rigid, pre-trained models, the Mycelium is built from the ground up to understand the grammatical and conceptual relationships in language. It learns, forgets, and even "dreams" to form new connections, creating a resilient and emergent form of intelligence with a fraction of the computational overhead of conventional architectures.

Radical Efficiency: The Spore Advantage

A key breakthrough of the MPCA is its incredible efficiency. A fully-formed Cognitive Mycelium, built from a large dataset (~100k entries, >2.9M sentences), can be compressed into a spore file of only ~9 MB. This stands in stark contrast to conventional AI models like Transformers (GPT-2 is ~500 MB; modern models are many gigabytes).

This efficiency is a direct result of the architecture's design. Instead of storing billions of statistical weights to predict tokens, the Mycelium stores a compressed graph of concepts and their relationships. It captures knowledge, not just statistical patterns, leading to a powerful, lightweight, and truly novel form of intelligence.

How to Run

1. Install Dependencies:

pip install -r requirements.txt
python -m spacy download en_core_web_sm

2. Build a New Mycelium:

To create a new knowledge graph from a dataset, run the main script with the --build flag. The default dataset is mlabonne/FineTome-100k.

python main.py --build --spore-file mycelium_new.spore --limit 1000

3. Interact with an Existing Mycelium:

To chat with a pre-built Mycelium, use the --interactive flag.

python main.py --interactive --spore-file mycelium.spore

The MPCA Lifecycle

  1. Genesis (Building): The Builder creates a Mycelium from a data source, performing grammatical parsing to construct a graph of nodes and relationships, which is then saved as a .spore file.
  2. Awakening (Loading): The system loads a .spore file into memory, awakening the Cognitive Mycelium.
  3. Interaction (Solving): A user asks a question. The Solver takes the core concepts and finds a thought-path through the Mycelium to construct an answer.
  4. Evolution (Learning): Successful thought-paths are reinforced via Hebbian learning, strengthening the system's knowledge.
  5. Introspection (Dreaming): During downtime, the system can dream to form new, speculative connections, expanding its creative potential.

The Path Forward: Extending MPCA to a Multi-Modal World

The current architecture is a powerful foundation for understanding language. Its true potential lies in extending this conceptual graph to understand and generate other forms of data. The core principle is that MPCA acts as a central orchestrator, connecting its abstract conceptual understanding to specialized external models for processing and generation.

Image Understanding and Generation

Understanding: A Vision-Language Model (VLM) like CLIP analyzes an image and outputs concept tags (e.g., "a red car on a street"). The Builder integrates these concepts into the Mycelium, linking an ImageNode to existing nodes like Node('car') and Node('red'). The graph learns what's in the image, not the pixels themselves.

Generation: The Solver assembles a conceptual blueprint (e.g., Node('boat') → Node('blue') → Node('ocean')). This blueprint is passed as a highly-structured prompt to an external image generation model (like a VAE or Diffusion model) to render the final image.

Audio & Video

A similar approach applies to audio and video. For audio, speech-to-text models provide text for integration, while event detection models can identify non-speech sounds ("dog barking"). For video, an analysis model tracks objects and actions over time, which the Builder represents as a complex, time-stamped sub-graph.

Taking Action (Agency)

Actions are a native Node type in MPCA. To enable agency, these action nodes can be linked to real-world API calls or robotic functions. When the Solver's thought-path traverses an ActionNode linked to an external function (e.g., Node('turn_on_light')), it triggers that function. This turns the MPCA from a passive knowledge base into an active agent that can perceive, reason about, and act upon its environment.