Table of Contents
Fetching ...

LogosQ: A High-Performance and Type-Safe Quantum Computing Library in Rust

Shiwen An, Jiayi Wang, Konstantinos Slavakis

TL;DR

LogosQ tackles the challenge of building reliable, high-performance quantum simulation software by delivering a Rust-based library with compile-time type safety for variational gradient computations, combined with backends optimized for both small and large systems. It introduces direct state-vector gate operations, an FFT-optimized QFT, and an adaptive backend that switches to MPS representations to manage entanglement growth, enabling scalable simulations up to 24–25 qubits. Across molecular hydrogen VQE and XYZ Heisenberg benchmarks, LogosQ demonstrates chemical accuracy, substantial speedups over Python and Julia frameworks, and competitive performance with Q#. The work argues that the combination of static verification, circuit rebuilding for PSR, and tensor-network backends yields stronger correctness guarantees and superior scalability for variational quantum algorithms and many-body simulations.

Abstract

Developing robust and high performance quantum software is challenging due to the dynamic nature of existing Python-based frameworks, which often suffer from runtime errors and scalability bottlenecks. In this work, we present LogosQ, a high performance backend agnostic quantum computing library implemented in Rust that enforces correctness through compile time type safety. Unlike existing tools, LogosQ leverages Rust static analysis to eliminate entire classes of runtime errors, particularly in parameter-shift rule gradient computations for variational algorithms. We introduce novel optimization techniques, including direct state-vector manipulation, adaptive parallel processing, and an FFT optimized Quantum Fourier Transform, which collectively deliver speedups of up to 900 times for state preparation (QFT) and 2 to 5 times for variational workloads over Python frameworks (PennyLane, Qiskit), 6 to 22 times over Julia implementations (Yao), and competitive performance with Q sharp. Beyond performance, we validate numerical stability through variational quantum eigensolver (VQE) experiments on molecular hydrogen and XYZ Heisenberg models, achieving chemical accuracy even in edge cases where other libraries fail. By combining the safety of systems programming with advanced circuit optimization, LogosQ establishes a new standard for reliable and efficient quantum simulation.

LogosQ: A High-Performance and Type-Safe Quantum Computing Library in Rust

TL;DR

LogosQ tackles the challenge of building reliable, high-performance quantum simulation software by delivering a Rust-based library with compile-time type safety for variational gradient computations, combined with backends optimized for both small and large systems. It introduces direct state-vector gate operations, an FFT-optimized QFT, and an adaptive backend that switches to MPS representations to manage entanglement growth, enabling scalable simulations up to 24–25 qubits. Across molecular hydrogen VQE and XYZ Heisenberg benchmarks, LogosQ demonstrates chemical accuracy, substantial speedups over Python and Julia frameworks, and competitive performance with Q#. The work argues that the combination of static verification, circuit rebuilding for PSR, and tensor-network backends yields stronger correctness guarantees and superior scalability for variational quantum algorithms and many-body simulations.

Abstract

Developing robust and high performance quantum software is challenging due to the dynamic nature of existing Python-based frameworks, which often suffer from runtime errors and scalability bottlenecks. In this work, we present LogosQ, a high performance backend agnostic quantum computing library implemented in Rust that enforces correctness through compile time type safety. Unlike existing tools, LogosQ leverages Rust static analysis to eliminate entire classes of runtime errors, particularly in parameter-shift rule gradient computations for variational algorithms. We introduce novel optimization techniques, including direct state-vector manipulation, adaptive parallel processing, and an FFT optimized Quantum Fourier Transform, which collectively deliver speedups of up to 900 times for state preparation (QFT) and 2 to 5 times for variational workloads over Python frameworks (PennyLane, Qiskit), 6 to 22 times over Julia implementations (Yao), and competitive performance with Q sharp. Beyond performance, we validate numerical stability through variational quantum eigensolver (VQE) experiments on molecular hydrogen and XYZ Heisenberg models, achieving chemical accuracy even in edge cases where other libraries fail. By combining the safety of systems programming with advanced circuit optimization, LogosQ establishes a new standard for reliable and efficient quantum simulation.
Paper Structure (68 sections, 31 equations, 10 figures, 1 table, 4 algorithms)

This paper contains 68 sections, 31 equations, 10 figures, 1 table, 4 algorithms.

Figures (10)

  • Figure 1: Architecture diagram of LogosQ's core modules and their relationships, illustrating the modular organization of the quantum circuit simulation framework guo_differentiable_2023. The current implementation provides two primary backends: dense state vector and matrix product state. Future extensions will include other types of tensor network representations, such as PEPS (Projected Entangled Pair States) guo_general-purpose_2019 and TTN (Tree Tensor Networks) schollwoeck_density-matrix_2011.
  • Figure 2: Example variational quantum circuit with interleaved parameterized gates ($RX$, $RY$) and non-parameterized gates (CNOT). LogosQ's compile-time type system ensures correct gradient computation for such circuits through static verification of parameter usage.
  • Figure 3: Comprehensive performance evaluation of Quantum Fourier Transform across libraries, including execution time, memory consumption, and speedup analysis. LogosQ (Rust) consistently achieves the lowest execution times across all qubit counts, with performance ranging from approximately 0.72 $\mu$s at 1 qubit to 169 $\mu$s at 24 qubits. The complete speed up comparison with the ratio in linear scale is in the Appendix section.
  • Figure 4: Quantum Fourier Transform circuit for 5 qubits. The benchmark evaluates circuits ranging from 1 to 24 qubits.
  • Figure 5: Comprehensive VQE benchmark results for H$_2$ molecular system. (Top left) Energy error relative to full configuration interaction (FCI). (Top right) Number of optimization iterations to convergence. (Bottom left) Final converged energy values. (Bottom right) Wall-clock runtime comparison across frameworks. LogosQ demonstrates superior numerical stability and computational efficiency.
  • ...and 5 more figures