Circom-MPC Summary

Circom-MPC - a project, that allows to port Circom zk-circuits to MPC circuits and to run it with a picked backend.

This topic covers two tools:

  1. circom-2-arithc - Fork of Circom; compiles circuits to Bristol Fashion format
  2. circom-mp-spdz - transpiler from Bristol format to .mpc files to run with MP-SPDZ backend; might be changed for other backends (s.a. mpz) too

circom-2-arithc

Most up to date info can be found in README.md

Aim of the project - to have a DSL that developers are familiar with - for MPC, + to port currently available circuits/protocols with no need to change the code.

Current state - supports Circom 2.1.0; has some minor bugs & not optimized (for big circuits, esp. with many loops, takes much time to compile).

Circom-2-arithc can compile circuits to both Arithmetic circuits & Boolean circuits (specified by the flag); also it has minimal support of types (e.g. MP-SPDZ's sint | sfloat) - the info is added to output file and e.g. can be used on a .mpc file generation stage.

circom-mp-spdz

Set of scripts to transpile (from Bristol to .mpc), run (with MP-SPDZ), benchmark (including remote machines benchmarking) and check accuracy of the output (used for ML circuits).

ML circuits are used as a main use-case and example for the project.
The circuits were taken from [socathie/circomlib-ml])(https://github.com/socathie/circomlib-ml), they can be ported to MPC with no changes.
As a result we executed, benchmarked and checked the accuracy for all circuits. More info on results can be found in BENCHMARK.md and ACCURACY.md.

An in-depth review of circomlib-ml-mpc can be found here. This file also contains the instruction on how we can benchmark/test the circuits.

Short overview for Keras2Circom-MPC

As a part of Circom-MPC project we also were able to run synthetic and real-world ML model in MPC.
For that we used Keras2Circom. Keras2Circom allows to compile Keras model to Circom circuit - thus, having the compiler we can run Keras2Circom generated circuit in MPC.

We generated two circuits with Keras2Circom:

  • Synthetic model - a model that does nothing useful: it only combines many layers; it's created for testing purposes
  • Real-World model - real-world (useful) ML model, taken from keras2circom example. We were able to compile it, and it's possible to run it, but it takes ~30 minutes to compile on M3 Max (due to non optimized compiler) and many hours to run (more than 107000 gates and wires)

Open questions

  • Should we continue working on Circom-MPC? Is it really useful for devs? Is there a demand for MPC apps creation?
  • What features should we add to the compiler and how can we optimize it?
  • What other applications should we explore and build with the given tooling?