Quantum Computing (QC) promises computational speedup over classic computing for solving complex problems. However, noise exists in current and near-term quantum computers. Quantum software testing (for gaining confidence in quantum software's correctness) is inevitably impacted by noise, to the extent that it is impossible to know if a test case failed due to noise or real faults. Existing testing techniques test quantum programs without considering noise, i.e., by executing tests on ideal quantum computer simulators. Consequently, they are not directly applicable to testing quantum software on real quantum computers or noisy simulators. To this end, we propose a noise-aware approach (named QOIN) to alleviate the noise effect on test results of quantum programs. QOIN employs machine learning techniques (e.g., transfer learning) to learn the noise effect of a quantum computer and filter it from a quantum program's outputs. Such filtered outputs are then used as the input to perform test case assessments (determining the passing or failing of a test case execution against a test oracle). We evaluated QOIN on IBM's 23 noise models, Google's two available noise models, and Rigetti's Quantum Virtual Machine (QVM), with nine real-world quantum programs and 1000 artificial quantum programs. Results show that QOIN can reduce the noise effect by more than $80\%$ on the majority of noise models. For quantum software testing, we used an existing test oracle and showed that QOIN attained scores of $99\%$, $75\%$, and $86\%$ for precision, recall, and F1-score, respectively, for the test oracle across six real-world programs. For artificial programs, QOIN achieved scores of $93\%$, $79\%$, and $86\%$ for precision, recall, and F1-score. This highlights QOIN's effectiveness in learning noise patterns for noise-aware quantum software testing.
翻译:量子计算(QC)有望在解决复杂问题时较经典计算实现计算加速。然而,当前及近期的量子计算机中普遍存在噪声。量子软件测试(旨在验证量子软件正确性)不可避免地受到噪声影响,以至于无法判断测试用例失效是由噪声还是真实故障导致。现有测试技术未考虑噪声因素,即在理想量子计算机模拟器上执行测试,因此无法直接应用于真实量子计算机或含噪模拟器上的量子软件测试。为此,我们提出一种噪声感知方法(命名为QOIN),旨在缓解噪声对量子程序测试结果的影响。QOIN采用机器学习技术(如迁移学习)学习量子计算机的噪声特性,并从量子程序输出中滤除该噪声。过滤后的输出被用于执行测试用例评估(即根据测试预言判断测试用例执行是否通过)。我们在IBM的23种噪声模型、Google的两种可用噪声模型以及Rigetti的量子虚拟机(QVM)上,使用9个真实量子程序和1000个人工量子程序对QOIN进行了评估。结果表明,在大多数噪声模型上,QOIN可将噪声影响降低80%以上。在量子软件测试方面,我们采用现有测试预言,并显示QOIN在六个真实程序上对测试预言的精确率、召回率和F1分数分别达到99%、75%和86%。对于人工程序,QOIN的精确率、召回率和F1分数分别为93%、79%和86%。这突显了QOIN在噪声感知量子软件测试中学习噪声模式的有效性。