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.2.tar.gz (787.6 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.2-py3-none-any.whl (287.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mpe_lkg-0.8.2.tar.gz
  • Upload date:
  • Size: 787.6 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.2.tar.gz
Algorithm Hash digest
SHA256 6273ee9432949d45d3ee3eb471f90f37333ffd840efc67d12c625b1934527a6e
MD5 e698c8a40dea6280ff08d7330cf19145
BLAKE2b-256 84578035b92b709f6f05e143564977ef0792bfaf7ea0d71e9683997043db8573

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mpe_lkg-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 287.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b7ad439585a1ffe6ea0e4533ae20cc468d019cdc0d71b076ad1d72244de3af8c
MD5 d8c7a3595ee4b296134e5c90a2c60656
BLAKE2b-256 cdb94960d43fb4e3f1f294bc44e46c9a6e23aa868e5bfc6b9b68cdaf4c1bed03

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