Graph your documents with a local LLM and zero cloud spend
Turn any text corpus into an interactive concept map without sending a single token to the cloud.

What it does Splits a body of text into chunks, then uses a local Mistral 7B model to extract concepts and their relationships. It treats co-occurrence within a chunk as a contextual edge, merges duplicate pairs, and hands the result to NetworkX and Pyvis for visualization and basic graph analytics like degree and community detection. Everything stays on your machine; there are no calls to OpenAI.
The interesting bit The author deliberately extracts concepts rather than raw entities—so “Pleasant weather in Bangalore” becomes a node, not just “Bangalore”—and weights edges by both LLM-inferred relationships and simple contextual proximity. The result is a graph schema built in Pandas, which is either admirably pragmatic or a reminder that this is still a notebook-sized experiment.
Key highlights
- Runs fully offline using Mistral 7B via Ollama; no API keys or cloud spend.
- Extracts higher-level concepts instead of just named entities, aiming for richer semantic nodes.
- Collapses multiple relationships between the same concept pair into a single weighted edge.
- Uses Pyvis to generate interactive web-ready visualizations (see the repo’s GitHub Pages link).
- Ships as a Jupyter notebook (
extract_graph.ipynb) rather than a packaged library.
Caveats
- The author flags that deduplication is still manual: semantically identical concepts like
doctoranddoctorscan spawn separate nodes until embeddings are added. - There is no dedicated frontend for exploration yet; interaction is limited to the Pyvis visualization or notebook output.
- Graph storage is a set of Pandas dataframes, so this is an analytics script rather than a persistent knowledge base.
Verdict A useful sandbox if you are experimenting with Graph RAG and need a fully local, zero-cost pipeline to turn documents into concept webs. Skip it if you need a hardened, deduplicated graph database backend or a polished query interface out of the box.
Frequently asked
- What is rahulnyk/knowledge_graph?
- Turn any text corpus into an interactive concept map without sending a single token to the cloud.
- Is knowledge_graph open source?
- Yes — rahulnyk/knowledge_graph is open source, released under the MIT license.
- What language is knowledge_graph written in?
- rahulnyk/knowledge_graph is primarily written in Jupyter Notebook.
- How popular is knowledge_graph?
- rahulnyk/knowledge_graph has 3.3k stars on GitHub.
- Where can I find knowledge_graph?
- rahulnyk/knowledge_graph is on GitHub at https://github.com/rahulnyk/knowledge_graph.