Lib for generating model inference and training proofs
Project description
TOPLOC: A Locality Sensitive Hashing Scheme for Trustless Verifiable Inference
TOPLOC is a novel method for verifiable inference that enables users to verify that LLM providers are using the correct model configurations and settings. It leverages locality sensitive hashing for intermediate activations to detect unauthorized modifications.
For code used in our experiments, check out: https://github.com/PrimeIntellect-ai/toploc-experiments
Installation
pip install -U toploc
Features
- Detect unauthorized modifications to models, prompts, and precision settings
- 1000x reduction in storage requirements compared to full activation storage
- Validation speeds up to 100x faster than original inference
- Robust across different hardware configurations and implementations
- Zero false positives/negatives in empirical testing
Development Setup
- Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
- Setup virtual environment: This can take awhile because of the C extensions.
uv venv --python 3.12
source .venv/bin/activate
uv sync --dev
Running Tests
Run the test suite:
uv run pytest tests
Run single file:
uv run pytest tests/test_utils.py
Run single test:
uv run pytest tests/test_utils.py::test_get_fp32_parts
Code Quality
Install pre-commit hooks:
uv run pre-commit install
Run linting and formatting on all files:
pre-commit run --all-files
Citing
@misc{ong2025toploclocalitysensitivehashing,
title={TOPLOC: A Locality Sensitive Hashing Scheme for Trustless Verifiable Inference},
author={Jack Min Ong and Matthew Di Ferrante and Aaron Pazdera and Ryan Garner and Sami Jaghouar and Manveer Basra and Johannes Hagemann},
year={2025},
eprint={2501.16007},
archivePrefix={arXiv},
primaryClass={cs.CR},
url={https://arxiv.org/abs/2501.16007},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toploc-0.0.2.dev1.tar.gz.
File metadata
- Download URL: toploc-0.0.2.dev1.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2f73e787096f7b7bfa2f1a2e5af1f68a156cc6dd76124dca3e52be334f5a495
|
|
| MD5 |
82321c2b2d737a9a1a7e334835276d28
|
|
| BLAKE2b-256 |
996e00c085b986782d6e57e9f9a841d8528d0abd05119490adc0925252274b5c
|
File details
Details for the file toploc-0.0.2.dev1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: toploc-0.0.2.dev1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae57320aba152d0fcb43763d7b1398a79ef940f2b8d60aacc5b015b4b39a53c2
|
|
| MD5 |
316ff2d0fc5e77b62393a7b2d8fd48c3
|
|
| BLAKE2b-256 |
b19ae1dff7e13cb038611262a901e3164aaa90cab87ba3ab301eae510b233eca
|
File details
Details for the file toploc-0.0.2.dev1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: toploc-0.0.2.dev1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab62cd0e5d78081f9680562f637030da250718d758667124ee365bb38b081f5d
|
|
| MD5 |
669b4b04bf86f965547ce3ce450f322c
|
|
| BLAKE2b-256 |
6c82ab16ba70ace0719a40ac866cffd3bbbf4ea633bdd6ea5d366490f94089ff
|
File details
Details for the file toploc-0.0.2.dev1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: toploc-0.0.2.dev1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
570d19af5463b1e33fd1cf04192babb408268b812acaa82b162cc9c1548ef637
|
|
| MD5 |
62bd9c659e0a07345401bbbb7ee0fbfa
|
|
| BLAKE2b-256 |
110ce018019533829aefcc957ec39280ec6814837d811d5fdfc53dc3ebef1b2d
|
File details
Details for the file toploc-0.0.2.dev1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: toploc-0.0.2.dev1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fccec919f5a0376f2e27ebf77a1cd7004ac4fbfb8dc39cc552e908435df9ddc
|
|
| MD5 |
7f39e89eacbce62a02561daad100f8f6
|
|
| BLAKE2b-256 |
29300be4e42540a54e3de0e846c71a03e30fa281a0f0643ddbcdfbb26b863d2b
|
File details
Details for the file toploc-0.0.2.dev1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: toploc-0.0.2.dev1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dbd259a023762a6e1eeee454dc9c865b5a0aec2ed1856bfb77027d3ccdb0cc8
|
|
| MD5 |
6a40e2fe8cdf6be8c1929f351a96b337
|
|
| BLAKE2b-256 |
829a885b20264ceb872a3cc668a867e6f66af9bb462a0a921c2c587cd9950e0a
|
File details
Details for the file toploc-0.0.2.dev1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: toploc-0.0.2.dev1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7d87cc72694687ca9e9864d4db6dd9e9dc3ebf0bef5477d8c54d95a9eb44a02
|
|
| MD5 |
b8dbe0dfdbaf5e412a6bc1f8e0533b68
|
|
| BLAKE2b-256 |
d70cead4d25035703fb704e65f075bc8b3a00fafd59582d7c3ba581b20a3ad3b
|
File details
Details for the file toploc-0.0.2.dev1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: toploc-0.0.2.dev1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
580296ba9361f12fe97362df0bdd6bbda95f72b5d9248b6960a0e1d800cac8f9
|
|
| MD5 |
4e9fdd825e429f9d590568fe8916161c
|
|
| BLAKE2b-256 |
36603081831b35d2b96bee253e91970ecaa81cdbd33463dda193a4ac7d6998bc
|
File details
Details for the file toploc-0.0.2.dev1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: toploc-0.0.2.dev1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e71499756b87d5e67a38a98404733ec221b2664822b4dd9c755f4a690d1b8668
|
|
| MD5 |
26a0a618f9d8ecbe31bba7bd0e186d38
|
|
| BLAKE2b-256 |
6032e96f9a6835ead37ddcf08fcaad33f59204037a6ce7d7cf94df57037528e7
|