Skip to main content

Local Knowledge Graph

Linux macOS Windows PyPI Python

Example

Ask a local model a question, watch it reason step by step — and see the reasoning as a knowledge graph that is used, not just drawn. Blue edges are embedding similarity — association. Green is what an exact evaluator settled — sums and unit conversions, in fractions, via mpeqs. Everything runs on your machine.

The graph is load-bearing

Every claim below is a measurement pinned in docs/claims/ and re-checked by CI on every push — the numbers cannot drift from the code.

what the graph does measured
writes the answer: the strongest path through the steps is what the final answer is synthesised from 54.9% → 91.2% correct on the eval that motivated it
steers exploration: sub-questions that drift from the parent, or repeat one already asked, are dropped by embedding — decisions the model cannot make about itself drift and repeats filtered in explore/settle, tested
gates the answer type: whether a numeric answer is even on the table is an embedding-relevance decision made by code, not by the model the model chose a number for "capital of France" 3/3 without it
hands arithmetic to mpeqs: expressions and unit conversions settle exactly, off the graph's facts +32.5 points where arithmetic is the task, 95% CI [+15.3, +49.7], replicated
accumulates knowledge: every run lands in per-session SQL tables and RDF, queryable across time sessions isolated, hints opt-in, GET /sessions

Not a general knowledge-graph-builder for documents or RAG: the graph here is built from the model's own reasoning and fed back into it.

Run it

pip install mpe-lkg
mpe-lkg

Open http://localhost:5100. It talks to a local model through Ollama and will tell you what is missing and the one command that fixes it. The model matters more than anything else here — measured, qwen3:4b-instruct-2507 answers 82.5% of the arithmetic battery against llama3.2:3b's 40%:

ollama pull qwen3:4b-instruct-2507-q4_K_M

Ask harder questions with mode=explore (each sub-question answered by its own run) or mode=settle (explored twice, finished only when two independent runs agree), and take any run as RDF:

curl -sX POST localhost:5100/jobs -H 'content-type: application/json' \
     -d '{"query":"How many seconds are there in 23 weeks?","mode":"settle"}'
curl -s localhost:5100/jobs/<id>/rdf

More

Modes, jobs and RDF reason / explore / settle, the vote, the probes, the vocabulary
Models and configuration Choosing models, every environment variable, troubleshooting
Embeddings from inside a model Reading a chosen layer instead of an embedding endpoint
How it works The modules, the strongest-path search, why there is no ANN index
Development Tests, and the gate that checks this documentation against measured data

Licence

The mpedb License 1.0 — the same licence as mpedb and MPEqs, byte for byte.

Free of charge for every person and every organization, with one exception: a group whose revenue or valuation exceeds five billion dollars owes a one-time fee of seven US cents per device. Not an OSI-approved licence.


Published to PyPI as mpe-lkgMorten Punnerud-Engelstad Local Knowledge Graph.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpe_lkg-0.8.1.tar.gz (783.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mpe_lkg-0.8.1-py3-none-any.whl (284.6 kB view details)

Uploaded Python 3

File details

Details for the file mpe_lkg-0.8.1.tar.gz.

File metadata

  • Download URL: mpe_lkg-0.8.1.tar.gz
  • Upload date:
  • Size: 783.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.12

File hashes

Hashes for mpe_lkg-0.8.1.tar.gz
Algorithm Hash digest
SHA256 96cd34c11b65d0770bcbec852190774171a089c7a2977cba78374b339c547179
MD5 684f0178077a87bd03cdf3ba90d4e5be
BLAKE2b-256 a14f9273f7df1ea5c060300fd97fd92d1d20d0edffef30094da41bc22b178faa

See more details on using hashes here.

File details

Details for the file mpe_lkg-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: mpe_lkg-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 284.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.12

File hashes

Hashes for mpe_lkg-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d94ca41f7ce585f18e4f56ec5ea28ca30abc1b340a89403f78696f8d8a5bec47
MD5 ee3a0b61b47010873daa05d37a3bf616
BLAKE2b-256 31be3144959f3e9bb97a05d86da8616fdd95e35052da9954aa0f239f260c2242

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page