zkML Setup

Introduction

Setting up zkML involve creating all the required artefacts to allow the generation of zero-knowledge proofs as and when required.

zkML Setup Through the CLI

Spectral's CLI will natively handle the required zkML setup for all models submitted as part of a Challenge. However, we encourage Modelers to run the end-to-end zkML workflow on their local machines for the model(s) that they wish to submit.

Given that zkML is still relatively a nascent field in terms of its practicality, there could be a few edge cases that will render a given model to be either incompatible with zkML or otherwise practically inefficient.

Spectral handles zkML setup for all submitted models as soon as they are submitted through our CLI. This is a one-time process to enable subsequent zero-knowledge proof generation and verifications.

However, we encourage Modelers to go through the setup process for their models on their local machines to ensure model compatibility and practicality with ezkl - as highlighted in the Overview and step-by-step guide.

Overview

We have partnered with zkonduit's ezkl library to facilitate zkML proof generation and verification. At a high level, ezkl's setup for a specific model involves:

  • Generate and calibrate a JSON settings file through ezkl.generate_settings() and ezk.calibrate_settings() respectively. These settings will then be used to create a quantized Halo2 circuit to represent the underlying ML model

  • Compile the ONNX model through ezkl.compile_circuit()

  • Fetch the Structured Reference String (SRS) required for zkML's trustless setup

  • Generate the proving and verifying keys (PK and VK, respectively) through ezkl.setup()

Further technical details and a step-by-step guide can be found here.

Benchmarks

Some ezkl benchmarks related to its setup across a range of model sizes on a local laptop are:

Additional Resources

Refer to our following blog posts to understand more about zkML and how Spectral aims to utilize it:

Last updated