Table of Contents
Fetching ...

Qandle: Accelerating State Vector Simulation Using Gate-Matrix Caching and Circuit Splitting

Gerhard Stenzel, Sebastian Zielinski, Michael Kölle, Philipp Altmann, Jonas Nüßlein, Thomas Gabor

TL;DR

Qandle tackles the exponential cost of state-vector quantum circuit simulation by combining two key techniques: gate matrix caching and circuit splitting, implemented within a PyTorch-focused workflow and OpenQASM compatibility. Gate matrix caching decomposes gates into partial matrices and caches Kronecker-expanded operators to minimize repeated forward-pass computations, while circuit splitting partitions large circuits into smaller subcircuits via a dependency graph, enabling efficient, batched applications on reduced state-vector portions. Compared against PennyLane, Qiskit, and TorchQuantum, Qandle demonstrates superior execution speed and lower memory usage for representative circuits, aided by PyTorch compilation and memory-aware caching strategies. This work enables tighter integration of quantum circuits with classical ML pipelines, expanding practical quantum machine learning workflows and suggesting future enhancements in gate coverage and graph-based splitting to further improve scalability and robustness.

Abstract

To address the computational complexity associated with state-vector simulation for quantum circuits, we propose a combination of advanced techniques to accelerate circuit execution. Quantum gate matrix caching reduces the overhead of repeated applications of the Kronecker product when applying a gate matrix to the state vector by storing decomposed partial matrices for each gate. Circuit splitting divides the circuit into sub-circuits with fewer gates by constructing a dependency graph, enabling parallel or sequential execution on disjoint subsets of the state vector. These techniques are implemented using the PyTorch machine learning framework. We demonstrate the performance of our approach by comparing it to other PyTorch-compatible quantum state-vector simulators. Our implementation, named Qandle, is designed to seamlessly integrate with existing machine learning workflows, providing a user-friendly API and compatibility with the OpenQASM format. Qandle is an open-source project hosted on GitHub https://github.com/gstenzel/qandle and PyPI https://pypi.org/project/qandle/ .

Qandle: Accelerating State Vector Simulation Using Gate-Matrix Caching and Circuit Splitting

TL;DR

Qandle tackles the exponential cost of state-vector quantum circuit simulation by combining two key techniques: gate matrix caching and circuit splitting, implemented within a PyTorch-focused workflow and OpenQASM compatibility. Gate matrix caching decomposes gates into partial matrices and caches Kronecker-expanded operators to minimize repeated forward-pass computations, while circuit splitting partitions large circuits into smaller subcircuits via a dependency graph, enabling efficient, batched applications on reduced state-vector portions. Compared against PennyLane, Qiskit, and TorchQuantum, Qandle demonstrates superior execution speed and lower memory usage for representative circuits, aided by PyTorch compilation and memory-aware caching strategies. This work enables tighter integration of quantum circuits with classical ML pipelines, expanding practical quantum machine learning workflows and suggesting future enhancements in gate coverage and graph-based splitting to further improve scalability and robustness.

Abstract

To address the computational complexity associated with state-vector simulation for quantum circuits, we propose a combination of advanced techniques to accelerate circuit execution. Quantum gate matrix caching reduces the overhead of repeated applications of the Kronecker product when applying a gate matrix to the state vector by storing decomposed partial matrices for each gate. Circuit splitting divides the circuit into sub-circuits with fewer gates by constructing a dependency graph, enabling parallel or sequential execution on disjoint subsets of the state vector. These techniques are implemented using the PyTorch machine learning framework. We demonstrate the performance of our approach by comparing it to other PyTorch-compatible quantum state-vector simulators. Our implementation, named Qandle, is designed to seamlessly integrate with existing machine learning workflows, providing a user-friendly API and compatibility with the OpenQASM format. Qandle is an open-source project hosted on GitHub https://github.com/gstenzel/qandle and PyPI https://pypi.org/project/qandle/ .
Paper Structure (22 sections, 2 equations, 4 figures, 1 table)

This paper contains 22 sections, 2 equations, 4 figures, 1 table.

Figures (4)

  • Figure 1: Simulation results for the network.
  • Figure 2: Memory usage for a hardware-efficient SU(2) circuit with varying numbers of qubits. Qandle exhibits lower memory usage compared to other simulators.
  • Figure 3: Gradients in circuits with 3 and 5 qubits. The y-axis represents the parameter index, while the x-axis displays the absolute gradient of that parameter at different rotations, with other parameters remaining constant. Brighter colors signify higher absolute gradients.
  • Figure 4: Simulation results for the network, showing only the fastest run.