Mycelium
The heart of the system. A networkx
directed graph where nodes are concepts and edges represent the relationships between them. The strength of these connections is dynamic, changing based on usage and learning.
The heart of the system. A networkx
directed graph where nodes are concepts and edges represent the relationships between them. The strength of these connections is dynamic, changing based on usage and learning.
The architect of the Mycelium. The Builder ingests raw text, uses spaCy
's dependency parser to understand grammatical structure, and translates it into a rich graph of nodes and relationships.
The "consciousness" of MPCA. It traverses the Mycelium to find relevant pathways to answer queries. Implements Hebbian learning to reinforce successful paths and "dreaming" to form new speculative connections.
The fundamental unit of knowledge. Each node represents a word and has a type
(concept, action, property) and a strength
, indicating its importance in the network.
A highly efficient persistence mechanism. A "spore" is a serialized (pickle
) and compressed snapshot of the Mycelium, allowing the system's learned state to be saved and loaded from a tiny file (~9 MB).
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.
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.
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
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..spore
file into memory, awakening the Cognitive Mycelium.Solver
takes the core concepts and finds a thought-path through the Mycelium to construct an answer.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.
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.
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.
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.