NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

TorchQuantumDistributed

Oliver Knitter, Jonathan Mei, Masako Yamada, Martin Roetteler

TL;DR

TorchQuantumDistributed (tqd) is an open-source, PyTorch-based library for accelerator-agnostic, distributed, and differentiable quantum state vector simulation. By sharding quantum states across multi-GPU clusters and leveraging reversible unitary computing, tqd allows researchers to train and scale parameterized quantum circuits to tens of qubits without being locked into proprietary hardware stacks.

What Problem Does This Paper Address?

Simulating quantum circuits using classical hardware requires maintaining a state vector whose memory footprint scales exponentially with the number of qubits ($2^q$ complex amplitudes for $q$ qubits). For researchers in Quantum Machine Learning (QML), this memory bottleneck is exacerbated during training: automatic differentiation typically caches all intermediate activations along the backward pass.

While existing frameworks (such as Qiskit, Cirq, PennyLane, and the original TorchQuantum) provide convenient Python APIs, they fall short when scaling state vector simulations:

  • Most cannot distribute a single state vector across multiple accelerators (nodes/GPUs) outside specialized, proprietary ecosystems (like NVIDIA CUDA/cuQuantum).
  • Existing native PyTorch implementations do not support multi-GPU state sharding via torch.distributed.

This hardware lock-in and memory ceiling prevent researchers from exploring QML models large enough to test potential quantum advantages on non-CUDA supercomputers.

Methods

tqd builds directly on PyTorch's distributed primitives (DTensor) and introduces several systems-level innovations:

  • State Sharding and Dimension Grouping: A $q$-qubit state has $2^q$ entries. PyTorch subroutines degrade or fail when tensor ranks exceed ~16. Rather than mapping each qubit to a separate tensor dimension, tqd groups contiguous unsharded qubits into sub-dimensions while assigning individual sharded qubits to distributed dimensions across $d$ accelerators ($\log_2 d$ sharded dimensions).
  • In-Memory Bookkeeping: Standard TorchQuantum permutes dimensions before and after every gate evaluation. tqd instead tracks qubit layout permutations logically in a secondary index tensor, performing matrix multiplications in place and avoiding extraneous memory shuffling.
  • Activation Recomputation (Invertible Unitaries): Because quantum gates are unitary ($U^{-1} = U^\dagger$), backward passes can recompute layer inputs directly from outputs ($x = U^\dagger y$). This eliminates intermediate activation caching, slashing peak memory usage during backpropagation.
  • Distributed & Differentiable Shot Noise: Quantum measurements inherently produce stochastic categorical samples (shot noise):
  • Exact Sampling: Implemented across nodes using a hierarchical multinomial scheme where nodes locally sum parameter subsets, synchronize marginal totals, sample group counts, and locally sample final basis states.
  • Differentiable Approximate Sampling: In the high-shot limit, measurements are approximated as a multivariate Gaussian using a closed-form Householder covariance factorization ($S = I - vv^\top$) via the reparameterization trick, keeping the backward gradient flow intact.

Datasets

Not discussed in the paper. The authors benchmark the library using synthetic circuit workloads rather than external datasets.

Key Insights and Ideas

  • Reversibility Eliminates the Gradient Memory Wall: Training deep neural networks often requires heavy activation checkpointing; in QML, unitarity gives checkpointing for free ($x = U^\dagger y$), neutralizing the storage penalty of backpropagation.
  • Differentiable Quantum Measurement via Reparameterization: Real hardware returns finite measurement shots, not exact analytical probabilities. By reformulating shot noise into a Householder-factorized Gaussian approximation, tqd makes noisy measurement fully differentiable.
  • Hardware-Agnostic Scaling: By relying purely on native PyTorch distributed primitives (torch.distributed), tqd runs seamlessly across diverse accelerator architectures (including AMD ROCm and NVIDIA CUDA).

Key Results

The authors evaluated tqd on an HPC cluster equipped with AMD Instinct MI250X accelerators (each containing two 64 GB Graphics Compute Dies, treated as individual GPUs):

  • Workload: A ladder ansatz composed of alternating CNOT gates and parameterized single-qubit $R_Y(\theta)$ rotations, trained using Adam (batch size 16) over 5 optimization steps.
  • Scaling Range: Evaluated from 1 up to 1,024 GPUs.
  • Strong Scaling (24 Qubits): Across world sizes ranging from 1 to 1,024 GPUs on a fixed 24-qubit circuit, per-step walltime dropped following a consistent power-law trend. Communication overhead from NCCL all-to-all collectives did not bottle up walltime gains.
  • Weak Scaling (18 to 28 Qubits): As problem size scaled proportionally with accelerator count (up to 28 qubits across 1,024 GPUs), compute walltime, NCCL communication time, and memory consumption remained predictably bounded according to power-law scaling.

Limitations and Future Work

  • Fundamental State Vector Scaling: Despite multi-node sharding, full state vector simulation remains exponentially bounded ($O(2^q)$ memory and compute), practically capping simulations around ~30–40 qubits.
  • Ansatz Scope: Benchmarks were limited to a proof-of-concept alternating CNOT/rotation ladder; more diverse QML circuit topologies and non-local gate layouts were not profiled.
  • Future Directions: The authors plan to profile peak network bandwidth and GPU memory utilization under heavier production loads, as well as incorporate circuit cutting and knitting techniques to reduce inter-GPU communication bottlenecks.

Summary updated

BibTeX
@inproceedings{knitter2025torchquantumdistributed,
  author = {Oliver Knitter and Jonathan Mei and Masako Yamada and Martin Roetteler},
  title = {{TorchQuantumDistributed}},
  booktitle = {AI4Science @ NeurIPS},
  year = {2025},
  url = {https://openreview.net/forum?id=32gfU5JJBf},
}
Figure