keras2circom  by socathie

Keras model to Circom circuit transpiler

created 2 years ago
251 stars

Top 99.8% on sourcepulse

GitHubView on GitHub
Project Summary

This tool transpiles TensorFlow Keras models into Circom circuits, enabling the deployment of neural networks within zero-knowledge proofs. It targets developers and researchers in the ZKML (Zero-Knowledge Machine Learning) space looking to integrate ML models into blockchain or privacy-preserving applications.

How It Works

The tool parses a saved Keras model (.h5 format) and translates its layers and operations into equivalent Circom components. This allows for the execution of neural network inference within a ZK-SNARK-friendly arithmetic circuit, facilitating verifiable computation.

Quick Start & Requirements

  • Install dependencies: pip install -r requirements.txt or conda env create -f environment.yml.
  • Install Circom and snarkjs: bash setup-circom.sh and npm install.
  • Run transpilation: python main.py <model_path> [-o <output_dir>] [--raw]
  • Requires Python 3.x, TensorFlow, and Node.js.

Highlighted Details

  • Transpiles tf.keras models to Circom.
  • Supports raw output without ArgMax.
  • Includes a testing suite via npm test.

Maintenance & Community

No specific community channels or roadmap are detailed in the README.

Licensing & Compatibility

The repository does not explicitly state a license. Compatibility for commercial use or closed-source linking is undetermined.

Limitations & Caveats

The README does not specify which Keras layers are supported or provide performance benchmarks. The tool appears to be in early development, with potential limitations on model complexity and supported operations.

Health Check
Last commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
1 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.