Two stdlib-only scripts for comparing embedding models on a labelled Paperless corpus.
knn-bench.py embeds a JSONL corpus (id, correspondent, doctype, text) and scores leave-one-out nearest-neighbour accuracy per label field, with ceiling and floor. Works against a direct OpenAI-style endpoint or through a pod (--via-pod) for ClusterIP-only servers. Texts the API reports as over its token limit are shortened to fit.
knn-compare.py compares two cached runs document by document: outcome overlap, exact McNemar test, share of identical nearest neighbours.
The corpus is exported read-only from the paperless database and is not part of the repo; the export query is in the knn-bench.py docstring.
Used on 400 real documents: bge-m3 and mistral-embed were statistically indistinguishable (McNemar p=0.85 correspondent, p=0.27 document type), so embeddings stay local.
Two stdlib-only scripts for comparing embedding models on a labelled Paperless corpus.
- knn-bench.py embeds a JSONL corpus (id, correspondent, doctype, text) and scores leave-one-out nearest-neighbour accuracy per label field, with ceiling and floor. Works against a direct OpenAI-style endpoint or through a pod (--via-pod) for ClusterIP-only servers. Texts the API reports as over its token limit are shortened to fit.
- knn-compare.py compares two cached runs document by document: outcome overlap, exact McNemar test, share of identical nearest neighbours.
The corpus is exported read-only from the paperless database and is not part of the repo; the export query is in the knn-bench.py docstring.
Used on 400 real documents: bge-m3 and mistral-embed were statistically indistinguishable (McNemar p=0.85 correspondent, p=0.27 document type), so embeddings stay local.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Embeds a labelled Paperless corpus and scores nearest-neighbour correspondent and document-type accuracy against ceiling and floor. Standard library only.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Two stdlib-only scripts for comparing embedding models on a labelled Paperless corpus.
The corpus is exported read-only from the paperless database and is not part of the repo; the export query is in the knn-bench.py docstring.
Used on 400 real documents: bge-m3 and mistral-embed were statistically indistinguishable (McNemar p=0.85 correspondent, p=0.27 document type), so embeddings stay local.
🤖 Generated with Claude Code