LogosQ: A High-Performance and Type-Safe Quantum Computing Library in Rust
SHIWEN AN 1, JIAYI WANG 2, KONSTANTINOS SLAVAKIS 1 · 2025
Read LogosQ: A High-Performance and Type-Safe Quantum Computing Library in Rust by SHIWEN AN 1, JIAYI WANG 2, KONSTANTINOS SLAVAKIS 1 (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2512-23183.txt.
Introduction
Shiwen An, Jiayi Wang, and Konstantinos Slavakis built LogosQ, a quantum computing library written in the Rust language. Most quantum software lives in Python frameworks, whose dynamic nature invites runtime errors and scaling bottlenecks. LogosQ instead leans on Rust's compile-time type checking to rule out classes of mistakes before a program runs, and it stays independent of any hardware backend.
The engineering pays off in speed. Direct state-vector manipulation, adaptive parallel processing, and an FFT-optimized quantum Fourier transform deliver reported speedups. State preparation runs up to nine hundred times faster than in Python frameworks. Gains over Julia tools are smaller but real, and performance against Q# is competitive. A special target is the parameter-shift gradient computations used by variational algorithms, where type safety removes silent errors. Variational eigensolver tests on molecular hydrogen and Heisenberg models reached chemical accuracy, including edge cases other libraries failed.
Catalog record
| CREATOR | SHIWEN AN 1, JIAYI WANG 2, KONSTANTINOS SLAVAKIS 1 |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 83 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2512-23183
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
LogosQ: A High-Performance and Type-Safe Quantum Computing Library in Rust SHIWEN AN 1, JIAYI WANG 2, KONSTANTINOS SLAVAKIS 1 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’s 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–5 × \times for variational workloads over Python frameworks (PennyLane, Qiskit), 6–22 × \times over Julia implementations (Yao.jl), and competitive performance with Q#. 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. † † history: Date of publication xxxx 00, 0000, date of current version xxxx 00, 0000. † † doi: 10.1109/TQE.2020.DOI † † address: School of Engineering, Institute of Science Tokyo, Yokohama, Kanagawa, 226-8502 Japan † † address: School of Computer Science, Georgia Institute of Technology, Atlanta, GA, 30332 USA † † titlenote: This work is supported by Super Smart Society (SSS) Project of the Ministry of Education, Culture, Sports, Science and Technology (MEXT), Japan and Spring Fellowship at Institute of Science Tokyo. † † corresponding: Corresponding author: Shiwen An, email: [email protected] I Introduction Quantum software has become the foundation of the quantum computing ecosystem, providing essential tools and libraries for developing, simulating, and executing quantum algorithms on various quantum hardware platforms. The field encompasses diverse frameworks tailored to different needs: Python-based libraries such as PennyLane [ 3 ] , which enables seamless integration of quantum circuits with classical machine learning models for variational algorithms [ 4 ] ; Qiskit [ 18 ] , providing comprehensive tools for quantum circuit design and execution on IBM’s quantum processors; and Cirq [ 6 ] , focusing on near-term quantum devices [ 36 ] with frameworks tailored to Google’s hardware. Julia-based frameworks include Yao.jl [ 25 ] , emphasizing parallel computing and CUDA optimization. Lower-level tools include Quantum++ [ 12 ] , a C++11 library focusing on performance and portability, and OpenQASM [ 10 ] , a standardized assembly language promoting interoperability across quantum platforms. For variational quantum algorithms, matrix product state (MPS) based simulators have emerged as a scalable alternative to state-vector methods, enabling simulation of larger quantum chemistry systems through tensor network representations [ 13 ] . Recent advances in differentiable programming with tensor networks [ 24 ] have enabled automatic differentiation of quantum circuits and tensor network algorithms, providing efficient gradient computation for variational optimization. Additionally, automatically differentiable quantum circuits have been developed for many-qubit state preparation using MPS representations [ 54 ] . Recent research has addressed practical challenges through scalable benchmarks [ 16 ] , mutation testing of quantum programs [ 11 ] , and real-world applications such as hash function pre-image attacks [ 37 ] . Ongoing efforts in large-scale quantum simulators [ 17 ] and parameterized quantum circuit generators [ 27 ] continue to expand the field’s capabilities. The emergence of Rust has catalyzed new quantum simulation tools, with Spinoza [ 53 ] demonstrating Rust’s potential for high-performance state-vector simulation through optimized amplitude pair manipulation. However, Spinoza focuses primarily on fast gate-level state vector simulation and does not address the broader needs of variational quantum algorithms, including parameterized circuit management, gradient computation, and scalable tensor network backends. Despite these advances, existing quantum software libraries face persistent challenges in extensibility, performance, and correctness—particularly silent runtime errors in gradient computations for variational algorithms. I-A Contributions To address these challenges, we present LogosQ, an extensible circuit-oriented quantum computing library implemented in Rust, a systems programming language known for its speed, memory efficiency, and thread safety [ 30 ] . Unlike Spinoza, which is primarily a state vector simulator, LogosQ is a comprehensive quantum computing library that prioritizes compile-time type safety for variational algorithms while combining performance, safety, and ease of use. The key differentiators from existing Rust-based simulators like Spinoza include: • Rust-based quantum computing library with compile-time type safety for parameter-shift rule gradient computation in variational algorithms. • Performance optimizations: direct state vector manipulation, parallel controlled-phase gates, and FFT-optimized Quantum Fourier Transform, and adaptive backend selection for state vector and Matrix Product State (MPS) [ 49 ] . • Benchmarks demonstrating over 100x speedups over Python libraries (PennyLane, Qiskit) and 6–22x over Julia implementations (Yao.jl, Q# [ 47 ] ). The library provides a quantum circuit data structure that can be easily manipulated and transformed, along with basic quantum gates, operations, and algorithms. LogosQ’s modular design facilitates the integration of diverse simulation backends or future hardware platforms for modeling physical processes and quantum optimization [ 49 ] . I-B Experimental Setup All benchmarks presented in this paper were executed on a system with the following specifications: Intel Core i9-10980XE CPU (18 cores, 36 threads) @ 3.00 GHz base frequency (up to 4.8 GHz boost), 125 GB RAM, running Linux. This hardware configuration provides sufficient computational resources for fair comparison across all tested frameworks and enables evaluation of larger quantum systems using the MPS backend. All benchmark code, including implementations for LogosQ, PennyLane, Qiskit, Yao.jl, and Q#, is publicly available 1 1 1 https://github.com/zazabap/LogosQBenchmarks to ensure reproducibility. The library is open-source and publicly available 2 2 2 https://github.com/zazabap/LogosQ . I-C Paper Organization The remainder of this paper is organized as follows. Section II presents the overall architecture and design principles of LogosQ. Section III describes the compile-time type safety features for parameter-shift rule gradient computation. Section IV details the optimization techniques following by performance benchmarks. Finally, Section VIII concludes the paper and discusses future directions. II System Architecture The library is implemented in Rust, leveraging the language’s type system and memory safety guarantees [ 30 ] to provide compile-time verification of quantum circuit correctness. The library is organized into several core modules, each responsible for distinct aspects of quantum circuit simulation and optimization. The library structure follows Rust’s module system [ 30 ] , with clear separation of concerns, similar to other quantum software frameworks [ 45 , 18 ] : Fig. 1: Architecture diagram of LogosQ’s core modules and their relationships, illustrating the modular organization of the quantum circuit simulation framework [ 13 ] . The current implementation provides two primary backends: dense state vector and matrix product state. The choice of the backend is determined at runtime based on the quantum system size and the desired accuracy. Future extensions will include other types of tensor network representations, such as PEPS (Projected Entangled Pair States) [ 14 ] and TTN (Tree Tensor Networks) [ 39 ] . • Circuit Module : Implements the Circuit data structure and gate operations. The circuit is represented as a vector of gate operations,