Reinforcement Learning for Adaptive Composition of Quantum Circuit Optimisation Passes
Daniel Mills, Ifan Williams, Jacob Swain, Gabriel Matos, Enrico Rinaldi, Alexander Koziell-Pipe
TL;DR
This work addresses the suboptimal reliance on general-purpose default optimisation-pass sequences for quantum circuits by training an RL agent to compose bespoke sequences that reduce two-qubit gate counts. Using PPO with graph neural networks on a circuit-graph representation, the agent selects PyTKET Passes and a DoNothing option to iteratively refine circuits, achieving a cumulative two-qubit gate reduction of $0.577$ mean and $0.567$ median on a diverse test set, outperforming the best default PyTKET sequences. The approach demonstrates strong in-distribution performance, strong generalisation to larger circuits, and superior scalability compared with beam-search and other search-based methods. These results reduce the need for extensive expert tuning and suggest pathways to extending the framework to regional rewrites and broader pass libraries, with potential applicability to other resource metrics such as T-gate counts in fault-tolerant regimes. $\,$
Abstract
Many quantum software development kits provide a suite of circuit optimisation passes. These passes have been highly optimised and tested in isolation. However, the order in which they are applied is left to the user, or else defined in general-purpose default pass sequences. While general-purpose sequences miss opportunities for optimisation which are particular to individual circuits, designing pass sequences bespoke to particular circuits requires exceptional knowledge about quantum circuit design and optimisation. Here we propose and demonstrate training a reinforcement learning agent to compose optimisation-pass sequences. In particular the agent's action space consists of passes for two-qubit gate count reduction used in default PyTKET pass sequences. For the circuits in our diverse test set, the (mean, median) fraction of two-qubit gates removed by the agent is $(57.7\%, \ 56.7 \%)$, compared to $(41.8 \%, \ 50.0 \%)$ for the next best default pass sequence.
