QuantumLeak: Stealing Quantum Neural Networks from Cloud-based NISQ Machines

Zhenxiao Fu, Min Yang, Cheng Chu, Yilun Xu, Gang Huang, Fan Chen

Abstract

Variational quantum circuits (VQCs) have become a powerful tool for implementing Quantum Neural Networks (QNNs), addressing a wide range of complex problems. Well-trained VQCs serve as valuable intellectual assets hosted on cloud-based Noisy Intermediate Scale Quantum (NISQ) computers, making them susceptible to malicious VQC stealing attacks. However, traditional model extraction techniques designed for classical machine learning models encounter challenges when applied to NISQ computers due to significant noise in current devices. In this paper, we introduce QuantumLeak, an effective and accurate QNN model extraction technique from cloud-based NISQ machines. Compared to existing classical model stealing techniques, QuantumLeak improves local VQC accuracy by 4.99% to 7.35% across diverse datasets and VQC architectures.

Introduction

In the emerging "Quantum-as-a-Service" (QNaaS) model, companies host trained Quantum Neural Networks (QNNs) on cloud-based quantum computers. These models represent significant intellectual property, requiring substantial domain expertise and computational resources to develop. While model extraction attacks—where an adversary queries a black-box model to build a local clone—are well-documented in classical machine learning, they face unique hurdles in the quantum realm.

The primary challenge is quantum noise. Current Noisy Intermediate-Scale Quantum (NISQ) devices suffer from gate errors, measurement errors (SPAM), and qubit crosstalk. When an attacker queries a cloud-based QNN, the returned labels are often corrupted by this noise. Classical stealing methods, such as CloudLeak, assume relatively clean data; when applied to NISQ outputs, their accuracy plummets because they inadvertently "learn the noise" rather than the underlying model logic. QuantumLeak is the first framework specifically designed to overcome these hardware-level obstacles to achieve high-fidelity model extraction.

Methodology

QuantumLeak utilizes a three-phase framework to build a robust local substitute for a victim QNN, specifically designed to mitigate the impact of quantum hardware errors.

The QuantumLeak framework overview, illustrating the three phases: cloud querying, local training with bagging and Huber loss, and decision fusion via voting.
  1. Victim Query and Data Bagging: The attacker sends unlabeled data to the cloud-hosted victim model. To handle the resulting noisy labels, QuantumLeak employs Bagging (Bootstrap Aggregating), creating multiple sub-datasets by sampling the queried data with replacement.
  2. Robust Substitute Training: A local "committee" of QNNs is trained on these sub-datasets. A critical innovation is the use of a generalized Huber loss instead of standard Negative Log-Likelihood (NLL). Huber loss is less sensitive to outliers (noisy labels) because it behaves quadratically for small errors but linearly for large ones, preventing erroneous quantum outputs from disproportionately skewing the model weights.
  3. Decision Fusion: The final prediction is generated through majority voting across the ensemble of local QNNs. This approach effectively averages out the variance introduced by stochastic quantum noise.

Experimental Setup

The framework was evaluated using standard benchmarks adapted for the constraints of 4-qubit NISQ hardware:

  • MNIST: Binary classification of handwritten digits (0 vs. 1 and 2 vs. 3).
  • Fashion-MNIST: Binary classification of clothing items (t-shirt vs. trouser and pullover vs. dress).
  • Preprocessing: Images were downsampled to $1 \times 8$ dimensions using Principal Component Analysis (PCA) and average pooling to fit current qubit limitations.

Results and Key Insights

QuantumLeak demonstrates significant resilience against quantum noise compared to existing methodologies. Across all tested datasets, it outperformed the state-of-the-art classical attack (CloudLeak) by 4.99% to 7.35% in accuracy.

Accuracy comparison of QuantumLeak against classical stealing techniques (CloudLeak) and baseline models across MNIST and Fashion-MNIST datasets.

Performance Parity

On the MNIST 0/1 task, the original victim model on IBM hardware achieved an accuracy of 86.18%. QuantumLeak’s stolen local version achieved 86.75%, essentially matching the victim's performance. This suggests that the ensemble approach can occasionally exceed the performance of a single noisy victim by filtering out hardware-specific errors.

The Role of Huber Loss and Ensembles

The transition from NLL to Huber loss was pivotal. In noisy quantum environments, some queries return completely incorrect labels due to decoherence. Huber loss treats these as outliers, allowing the local model to converge on the victim's true logic. Furthermore, moving from a single substitute model to an ensemble (specifically 5 to 7 members) provided the most significant performance gains.

Architecture Transferability and Overfitting

The research found that an attacker does not need to know the exact circuit architecture (ansatz) of the victim; a standard local Variational Quantum Circuit (VQC) is often sufficient. However, the study also identified an "overfitting trap": for simpler circuits, increasing the query budget excessively can decrease accuracy as the local model begins to mimic the specific noise patterns of the hardware rather than the intended function.

Conclusion and Future Work

QuantumLeak proves that hardware-level noise is not a sufficient defense for cloud-based QNNs. Strategic algorithmic choices, such as robust loss functions and ensemble learning, can effectively bypass these "leaky" shields. As quantum hardware scales, future work will need to address more complex architectures and higher-dimensional data encoding. For QNN owners, these findings highlight the urgent need for active defenses, such as quantum watermarking, to protect valuable quantum intellectual property.

Summary updated

Abstract

Variational quantum circuits (VQCs) have become a powerful tool for implementing Quantum Neural Networks (QNNs), addressing a wide range of complex problems. Well-trained VQCs serve as valuable intellectual assets hosted on cloud-based Noisy Intermediate Scale Quantum (NISQ) computers, making them susceptible to malicious VQC stealing attacks. However, traditional model extraction techniques designed for classical machine learning models encounter challenges when applied to NISQ computers due to significant noise in current devices. In this paper, we introduce QuantumLeak, an effective and accurate QNN model extraction technique from cloud-based NISQ machines. Compared to existing classical model stealing techniques, QuantumLeak improves local VQC accuracy by 4.99\%$\sim$7.35\% across diverse datasets and VQC architectures.
BibTeX
@inproceedings{fu2024quantumleak,
  author = {Zhenxiao Fu and Min Yang and Cheng Chu and Yilun Xu and Gang Huang and Fan Chen},
  title = {{QuantumLeak: Stealing Quantum Neural Networks from Cloud-based NISQ Machines}},
  booktitle = {IJCNN},
  year = {2024},
  url = {https://openreview.net/forum?id=gTbnLxrCcV},
}
Figure