MeaeQ: Mount Model Extraction Attacks with Efficient Queries

Chengwei Dai, Minxuan Lv, Kun Li, Wei ZhouEMNLP 2023

Abstract

Model extraction attacks (MEAs) pose a significant threat to Machine Learning as a Service (MLaaS) by allowing adversaries to replicate proprietary models through API queries. Current MEAs often suffer from high query costs and poor data quality when using public corpora. This paper introduces MeaeQ, a framework that enhances query efficiency through a Task Relevance Filter (TRF) using zero-shot inference and Data Reduction based on Clustering (DRC). Evaluations across multiple NLP benchmarks demonstrate that MeaeQ achieves high-fidelity model extraction with significantly lower query budgets compared to existing methods, even against black-box models like ChatGPT.

Introduction

Machine Learning as a Service (MLaaS) enables users to access powerful, proprietary models via APIs. However, this accessibility introduces the risk of Model Extraction Attacks (MEAs), where an attacker queries the API to collect input-output pairs and trains a local "thief model" to mimic the victim's functionality. The primary obstacles for such attacks are the financial cost of API queries, anti-bot defenses, and the lack of access to the original training data distribution. Randomly sampling from public text often results in irrelevant or redundant queries, leading to inefficient learning for the thief model.

Methodology

MeaeQ (Model extraction attack with efficient Queries) is designed to maximize the information gain of every query through two primary modules:

  1. Task Relevance Filter (TRF): To align the query distribution with the victim's task domain, MeaeQ utilizes a pre-trained zero-shot sequence inference model (BART trained on MNLI). By providing a simple prompt describing the task (e.g., "This is a movie review"), the TRF scans a public corpus like WikiText-103 and retains only sentences that logically entail the prompt.
  2. Data Reduction based on Clustering (DRC): To eliminate redundancy, filtered sentences are embedded into a vector space and clustered using K-means. MeaeQ selects only the sentences closest to cluster centroids, ensuring the final query set is diverse and representative of the entire task space.
The MeaeQ framework overview, illustrating the Task Relevance Filter and Data Reduction based on Clustering.

Experimental Setup

The framework was evaluated against victim models trained on four major benchmarks: Hate Speech (abusive language), AG News (topic classification), and SST-2/IMDB (sentiment analysis). WikiText-103 served as the unlabeled source for queries, ensuring no overlap with the victim's private training data. The study compared MeaeQ against standard baselines, including Random Sampling (RS) and Active Learning (AL) variants.

Key Results and Insights

MeaeQ consistently outperformed all baselines across the evaluated datasets. A critical insight from the research is that distribution alignment is more vital than raw data volume; random Wikipedia sentences often lack the specific linguistic features necessary for specialized tasks like hate speech detection.

Performance comparison of MeaeQ against baselines across four datasets (Hate Speech, SST-2, IMDB, AG News) in terms of Accuracy and Agreement.

Key findings include:

  • Efficiency: MeaeQ achieved higher functional similarity (Agreement) to the victim model with up to 50% fewer queries than the best baseline.
  • Low-Budget Performance: On the Hate Speech task, MeaeQ reached 75.8% agreement with only ~191 queries, whereas random sampling achieved only 45.2%.
  • Black-Box Attacks: The framework successfully attacked gpt-3.5-turbo, extracting a thief model with 79.5% functional similarity using approximately 1,500 queries.
  • Model Agnosticism: The attack remains effective even when the thief model architecture (e.g., BERT) differs from the victim model (e.g., RoBERTa).

Conclusion

MeaeQ demonstrates that high-fidelity model extraction is possible even with extremely limited query budgets by leveraging zero-shot NLI for task alignment and clustering for diversity. While currently focused on classification, this work highlights the vulnerability of MLaaS APIs and underscores the need for more robust defensive mechanisms to protect proprietary AI assets.

Summary updated

BibTeX
@inproceedings{dai2023meaeq,
  author = {Chengwei Dai and Minxuan Lv and Kun Li and Wei Zhou},
  title = {{MeaeQ: Mount Model Extraction Attacks with Efficient Queries}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.781},
}
Figure