← Protocols
Modulus Labs
AI Agent / Web3·Ethereum · EVM L2s

Modulus Labs

01Description

Verifiable AI inference via hand-tuned zero-knowledge proofs over neural networks. Generates SNARKs that an EVM contract can verify so smart contracts can trust off-chain ML outputs.

02Best for
  • 01verifiable AI inference
  • 02on-chain ML predictions
  • 03zk proofs for trading bots
  • 04trust-minimized agents
  • 05specialized zkML circuits
03Install
  • git clone https://github.com/Modulus-Labs/halo2_ml
  • cargo build --release
04Environment variables
VariableScopeDescription
MODULUS_PROVER_ENDPOINTServerURL of the Modulus proving service or self-hosted halo2_ml prover.
05Prompt snippet
Use Modulus Labs to generate zk-SNARK proofs of neural network inference. Export the model to a Halo2-friendly circuit (typically a small feed-forward net with ReLU, like the RockyBot reference), call the prover with the input vector, and submit `(publicInputs, proof)` to a Solidity verifier contract on-chain. Treat each inference as `verify(proof, publicInputs)` returning a boolean — gate downstream contract logic on it. For larger models, recursively aggregate Halo2 proofs before final on-chain settlement.
06Gotchas
  • Proof generation is expensive — even small (~1M parameter) models can take minutes on CPU; budget for GPU/CUDA proving infrastructure.
  • Models must be quantized to fixed-point arithmetic; floating-point ops cannot be expressed in Halo2 circuits without precision loss.
  • On-chain verification gas is non-trivial (hundreds of thousands of gas per proof); recursive aggregation is required for production use.
  • Modulus focuses on hand-optimized circuits — there is no general PyTorch->circuit pipeline; expect to write custom Halo2 chips for novel architectures.
  • Public tooling lags research; pin commits and expect breaking changes between halo2_ml versions.
07Alternatives