International Association for Cryptologic Research

International Association
for Cryptologic Research

Advances in Cryptology – ASIACRYPT 2025

Scalable zkSNARKs for Matrix Computations:

A Generic Framework for Verifiable Deep Learning


README

Evalyn: Scalable zkSNARKs for Matrix Computations

This workspace contains the implementation and experiments for the paper:

Scalable zkSNARKs for Matrix Computations: A Generic Framework for Verifiable Deep Learning

It provides building blocks for matrix-oriented zkSNARK protocols and a composite example for verifiable neural networks.

Quick Start

# 1. Clone and build the project
cargo build --workspace --release

# 2. Run the neural network experiment (fast demo with depth=16)
RAYON_NUM_THREADS=8 cargo run --release -p composite --example experiment_nn

# 3. Run tests to verify installation
cargo test --workspace --release

Note for Windows users: It is recommended to run the above commands inside WSL (Windows Subsystem for Linux).

Configuration Options

Status and reproducibility

This repository is a frozen snapshot intended for reproducing the paper's experiments. It will not receive further updates. We are continuing active development privately, and a commercial version will be released later. For reproduction, please use this snapshot as-is; issues and PRs may not be triaged.

Source Code Organization

The codebase is organized as a Rust workspace with the following crates:

Core Library Crates

Application Crate

Architecture

Upstream attribution

The poly-commit crate in this workspace is forked from arkworks' implementation:

We maintain local changes for experimental features and integration with this workspace.

Dependencies and Prerequisites

System Requirements

For Fast Demo (depth=16, default configuration)

For Full Paper Results (depth=1024, requires modification)

Software Dependencies

Performance Recommendations

Building the Artifact

Basic Build

# Build all workspace crates in release mode (recommended)
cargo build --workspace --release

# Build in debug mode (for development only)
cargo build --workspace

Verify Build

# Check that all crates compile successfully
cargo check --workspace --release

Running the Artifact

Neural Network Example (Main Experiment)

Fast Demo (depth=16, default configuration)

The current code is configured for a fast demonstration with 16 layers:

# Run with optimal settings (recommended)
RAYON_NUM_THREADS=64 cargo run --release -p composite --example experiment_nn

# Run with fewer threads for limited hardware
RAYON_NUM_THREADS=8 cargo run --release -p composite --example experiment_nn

Current default settings:
- Depth: 16 layers (defined by const DEPTH: usize = 16;)
- Shape: 1024×1024 matrices per layer
- Expected runtime: ~5 minutes (with 8 threads)
- Peak memory: ~4GB

Full Paper Results (depth=1024)

To reproduce the exact paper results with 1024 layers, modify the code:

  1. Edit composite/example/experiment_nn.rs:

    // Change line 11 from:
    const DEPTH: usize = 16;
    // To:
    const DEPTH: usize = 1024;
    
  2. Rebuild and run:

    cargo build --workspace --release
    RAYON_NUM_THREADS=64 cargo run --release -p composite --example experiment_nn
    

Paper configuration settings:
- Depth: 1024 layers
- Shape: 1024×1024 matrices per layer
- Expected runtime: ~35-37 minutes (with 64 threads)
- Peak memory: ~256GB

Configuration Options

Quantization modes (8-bit vs 16-bit)

The code supports two quantization configurations for the NN example:

Rebuild the workspace after making changes.

Network Depth Configuration

Current Default (depth=16)

The repository is configured by default to run a fast demonstration with 16 layers:
- File: composite/example/experiment_nn.rs
- Line 11: const DEPTH: usize = 16;
- Purpose: Quick validation and demonstration (~5 minutes runtime)

Paper Results (depth=1024)

To reproduce the full paper results with 1024 layers:

  1. Modify the depth constant:

    // In composite/example/experiment_nn.rs, line 11
    // Change from:
    const DEPTH: usize = 16;
    // To:
    const DEPTH: usize = 1024;
    
  2. Rebuild and run:

    cargo build --workspace --release
    RAYON_NUM_THREADS=64 cargo run --release -p composite --example experiment_nn
    

System Requirements by Configuration

Note: The depth=1024 configuration requires substantial computational resources and is intended for reproducing the exact paper benchmarks.

Testing

Run All Tests

# Run all tests across the workspace (recommended)
cargo test --workspace --release

Run Tests for Specific Crates

# Test atomic proof protocols
cargo test -p atomic_proof --release

# Test matrix operations and utilities
cargo test -p mat --release

# Test composite protocols
cargo test -p composite --release

# Test Fiat-Shamir transcript functionality
cargo test -p fsproof --release

# Test polynomial commitment schemes
cargo test -p ark-poly-commit --release

Test Output Interpretation

Experimental Results

System and Setup

We conducted experiments on an Alibaba Cloud Elastic Compute Service (ECS) instance equipped with 64 Intel Xeon 6982P-C (x86_64) vCPUs clocked between 0.8–3.9 GHz and 256 GB RAM. The server has a 504 MB shared L3 cache and runs Ubuntu 22.04 LTS (Linux kernel 5.15).

Model Configurations

Fast Demo Configuration (depth=16, default)

Paper Results Configuration (depth=1024)

Where for each layer:

Performance summary

Overall metrics for the NN example under two quantization modes (RAYON_NUM_THREADS=64).

Metric 8-bit (i8/i32) 16-bit (i16/i64)
Commitment time — parameters (s) 1276.80 1360.50
Commitment time — structure (s) 747.07 737.30
Commitment size (KB) 42.27 42.27
Prover time — total (s) 2090.71 2210.88
Proof size (KB) 98.84 98.84
Verifier time (ms) 173.19 172.72
Peak RAM (GB) 87.42 103.63

Prover time breakdown

Detailed decomposition of prover wall-clock time.

Component 8-bit (s) 16-bit (s)
Auxiliary input commitment 733.08 755.61
Proof reduction 218.80 293.16
PoP proving 775.36 765.05
Leaf commitment opening 25.46 31.23
Fiat–Shamir transform proving 338.01 356.83
Total 2090.71 2210.88
v.s Unverified computation 3.53 4.64

Notes on measurement

Notes on RAM usage

Interpreting Output

Neural Network Experiment Output

The experiment_nn example produces detailed timing and memory usage statistics:

Key Metrics

Output Format

Performance Interpretation

Platform-Specific Notes

Windows/WSL Recommendations

Linux Recommendations

License

This project is licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Citation

If you use this codebase in academic work, please cite the paper:

Mingshu Cong, Sherman S. M. Chow, Siu Ming Yiu, and Tsz Hon Yuen. Scalable zkSNARKs for Matrix Computations: A Generic Framework for Verifiable Deep Learning. To appear in Asiacrypt 2025 https://eprint.iacr.org/2025/1646