Skip to main content

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

  1. Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
  1. 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


Download files

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

Source Distribution

toploc-0.0.3.tar.gz (13.1 kB view details)

Uploaded Source

Built Distributions

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

toploc-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

toploc-0.0.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

toploc-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

toploc-0.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

toploc-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

toploc-0.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

toploc-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

toploc-0.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

Details for the file toploc-0.0.3.tar.gz.

File metadata

  • Download URL: toploc-0.0.3.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

Hashes for toploc-0.0.3.tar.gz
Algorithm Hash digest
SHA256 891f2c2bf501394104ffde6120a51f635decf1208fd9380e005a11254272d639
MD5 129f962047cf8ede3ec0be17642ee10a
BLAKE2b-256 fdbcd018c2c6db76f4dd7951a21100e66545c4dd18dbc08db9985cae6641f5d2

See more details on using hashes here.

File details

Details for the file toploc-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for toploc-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8c7750fcdcec8f8add954b987b3e9d472ef9d39339cd97c72ea13cd1540ee726
MD5 6039077c44e5ae5dc8524a9734572c28
BLAKE2b-256 79589490d0ff1f02a1e544442cdffec9132b308f93c05917722a0e9aba3b2177

See more details on using hashes here.

File details

Details for the file toploc-0.0.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for toploc-0.0.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 792b8d4f017b621661ef22e276d57bd9c52bdbdf70d902dc3c9030429c344dce
MD5 4d9031b777760b5a4b02e1e17e47aa08
BLAKE2b-256 b4908c46528962d4faeca0562b5480b07d177595b1f2ec8b1388b97fc42db7d9

See more details on using hashes here.

File details

Details for the file toploc-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for toploc-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c50445506caa1d4a1d02473a474a22d1c2331afaf789db9e68d1326bbaf06240
MD5 d23006bcdd4be0f632554a66eeea1902
BLAKE2b-256 db4a14cb6888fb5d30c560116533f66722bb6087e3e7a0e5fa83cf806ad791a3

See more details on using hashes here.

File details

Details for the file toploc-0.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for toploc-0.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 36982971a9daf24a0523d033a4a20da5540c1cfdad9097f9ae6ec6f38be5070c
MD5 59c1fad54cbe44748d2b19acc4d98bbe
BLAKE2b-256 245125f3cdc5171a5ec6dff6bf7a5b507d526f83dc3e5454c6de6025783d8a61

See more details on using hashes here.

File details

Details for the file toploc-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for toploc-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9100785d5ce479ccb62f03fa6eab9350226fc68e63f4889e5eccbcdafbf54f39
MD5 a5757c474d648d68114dfe0264a17a57
BLAKE2b-256 280a20c616f4bc776cdd20ba5abc99902517abcb9d72bb9a6cfcf9a012f2ce1d

See more details on using hashes here.

File details

Details for the file toploc-0.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for toploc-0.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 84805ab9e373f7b14427633c8b7325c241f49156ee9bf958e53551b725a3181d
MD5 a8b78f2db77962d093d7815c13e5be7f
BLAKE2b-256 4fdd1a5b8cadf279e160d7a7732e5f9cbcf9883fc878f3a07a2fce98c8cf3c31

See more details on using hashes here.

File details

Details for the file toploc-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for toploc-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea956bb9f34ecb61db55cd0767ddccee29b4636527b7e35dd07242d58ebddd91
MD5 21990b495416ba025e4cd3de550d8a8e
BLAKE2b-256 8db0be82eda77e7e4aa3d94227acaea3683087a0d65fa9bed8c2b4133f81115c

See more details on using hashes here.

File details

Details for the file toploc-0.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for toploc-0.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d645bfd7b762485bf8aa920711ec8d236dba9865b63f816eabd691cb42a4735d
MD5 8b33e14f21e5dd562d2a3974475372bc
BLAKE2b-256 510a5e7c3865215b746a3a2e65bf04d8f75637c8ba49c2aac9ea2b76fe3da491

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 Pingdom Monitoring Sentry Error logging StatusPage Status page