🤖 AI Summary
This work addresses the long-standing oracle problem in quantum software stack (QSS) testing—the lack of reliable reference outputs for expected behavior—by introducing QEMI, the first testing methodology to adapt Equivalence Modulo Inputs (EMI), a technique from classical compiler testing, to the quantum domain. QEMI generates random quantum programs containing dead code and constructs semantically equivalent variants, then detects QSS bugs by comparing their execution outcomes across different platforms. Unlike conventional approaches that rely on syntactic or structural transformations, QEMI enables semantic-preserving program mutation and analysis. Empirical evaluation on Qiskit, Q#, and Cirq uncovered 11 crash-inducing bugs and one behavioral inconsistency, substantially enhancing the effectiveness of quantum software stack testing.
📝 Abstract
As quantum algorithms and hardware continue to evolve, ensuring the correctness of the quantum software stack (QSS) has become increasingly important. However, testing QSSes remains challenging due to the oracle problem, i.e., the lack of a reliable ground truth for expected program behavior. Existing metamorphic testing approaches often rely on equivalent circuit transformations, backend modifications, or parameter tuning to address this issue. In this work, inspired by Equivalence Modulo Inputs (EMI), we propose Quantum EMI (QEMI), a new testing approach for QSSes. Our key contributions include: (1) a random quantum program generator that produces code with dead code based on quantum control-flow structures, and (2) an adaptation of the EMI technique from classical compiler testing to generate variants by removing dead code. By comparing the behavior of these variants, we can detect potential bugs in QSS implementations. We applied QEMI to Qiskit, Q#, and Cirq, and successfully identified 11 crash bugs and 1 behavioral inconsistency. QEMI expands the limited set of testing techniques available for quantum software stacks by going beyond structural transformations and incorporating semantics-preserving ones into quantum program analysis.