SAME: Sample Reconstruction against Model Extraction Attacks

Yi Xie, Jie Zhang, Shiqian Zhao, Tianwei Zhang, Xiaofeng Chen

Introduction

Model Extraction Attacks (MEA) pose a significant threat to Machine Learning as a Service (MLaaS) providers. By querying a victim model's API and recording its outputs, adversaries can reconstruct a functional clone of the proprietary model. Existing defenses often rely on Out-of-Distribution (OOD) classifiers, which suffer from over-confidence on unseen data, or require unrealistic assumptions like access to auxiliary outlier datasets. Furthermore, defenses tracking query history are easily bypassed by distributed attacks.

This paper introduces SAME (Sample Reconstruction against Model Extraction), a novel defense mechanism that detects malicious queries by reconstructing them using a Masked Autoencoder (MAE) and analyzing their behavior against an auxiliary model.

Methodology: The SAME Pipeline

SAME shifts the defense paradigm from classification to sample reconstruction. The pipeline consists of three primary stages:

  1. Sample Reconstruction via Masked Autoencoder (MAE): Incoming queries are processed by an MAE trained exclusively on the victim model's legitimate training data. Because the MAE is optimized for "normal" data, malicious OOD queries—common in sampling or synthetic attacks—result in significantly higher reconstruction loss.
  2. Attack Repair via Auxiliary Model: Perturbation-based attacks (e.g., JBDA) use normal data with subtle adversarial tweaks that might bypass the MAE. To counter this, SAME employs an Auxiliary Model—a clone of the victim model trained on reconstructed normal data. For perturbed samples, the predictions of the original victim model and the Auxiliary Model diverge sharply, exposing the attack.
  3. Anomaly Score Calculation: A final anomaly score is derived by combining the MAE's reconstruction loss and the prediction deviation between the victim and auxiliary models.

Key Insights

Reconstruction vs. Classification

A core finding is that reconstruction loss is a more reliable indicator of malicious intent than classifier confidence. Standard neural networks often exhibit high confidence on OOD data, leading to false negatives. In contrast, an MAE naturally fails to accurately reconstruct data outside its training distribution.

Comparison of density distributions for classifier confidence versus sample reconstruction loss.

Closing the Perturbation Loophole

While reconstruction loss effectively identifies synthetic or proxy-dataset queries, it can be less effective against adversarial perturbations. By training an auxiliary model on reconstructed data, the defender creates a "trap": the auxiliary model learns a slightly different decision boundary. Adversarial samples optimized for the victim model fail to generalize to this auxiliary model, resulting in high prediction disagreement.

Effectiveness of the Auxiliary Model (AM) in separating perturbation-based attacks (JBDA) from normal queries.

Evaluation and Results

The authors evaluated SAME against attacks like KnockoffNets, JBDA, and DFME using MNIST and CIFAR-10 datasets.

  • Detection Performance: On CIFAR-10, SAME achieved an AUROC of 84.03% against Knockoff attacks, significantly outperforming baselines like Outlier Exposure (77.38%). Against synthetic DFME attacks, SAME reached near-perfect detection (up to 100% AUROC).
  • Operational Efficiency: SAME is a "zero-interference" defense. Unlike methods that require adversarial retraining, SAME does not degrade the victim model's accuracy. Additionally, training the SAME pipeline is remarkably fast, requiring only 170 seconds compared to over 1,500 seconds for baseline methods.

Conclusion

SAME provides a robust, efficient, and plug-and-play defense against model extraction. By leveraging the inherent limitations of autoencoders on OOD data and the sensitivity of adversarial samples to model variations, SAME achieves state-of-the-art detection without the need for auxiliary outlier data or query history tracking. Future work will focus on optimizing embedding sizes and extending the defense to non-CNN architectures.

Summary updated

BibTeX
@inproceedings{xie2024same,
  author = {Yi Xie and Jie Zhang and Shiqian Zhao and Tianwei Zhang and Xiaofeng Chen},
  title = {{SAME: Sample Reconstruction against Model Extraction Attacks}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i18.29974},
}
Figure