Skip to yearly menu bar Skip to main content

Workshop: MATH-AI: The 3rd Workshop on Mathematical Reasoning and AI

Teaching small transformers to rewrite ZX diagrams

Francois Charton · Alexandre Krajenbrink · Konstantinos Meichanetzidis · Richie Yeung

Keywords: [ transformers ] [ ZX calculus ] [ computing ] [ Optimization ] [ quantum ]


ZX calculus is a graphical language for reasoning about linear maps. Maps are represented as graphs, and reasoning amounts to graph rewrites. The main applications of ZX calculus are in quantum computation. We train small transformers to simplify ZX graphs, i.e. perform resource optimisation of quantum circuits. Preliminary experiments show that transformers can be trained to simplify CNOT and Clifford circuits with high accuracy. These are the simplest kinds of ZX graphs, in the sense that there exists an efficient rewrite strategy. We also show evidence that transformers learn to simplify the more complex Clifford+T graphs, for which in general there does not exist an efficient simplification algorithm.

Chat is not available.