Verifiable evaluations of machine learning models using zkSNARKs

Tobin South, Alexander Camuto, Shrey Jain, Shayla Nguyen, Robert Mahari, Christian Paquin, Jason Morton, Alex 'Sandy' PentlandarXiv 2024 · DOI

Introduction

As flagship AI models increasingly move toward closed-source deployments, users and regulators are forced to rely on the unverified claims of model providers. Whether it is a claim about a model's accuracy on a specific benchmark or its adherence to safety and fairness standards, there is currently no mechanism to verify these assertions without access to the model's proprietary weights. This paper introduces a cryptographic framework to bridge this transparency gap, enabling "trust, but verify" for the AI industry.

The Transparency Gap in AI

The "black box" nature of commercial AI creates significant risks. First, providers may engage in dishonest marketing, overstating performance. Second, a "model swap" scenario might occur where a provider benchmarks a high-quality model but serves a cheaper, lower-performing version in production to minimize compute costs. Traditionally, verification requires sharing model weights, which companies guard as trade secrets. This work proposes using Zero-Knowledge Succinct Non-Interactive Arguments of Knowledge (zkSNARKs) to prove that a specific set of private weights—identified by a cryptographic hash—produced a specific output on a given dataset.

Methodology: The ezkl Framework

The authors present ezkl, a toolkit designed to convert standard machine learning models into cryptographic circuits. The process involves several key technical steps:

  1. ONNX to Circuit Mapping: Standard models in ONNX format are translated into cryptographic circuits, ensuring compatibility with a wide range of neural network architectures.
  2. Quantization: Since zkSNARKs operate over finite fields, the system converts floating-point weights and inputs into fixed-point arithmetic.
  3. Verifiable Evaluation Attestation: A developer evaluates a trained model on benchmark data and generates zero-knowledge proofs of valid inference. These are packaged into a "Verifiable Eval" attestation.
  4. Challenge-Based Auditing: In production, users can verify that the model inference they receive matches the model weights hash published in the attestation.
Detailed technical workflow of the ezkl system, from proof setup to attestation creation and future inference checking.

Experimental Evaluation

The framework was tested across multiple modalities and benchmarks, including MNIST (MLP/CNN), CelebA (VAE for facial generation), and HumanEval (nanoGPT for code generation). These tests aimed to quantify the "cost of verification" in terms of proving time, memory requirements, and verification latency.

Key Results and Performance

The study demonstrates that while verification is feasible, it comes with significant computational overhead that scales with model size. For small models like MLPs or SVMs, proving time is nearly instantaneous (<0.3s). Medium-sized models like CNNs and LSTMs require between 3 and 35 seconds. However, the overhead becomes substantial for transformer architectures; proving a single token generation for a 250k parameter nanoGPT model took approximately 46 minutes and required 219GB of RAM.

Scaling of proof generation time as a function of the number of constraints in the cryptographic circuit.

Despite the high cost of generating proofs, the verification time—the time required for a user to check the proof—remained consistently low, typically under 3 seconds, regardless of the model's complexity. This property of succinctness is a core advantage of the zkSNARK approach, as it allows the heavy lifting to be done by the provider while the user performs a lightweight check.

Limitations and Future Work

The primary bottleneck for scaling to frontier models (e.g., GPT-4) is memory and proving time. The 46-minute proving time for a 250k parameter model highlights the gap between current ZK capabilities and the requirements of billion-parameter LLMs.

Future research directions include leveraging GPU acceleration, implementing proof splitting for parallel processing, and utilizing recursive folding schemes like Nova to handle larger sequences. Additionally, designing "ZK-friendly" neural network architectures could further reduce the cryptographic overhead.

Summary updated

BibTeX
@misc{south2024verifiable,
  author = {Tobin South and Alexander Camuto and Shrey Jain and Shayla Nguyen and Robert Mahari and Christian Paquin and Jason Morton and Alex 'Sandy' Pentland},
  title = {{Verifiable evaluations of machine learning models using zkSNARKs}},
  year = {2024},
  eprint = {2402.02675},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.02675},
}
Figure