Model extraction attack
A model extraction attack copies or reconstructs a machine learning model, or part of it, by sending it many chosen queries and analysing the answers, without access to its weights.
Many models are only available through an online service: you send an input, you get an output, and the model itself stays on the provider's servers. A model extraction attack turns that access into a copy. The attacker chooses inputs, records the outputs, and uses the pairs either to solve for the model's parameters directly or to train a substitute that behaves the same way. NIST's March 2025 taxonomy of adversarial machine learning classes it as a privacy attack and notes that extraction is often a step towards other attacks, because knowing a model's architecture and weights makes it much easier to find inputs that fool it.
The idea was demonstrated in Stealing Machine Learning Models via Prediction APIs by Florian Tramèr and colleagues, presented at USENIX Security in 2016. They extracted logistic regression models, neural networks and decision trees from the online services of BigML and Amazon Machine Learning with near-perfect fidelity. They also showed that simply hiding the confidence scores from the output still left the models open to extraction.
Large language models are harder to copy, but not immune. In March 2024 Nicholas Carlini and colleagues recovered the final embedding projection layer of OpenAI's Ada and Babbage models through ordinary API access for under $20, confirming that their hidden dimensions were 1,024 and 2,048. They also recovered the hidden dimension of gpt-3.5-turbo and estimated that its whole projection layer could be extracted for under $2,000 in queries. That is one layer, not the full model, but it was information the company had not published.
A looser form of the same goal is to train a new model on a large volume of another model's answers. Done with permission this is distillation, a normal way to build smaller models. Done without permission, it can capture much of a rival's capability without the cost of training a model from scratch.
Defences include rate limits, monitoring for query patterns typical of extraction, limiting how much detail each answer reveals, and contractual terms. None stops a determined attacker completely, so the practical question is cost: whether copying a model through its interface is cheaper than building one.
Model stealing is another name for a model extraction attack. The attacker queries a model they can only access through an interface, records its answers and uses them to rebuild the model or a close imitation. The result can then be run without paying the provider or used to plan further attacks. Not completely, as far as published research shows, but parts can be recovered. In 2024 researchers extracted the final layer of two OpenAI models for under $20 and learned a hidden size of gpt-3.5-turbo. Training a copycat model on large numbers of a model's answers can also reproduce much of its behaviour. A trained model can represent years of work and large sums spent on data and computing, so a cheap copy undercuts the business that built it. Extraction also helps attackers: with a copy in hand, they can search for inputs that fool or bypass the original model's safeguards. They limit how many queries an account can make, watch for unusual query patterns, reduce the detail returned in each answer and forbid the practice in their terms of service. Research has shown that hiding details such as confidence scores reduces the risk but does not remove it.Common questions
What is model stealing?
Can someone steal a large language model through its API?
Why does model extraction matter?
How do providers defend against model extraction?
Search for "model extraction attack", "model stealing API", "stealing part of a production language model" or "adversarial machine learning taxonomy" to learn more. Trustworthy sources include the original papers on arXiv and in security conference proceedings such as USENIX Security, and NIST's adversarial machine learning taxonomy. Claims that a particular company copied a rival's model are often disputed, so look for the evidence behind them.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.