QTrojan: A Circuit Backdoor Against Quantum Neural Networks

Cheng Chu, Lei Jiang, Martin Swany, Fan Chen

Abstract

As Quantum Neural Networks (QNNs) emerge as a viable tool for complex tasks like financial analysis and object recognition, their security becomes a critical concern. This paper introduces QTrojan, a novel circuit-level backdoor attack designed to exploit the unique architecture of Noisy Intermediate-Scale Quantum (NISQ) systems. Unlike traditional Data-Poisoning-based Backdoor Attacks (DPBA) that require modifying training datasets, QTrojan inserts malicious quantum gates directly into the variational quantum circuit. By leveraging hardware configuration files as a trigger mechanism, QTrojan achieves a 100% attack success rate (ASR) while maintaining perfect accuracy on clean data. Compared to DPBA, QTrojan improves clean data accuracy by 21% and increases the attack success rate by 19.9%.

Introduction

In classical machine learning, backdoor attacks typically involve "poisoning" a subset of the training data with a specific trigger. When the model encounters this trigger during inference, it performs a malicious action, such as misclassification. However, transplanting this methodology to the quantum domain faces significant hurdles.

First, the input space of current QNNs is extremely limited (typically 4–16 qubits), making any data-level trigger highly conspicuous. Second, attackers often lack access to the proprietary datasets used by victims. Finally, the limited capacity of shallow NISQ models often results in a "performance trade-off," where the model fails to learn both the legitimate task and the backdoor task simultaneously, leading to a detectable drop in accuracy. QTrojan addresses these challenges by moving the attack from the data level to the circuit level.

The QTrojan Methodology

The "Sandwich" Architecture

QTrojan operates by modifying the quantum circuit architecture rather than the input data. It employs a "sandwich" structure that surrounds the QNN’s legitimate data encoding layer ($S_x$) with two malicious layers:

  1. Pre-encoding layer ($\bar{S}_x$): This layer utilizes RX gates to shift the qubits to a specific "neutral" point on the Bloch sphere.
  2. Post-encoding layer ($\tilde{S}_x$): This layer uses RX and RY gates to effectively "undo" the legitimate encoding and rotate the qubit state into a configuration that represents the attacker's target class.

Stealthy Triggering via Calibration Files

The most innovative aspect of QTrojan is its trigger mechanism. In the NISQ era, quantum hardware is inherently noisy, requiring frequent recalibration. Users typically download hardware configuration files for "pulse error calibration" to ensure model accuracy. QTrojan hides the rotation angles for its malicious gates within these legitimate configuration files.

  • Deactivated State: When the backdoor is not triggered, the gates perform a "null" operation (identity), and the QNN functions normally with zero performance degradation.
  • Activated State: When the malicious configuration file is loaded, it provides the specific angles required to activate the sandwich layers, forcing the QNN to output the target class regardless of the input data.

Experimental Evaluation

The researchers evaluated QTrojan using the MNIST handwritten digit dataset (downsampled to 4x4 pixels via PCA for 16-qubit QNNs) and synthetic sine wave data for Quantum Long Short-Term Memory (QLSTM) models.

Key Results

  • Superior Stealth and Accuracy: QTrojan demonstrated a 21% improvement in clean data accuracy compared to DPBA. Because the backdoor is hardwired rather than learned, it does not compete for model capacity, resulting in zero impact on legitimate task performance.
  • Attack Success Rate: In both 2-class and 4-class MNIST classification tasks, QTrojan achieved a 100% Attack Success Rate (ASR) upon activation, a 19.9% improvement over the baseline DPBA.
  • Zero Timing Overhead: Pulse-level analysis confirmed that the backdoored circuit maintains the exact same execution duration as a clean circuit. This makes the attack invisible to timing-based detection methods.
  • Persistence: Because the attack is embedded in the circuit architecture and the compiler stage, it remains effective even if the user attempts to retrain the model using their own clean data.

Discussion and Security Implications

QTrojan exposes a significant vulnerability in the quantum computing supply chain. As users increasingly rely on third-party circuit designs, cloud-based quantum services, and automated compiler tools, the opportunities for inserting malicious "Trojans" multiply.

While the attack currently assumes the attacker can influence the circuit architecture or configuration files, it highlights the need for robust quantum security protocols. Future research must focus on adapting classical hardware Trojan detection methods for the quantum realm and developing defenses that can verify the integrity of quantum calibration data and circuit architectures.

Summary updated

Abstract

We propose a circuit-level backdoor attack, \textit{QTrojan}, against Quantum Neural Networks (QNNs) in this paper. QTrojan is implemented by few quantum gates inserted into the variational quantum circuit of the victim QNN. QTrojan is much stealthier than a prior Data-Poisoning-based Backdoor Attack (DPBA), since it does not embed any trigger in the inputs of the victim QNN or require the access to original training datasets. Compared to a DPBA, QTrojan improves the clean data accuracy by 21\% and the attack success rate by 19.9\%.
BibTeX
@inproceedings{chu2023qtrojan,
  author = {Cheng Chu and Lei Jiang and Martin Swany and Fan Chen},
  title = {{QTrojan: A Circuit Backdoor Against Quantum Neural Networks}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2023},
  url = {https://openreview.net/forum?id=Yf2EBifxyQ},
}
Figure