Quantum Neural Network (QNN) combines the Deep Learning (DL) principle with the fundamental theory of quantum mechanics to achieve machine learning tasks with quantum acceleration. Recently, QNN systems have been found to manifest robustness issues similar to classical DL systems. There is an urgent need for ways to test their correctness and security. However, QNN systems differ significantly from traditional quantum software and classical DL systems, posing critical challenges for QNN testing. These challenges include the inapplicability of traditional quantum software testing methods, the dependence of quantum test sample generation on perturbation operators, and the absence of effective information in quantum neurons. In this paper, we propose QuanTest, a quantum entanglement-guided adversarial testing framework to uncover potential erroneous behaviors in QNN systems. We design a quantum entanglement adequacy criterion to quantify the entanglement acquired by the input quantum states from the QNN system, along with two similarity metrics to measure the proximity of generated quantum adversarial examples to the original inputs. Subsequently, QuanTest formulates the problem of generating test inputs that maximize the quantum entanglement sufficiency and capture incorrect behaviors of the QNN system as a joint optimization problem and solves it in a gradient-based manner to generate quantum adversarial examples. Experimental results demonstrate that QuanTest possesses the capability to capture erroneous behaviors in QNN systems (generating 67.48%-96.05% more test samples than the random noise under the same perturbation size constraints). The entanglement-guided approach proves effective in adversarial testing, generating more adversarial examples (maximum increase reached 21.32%).
翻译:量子神经网络(QNN)融合了深度学习原理与量子力学基础理论,以实现具有量子加速能力的机器学习任务。近期研究表明,QNN系统与经典深度学习系统类似,同样存在鲁棒性问题,亟需测试其正确性与安全性的方法。然而,QNN系统与传统量子软件及经典深度学习系统存在显著差异,给QNN测试带来了关键挑战,包括传统量子软件测试方法的不适用性、量子测试样本生成对扰动算子的依赖性,以及量子神经元中有效信息的缺失。本文提出QuanTest——一种基于量子纠缠引导的对抗性测试框架,用于揭示QNN系统中的潜在错误行为。我们设计了量子纠缠充分性准则,用于量化输入量子态从QNN系统中获取的纠缠程度,同时构建两种相似性度量指标,以评估生成的量子对抗样本与原始输入之间的接近程度。在此基础上,QuanTest将生成既能最大化量子纠缠充分性又能捕获QNN系统错误行为的测试输入问题形式化为联合优化问题,并通过梯度方法求解以生成量子对抗样本。实验结果表明,QuanTest具备捕获QNN系统错误行为的能力(在相同扰动大小约束下,生成的测试样本比随机噪声增加67.48%-96.05%)。纠缠引导方法在对抗测试中展现出有效性,生成的对抗样本数量最多提升21.32%。