Skip to main content

Distributed zkML Toolkit

Project description

DSperse: Distributed zkML

GitHub Discord Telegram Twitter Website Whitepaper

DSperse is a proving-system-agnostic intelligent slicer for verifiable AI. It decomposes ONNX neural network models into circuit-compatible segments and orchestrates compilation, inference, proving, and verification across pluggable ZK backends.

Features

  • Model Slicing: Split neural network models into individual layers or custom segments
  • ONNX Support: Slice and orchestrate ONNX models
  • Layered Inference: Run inference on sliced models, chaining the output of each segment
  • Zero-Knowledge Proofs: Generate and verify proofs for model execution via JSTprove
  • Tiling and Channel Splitting: Automatically decompose large convolutions for circuit-compatible execution
  • Proof System Agnostic: Pluggable backend architecture supporting Expander and Remainder proof systems

Documentation

  • Overview: High-level overview of the project, its goals, and features
  • JSTprove Backend: JSTprove integration and usage

Installation

From PyPI (includes CLI)

pip install dsperse

This installs both the dsperse CLI command and the Python library bindings. No additional dependencies required — everything is compiled into a single native extension.

From source (Rust binary)

cargo install --path crates/dsperse

As a Rust library

[dependencies]
dsperse = { git = "https://github.com/inference-labs-inc/dsperse.git" }

CLI Usage

DSperse provides six subcommands that form a complete pipeline:

Command Description
slice Split an ONNX model into segments
compile Compile slices into ZK circuits
run Execute chained inference across slices (--weights to inject consumer ONNX)
prove Generate ZK proofs for a completed run
verify Verify ZK proofs
full-run Execute compile, run, prove, verify in sequence (supports --weights)

Quickstart

dsperse slice --model-dir models/net
dsperse compile --model-dir models/net --parallel 4
dsperse run --model-dir models/net --input-file models/net/input.json
dsperse prove --model-dir models/net --run-dir models/net/run/run_*
dsperse verify --model-dir models/net --run-dir models/net/run/run_*

Or run the entire pipeline at once:

dsperse full-run --model-dir models/net --input-file models/net/input.json

To inject consumer weights from a fine-tuned ONNX model (same architecture, different weights):

dsperse run --model-dir models/net --input-file models/net/input.json --weights path/to/consumer.onnx
dsperse full-run --model-dir models/net --input-file models/net/input.json --weights path/to/consumer.onnx

Python Library Usage

import dsperse

metadata_json = dsperse.slice_model("models/net/model.onnx", output_dir="models/net/slices")
dsperse.compile_slices("models/net/slices", parallel=4)
run_json = dsperse.run_inference("models/net/slices", "models/net/input.json", "models/net/run")
proof_json = dsperse.prove_run("models/net/run", "models/net/slices")
verify_json = dsperse.verify_run("models/net/run", "models/net/slices")

To inject consumer weights at inference time, pass weights_onnx (path to a fine-tuned ONNX with the same architecture):

run_json = dsperse.run_inference(
    "models/net/slices", "models/net/input.json", "models/net/run",
    weights_onnx="path/to/consumer.onnx",
)

slice_model, run_inference, prove_run, and verify_run return JSON strings parseable with json.loads(). compile_slices returns None.

Project Structure

crates/dsperse/
  src/
    cli/          CLI argument parsing and command dispatch
    slicer/       ONNX model analysis, slicing, autotiling, channel splitting
    pipeline/     Compilation, inference, proving, verification orchestration
    backend/      JSTprove backend integration
    schema/       Metadata and execution result types (serde)
    converter.rs  Prepares JSTprove artifacts from ONNX files
    utils/        I/O helpers and path resolution
  tests/          Unit and integration tests
python/           Thin Python wrapper for PyO3 bindings

Contributing

Contributions are welcome. Please open issues and PRs on GitHub.

License

See the LICENSE file for details.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

dsperse-3.5.0-cp312-cp312-manylinux_2_28_x86_64.whl (9.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

dsperse-3.5.0-cp312-cp312-macosx_11_0_arm64.whl (8.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file dsperse-3.5.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: dsperse-3.5.0-cp312-cp312-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.5 MB
  • Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dsperse-3.5.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fcb847a40f9036c4e9ec650dccfff47f737e90b0e51a8d323ff7b0fd1381ec02
MD5 0637697a21d83ae7018f225882dde105
BLAKE2b-256 2e52696d1e6d9e3e73495c393d526fc223beab28721db33f0698d7c5f19875ec

See more details on using hashes here.

File details

Details for the file dsperse-3.5.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: dsperse-3.5.0-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 8.0 MB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dsperse-3.5.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7e5977540baa8a3c22bf68cd83c01f712798e33e37fe3fd0666a0dd79ca29d18
MD5 b5561f51e2902d0a33473c565cc5f3c1
BLAKE2b-256 bbd45d24ee22cf6dc0714849cd08f079f0226914c2a269e2971dc68a8ac13305

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