# Knowledge Graph Extractor

A self-hosted tool that turns any document, URL, or zip of files into an interactive knowledge graph, extracting subject-predicate-object facts with a locally-run LLM.

Knowledge Graph Extractor takes pasted text, a URL fetched to Markdown, or a zip of mixed files, such as text, Markdown, HTML, PDF, Word, JSON, CSV, or code, and extracts atomic subject-predicate-object triples using a self-hosted large language model. Each extracted fact becomes a graph edge with a title, description, evidence span, confidence score, tags, and source file, streamed into a force-directed graph where hovering an edge shows the full card; oversized documents are chunked rather than truncated so the whole document gets processed.

By default, extracted facts are semantically deduplicated on CPU using a small embedding model, across both multiple rounds and multiple input files, and node names are normalized so that variants of the same entity merge into one node. Results can be downloaded as JSONL. Because the GPU backing the model has only one inference slot, submissions run one at a time through a single-slot scheduler that preempts the current job for a new submission and auto-resumes the interrupted job later; job state persists to disk so the list and results survive restarts. The stack runs a llama.cpp server behind a FastAPI application that handles extraction, scheduling, deduplication, and the UI, set up with Docker and the NVIDIA Container Toolkit on a single GPU.

Website: https://hanxiao.io/knowledge-graph
