Polycirc is a library for differentiating arithmetic circuits for zero-knowledge machine learning.


Install with pip:

pip install yarrow-polycirc

Further Reading

Polycirc is an implementation of the differentiable polynomial circuits of Wilson and Zanasi [WZ22] using the hypergraph-based datastructure of yarrow-diagrams which is described in Wilson and Zanasi [WZ23].

Differentiability of polynomial circuits is based the paper Cockett et al. [CCG+19]; a detailed graphical explanation can be found in Wilson and Zanasi [WZ22].



Robin Cockett, Geoffrey Cruttwell, Jonathan Gallagher, Jean-Simon Pacaud Lemay, Benjamin MacAdam, Gordon Plotkin, and Dorette Pronk. Reverse derivative categories. 2019. arXiv:1910.07065.


G. S. H. Cruttwell, Bruno Gavranović, Neil Ghani, Paul Wilson, and Fabio Zanasi. Categorical foundations of gradient-based learning. 2021. arXiv:2103.01931.

[WZ22] (1,2)

Paul Wilson and Fabio Zanasi. Categories of differentiable polynomial circuits for machine learning. 2022. arXiv:2203.06430.


Paul Wilson and Fabio Zanasi. Data-parallel algorithms for string diagrams. 2023. arXiv:2305.01041.