Optyx: A ZX-based Python library for networked quantum architectures
Distributed, large-scale quantum computing will need architectures that combine matter-based qubits with photonic links, but today’s software stacks target either gate-based chips or linear-optical devices in isolation. We introduce Optyx, an open-source Python framework offering a unified language to program, simulate, and prototype hybrid, networked systems: users create experiments that mix qubit registers, discrete-variable photonic modes, lossy channels, heralded measurements, and real-time feedback; Optyx compiles them via ZX/ZW calculus into optimised tensor-network forms, and executes with state-of-the-art contraction schedulers based on Quimb and Cotengra. Benchmarking on exact multi-photon circuit simulations shows that, versus permanent-based methods, tensor network contraction can deliver speedups of orders of magnitude for low-depth circuits and entangled photon sources, and natively supports loss and distinguishability – establishing it as both a high-performance simulator and a rapid-prototyping environment for next-generation photonic-network experiments.
💡 Research Summary
The paper introduces Optyx, an open‑source Python framework designed to bridge the gap between gate‑based quantum processors and linear‑optical photonic simulators, enabling the programming, simulation, and prototyping of hybrid, networked quantum architectures. Existing software stacks such as Qiskit, Cirq, and tket excel at describing single‑register, unitary gate sequences but lack native support for discrete‑variable photonic modes, lossy channels, and real‑time classical‑quantum feedback. Conversely, photonic‑focused tools (Strawberry Fields, The Walrus, Perceval, SOQCS, etc.) are limited to purely optical circuits and cannot directly incorporate matter qubits or adaptive control. Optyx resolves this by adopting ZX/ZW string‑diagram calculus as its core language, providing a compositional, type‑safe representation where quantum (qubit, qmode) and classical (bit, mode) wires can be freely interleaved.
Key technical contributions include:
-
Diagrammatic Front‑End – Users construct circuits as typed objects (boxes) that represent CPTP maps. Sequential composition (
@) and parallel composition (>>) mirror the categorical structure of string diagrams; a functional syntax further simplifies wiring by allowing named wires and automatic insertion of swaps. The library supplies primitives for qubits (ZX‑spiders, H, X, Z), photonic modes (linear‑optical interferometers, dual‑rail encodings, photon sources, detectors), and classical logic (boolean gates, arithmetic on photon‑number modes, control boxes, post‑selection). -
Hybrid Quantum‑Classical Channels – Generators such as
Measure,Encode, andDiscardenable seamless conversion between quantum and classical data, making it straightforward to model measurement‑based quantum computing, fusion‑based protocols, or error‑correcting feedback loops. -
Compilation to Tensor Networks – Each generator is translated into a tensor; wires become tensor indices, and diagram composition becomes index contraction. ZX‑spiders map to 2‑dimensional tensors (qubits) while ZW‑spiders handle infinite‑dimensional Fock spaces efficiently. The resulting tensor network is handed to Cotengra, which searches for a contraction order that minimizes treewidth and intermediate tensor size, and then to Quimb for actual contraction, supporting dense, sparse, CPU, and GPU back‑ends.
-
Loss and Distinguishability Modeling – Photonic loss is expressed as a Kraus channel inserted directly into the diagram; partial distinguishability of photons is captured by parameterised ZW‑spiders. This native handling avoids the exponential blow‑up that permanent‑based simulators suffer when non‑unitary elements are present.
-
Multiple Evaluation Back‑Ends – Optyx ships with three back‑ends: (i) exact tensor‑network contraction via Quimb (default), (ii) permanent‑based evaluation through Perceval for small‑scale linear‑optical circuits, and (iii) a DisCoPy back‑end for symbolic manipulation. Users can switch back‑ends without altering the high‑level diagram, enabling trade‑offs between accuracy and speed.
-
Benchmarking Results – The authors benchmark exact multi‑photon circuit simulations against state‑of‑the‑art permanent algorithms. For low‑depth circuits and entangled photon sources, tensor‑network contraction yields speed‑ups of one to two orders of magnitude, while also supporting loss and distinguishability. Permanent‑based methods remain competitive for very narrow, passive interferometers but become infeasible when active feed‑forward, loss, or hybrid qubit‑photon components are added.
-
Use Cases Demonstrated – (a) Simulation of photonic observables with entangled states, showing accurate probability distributions under realistic loss; (b) Distributed entanglement generation across multiple nodes with real‑time classical feed‑forward, illustrating Optyx’s ability to model network latency and conditional operations; (c) Variational optimization of hybrid circuits, leveraging automatic differentiation through the tensor‑network back‑end for gradient‑based parameter tuning.
-
Software Architecture – The library is organized into four main sub‑modules:
optx.channel(general CPTP maps),optx.qubits(ZX‑calculus gates and noise models),optx.photonic(linear‑optical components, dual‑rail encodings, sources, detectors), andoptx.classical(boolean logic, arithmetic, control flow). External circuit descriptions from tket, Graphix, or other frameworks can be wrapped, preserving interoperability with the broader quantum software ecosystem.
In conclusion, Optyx provides a unified, high‑performance environment for designing, simulating, and prototyping hybrid quantum networks. By leveraging ZX/ZW calculus for symbolic optimisation and state‑of‑the‑art tensor‑network contraction for numerical execution, it overcomes the limitations of both gate‑centric and pure‑photonic simulators. The framework enables researchers to explore large‑scale, distributed quantum architectures that combine matter qubits, discrete‑variable photonic links, loss, and adaptive control—all within a single, Pythonic API. Future work includes extending support to continuous‑variable modes, tighter integration with hardware control stacks, and scaling the contraction engine to handle deeper circuits with higher treewidth through advanced heuristics and parallelisation.
Comments & Academic Discussion
Loading comments...
Leave a Comment