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.2.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.2-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.2-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.2-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.2-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

File details

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

File metadata

  • Download URL: toploc-0.0.2.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for toploc-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c6f2270c90af73697a5c7d2cf575fd84b2164fdc19846931e4be6e09749a22c2
MD5 ee7e45b9f599a0d37da96468ec8a6c4a
BLAKE2b-256 600da230f5252a2f1c3872311ad24b6c88c82c24e5da5e01ffb4473e8000fc4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for toploc-0.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8927e1db712a461b1226b9a47585182df0f6198fdcab89b68bfd076479281401
MD5 e5e568510282866172672622178b937e
BLAKE2b-256 96754612d9f1c37af9474a90b3d2205cf9c0000670c79cea32ae18b126e0e8a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for toploc-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 551319b4170d1f71a3d48cadd11bfba44572df2bcf9ced7a4da18844a8797e97
MD5 8c8f8e8611aabf10c18e1c00d2b09c87
BLAKE2b-256 7e91280e9a21e0881432b204a4f0d3b4742a6c1e7e816177661d27f464e05369

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for toploc-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 59e5e0438589d72ead9c72e44ff43b65ae200d4f3f094fa5e69ee0afacc42741
MD5 70f4f3cd31bd4cc959e837a3faaf957b
BLAKE2b-256 1a8a9c56d952e50f25977960e373db4535c59caa676cbb448a51f00d55aa61ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for toploc-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 60318fba27c84a0b250c9e84ff167a660dbbf89218c51f64b5bb20590a801022
MD5 defcdfab9d539228d5b06de0c03647eb
BLAKE2b-256 f8c9da5b85f223ad4a6204031bdde45ad6ed4a44bdc6a1be9c4c155d29514e91

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