Bridging Knowledge Graphs and Large Language Models through stochastic semantic exploration.
📖 Related article: WalkGPT: Random Walks Meet Language Models
WalkLLM is an experimental framework that connects Knowledge Graphs (KGs) and LLMs by using random walks to drive context-aware prompting and semantic exploration.
Each step in the walk guides the language model to generate or query new information, effectively simulating a conversational traversal of a structured space.
- 🔁 Perform random walks over any RDF-style or NetworkX-style graph
- 💬 Use walk paths to construct evolving prompts for LLMs
- 🧩 Mix deterministic queries with generative text
- 🕸 Semantic drift control via walk temperature and history
- ⚙️ Pluggable backends for LLM inference (OpenAI, Hugging Face, etc.)
git clone https://github.com/Mircus/WalkLLM.git
cd WalkGPTpip install -r requirements.txtpython walkllm.py --config config.json- A graph is loaded (e.g. social graph, ontology, KG)
- A random walk selects a sequence of nodes/edges
- A prompt template integrates this walk as context
- An LLM generates or completes based on the prompt
- The output can be used to guide further walks or exploration
This creates a loop between symbolic structure and linguistic creativity.
- Python
- NetworkX / RDFLib (for graph walks)
- OpenAI / Hugging Face Transformers
- JSON-based config system
MIT License — see LICENSE file.
This work explores the intersection between neuro-symbolic AI, semantic traversal, and generative reasoning. It's part of the Holomathics project.
If you use WalkLLM in your research or creative work, please cite or link the Medium article.
Built to walk ideas into words.