Quantum Computing (QC) promises computational speedup over classic computing for solving some 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 QC hardware 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 with nine real-world quantum programs and 1000 artificial quantum programs. We also generated faulty versions of these programs to check if a failing test case execution can be determined under noise. Results show that QOIN can reduce the noise effect by more than $80\%$. To check QOIN's effectiveness for quantum software testing, we used an existing test oracle for quantum software testing. The results showed that the F1-score of the test oracle was improved on average by $82\%$ for six real-world programs and by $75\%$ for 800 artificial programs, demonstrating that QOIN can effectively learn noise patterns and enable noise-aware quantum software testing.
翻译:量子计算(QC)有望在解决复杂问题时超越经典计算的计算速度。然而,当前及近期的量子计算机存在噪声问题。量子软件测试(旨在验证量子软件正确性)不可避免地受到噪声影响,甚至无法判断测试用例失败是由噪声还是真实故障导致。现有测试技术在不考虑噪声的情况下测试量子程序,即通过在理想量子计算机模拟器上执行测试。因此,它们无法直接应用于真实量子计算硬件或噪声模拟器上的量子软件测试。为此,我们提出一种噪声感知方法(命名为QOIN),以减轻噪声对量子程序测试结果的影响。QOIN利用机器学习技术(如迁移学习)学习量子计算机的噪声效应,并将其从量子程序输出中过滤。过滤后的输出用于执行测试用例评估(根据测试预言确定测试用例执行是否通过)。我们在IBM的23种噪声模型上使用九个真实量子程序和1000个人工量子程序评估了QOIN。我们还生成了这些程序的故障版本,以检查在噪声条件下能否判定失效的测试用例执行。结果表明,QOIN可将噪声效应降低80%以上。为验证QOIN在量子软件测试中的有效性,我们使用了现有量子软件测试预言。结果显示,六个真实程序的测试预言F1分数平均提升82%,800个人工程序平均提升75%,证明QOIN能有效学习噪声模式并实现噪声感知的量子软件测试。