Stealing Part of a Production Language Model
Authors: Nicholas Carlini, Daniel Paleka, Krishnamurthy Dj Dvijotham, Thomas Steinke, Jonathan Hayase, A. Feder Cooper, Katherine Lee, Matthew Jagielski, Milad Nasr, Arthur Conmy, Eric Wallace, David Rolnick, Florian Tramèr
Abstract
We introduce the first model-stealing attack that extracts precise, nontrivial information from black-box production language models like OpenAI's ChatGPT or Google's PaLM-2. Specifically, our attack recovers the embedding projection layer (up to symmetries) of a transformer model, given typical API access. For under \$20 USD, our attack extracts the entire projection matrix of OpenAI's Ada and Babbage language models. We thereby confirm, for the first time, that these black-box models have a hidden dimension of 1024 and 2048, respectively. We also recover the exact hidden dimension size of the gpt-3.5-turbo model, and estimate it would cost under \$2,000 in queries to recover the entire projection matrix. We conclude with potential defenses and mitigations, and discuss the implications of possible future work that could extend our attack.
The papers around it, by date and closeness
Higher is closer to this paper; left is older. Lines join papers close to each other: groups of lines are sub-topics. Select a point to see why it is there. Back to the summary of this paper
Papers around this one
Ranked by how close their title and abstract are to this paper’s. Select some to read them together.
Closest papers
-
Model Leeching: An Extraction Attack Targeting LLMsLewis Birch, William Hackett, Stefan Trawicki et al. · 2023 · CAMLIS · cited 38 times · Not summarized yet
Model Leeching distills task-specific capabilities from ChatGPT-3.5-Turbo, whereas this paper recovers a production model’s embedding projection layer.
Abstract
Model Leeching is a novel extraction attack targeting Large Language Models (LLMs), capable of distilling task-specific knowledge from a target LLM into a reduced parameter model. We demonstrate the effectiveness of our attack by extracting task capability from ChatGPT-3.5-Turbo, achieving 73% Exact Match (EM) similarity, and SQuAD EM and F1 accuracy scores of 75% and 87%, respectively for only $50 in API cost. We further demonstrate the feasibility of adversarial attack transferability from an extracted model extracted via Model Leeching to perform ML attack staging against a target LLM, resulting in an 11% increase to attack success rate when applied to ChatGPT-3.5-Turbo.
-
Extracting Training Data from Large Language ModelsNicholas Carlini, Florian Tramer, Eric Wallace et al. · 2020 · Cryptography and Security · cited 3,548 times · AI summary available
Extracting Training Data recovers memorized training examples from GPT-2, rather than reconstructing model parameters from API outputs.
Abstract
It has become common to publish large (billion parameter) language models that have been trained on private datasets. This paper demonstrates that in such settings, an adversary can perform a training data extraction attack to recover individual training examples by querying the language model. We demonstrate our attack on GPT-2, a language model trained on scrapes of the public Internet, and are able to extract hundreds of verbatim text sequences from the model's training data. These extracted examples include (public) personally identifiable information (names, phone numbers, and email addresses), IRC conversations, code, and 128-bit UUIDs. Our attack is possible even though each of the ab…
-
Logits of API-Protected LLMs Leak Proprietary InformationMatthew Finlayson, Xiang Ren, S. Swayamdipta · 2024 · arXiv.org · preprint, not peer reviewed · cited 58 times · Not summarized yet
Logits of API-Protected LLMs infers proprietary information from API logits, including information about the architecture and parameters of production language models.
Abstract
Large language model (LLM) providers often hide the architectural details and parameters of their proprietary models by restricting public access to a limited API. In this work we show that, with only a conservative assumption about the model architecture, it is possible to learn a surprisingly large amount of non-public information about an API-protected LLM from a relatively small number of API queries (e.g., costing under $1000 USD for OpenAI's gpt-3.5-turbo). Our findings are centered on one key observation: most modern LLMs suffer from a softmax bottleneck, which restricts the model outputs to a linear subspace of the full output space. We exploit this fact to unlock several capabilitie…
-
Scalable Extraction of Training Data from (Production) Language ModelsMilad Nasr, Nicholas Carlini, Jonathan Hayase et al. · 2023 · Machine Learning · preprint, not peer reviewed · cited 642 times · AI summary available
Scalable Extraction recovers memorized training data from production language models, while this paper extracts an architectural component.
Abstract
This paper studies extractable memorization: training data that an adversary can efficiently extract by querying a machine learning model without prior knowledge of the training dataset. We show an adversary can extract gigabytes of training data from open-source language models like Pythia or GPT-Neo, semi-open models like LLaMA or Falcon, and closed models like ChatGPT. Existing techniques from the literature suffice to attack unaligned models; in order to attack the aligned ChatGPT, we develop a new divergence attack that causes the model to diverge from its chatbot-style generations and emit training data at a rate 150x higher than when behaving properly. Our methods show practical attac…
-
RatGPT: Turning online LLMs into Proxies for Malware AttacksMika Beckerich, Laura Plein, Sergio Coronado · 2023 · Cryptography and Security · preprint, not peer reviewed · cited 45 times · AI summary available
RatGPT uses ChatGPT as a proxy for malware attacks, rather than extracting the model’s internal parameters.
Abstract
The evolution of Generative AI and the capabilities of the newly released Large Language Models (LLMs) open new opportunities in software engineering. However, they also lead to new challenges in cybersecurity. Recently, researchers have shown the possibilities of using LLMs such as ChatGPT to generate malicious content that can directly be exploited or guide inexperienced hackers to weaponize tools and code. These studies covered scenarios that still require the attacker to be in the middle of the loop. In this study, we leverage openly available plugins and use an LLM as proxy between the attacker and the victim. We deliver a proof-of-concept where ChatGPT is used for the dissemination of …
-
PAL: Proxy-Guided Black-Box Attack on Large Language ModelsChawin Sitawarin, Norman Mu, David A. Wagner et al. · 2024 · arXiv.org · preprint, not peer reviewed · cited 61 times · Not summarized yet
PAL optimizes prompts to elicit harmful LLM outputs, rather than stealing model structure through API queries.
Abstract
Large Language Models (LLMs) have surged in popularity in recent months, but they have demonstrated concerning capabilities to generate harmful content when manipulated. While techniques like safety fine-tuning aim to minimize harmful use, recent works have shown that LLMs remain vulnerable to attacks that elicit toxic responses. In this work, we introduce the Proxy-Guided Attack on LLMs (PAL), the first optimization-based attack on LLMs in a black-box query-only setting. In particular, it relies on a surrogate model to guide the optimization and a sophisticated loss designed for real-world LLM APIs. Our attack achieves 84% attack success rate (ASR) on GPT-3.5-Turbo and 48% on Llama-2-7B, co…
-
Query-Based Adversarial Prompt GenerationJ. Hayase, Ema Borevković, Nicholas Carlini et al. · 2024 · Neural Information Processing Systems · cited 74 times · Not summarized yet
Query-Based Adversarial Prompt Generation uses API queries to elicit harmful strings, not to recover model parameters.
Abstract
Recent work has shown it is possible to construct adversarial examples that cause an aligned language model to emit harmful strings or perform harmful behavior. Existing attacks work either in the white-box setting (with full access to the model weights), or through transferability: the phenomenon that adversarial examples crafted on one model often remain effective on other models. We improve on prior work with a query-based attack that leverages API access to a remote language model to construct adversarial examples that cause the model to emit harmful strings with (much) higher probability than with transfer-only attacks. We validate our attack on GPT-3.5 and OpenAI's safety classifier; w…
-
Can Watermarking Techniques Help Prevent LLM Model Stealing?Elette Boyle, M. Hajiaghayi, Keivan Rezaei et al. · 2026 · arXiv.org · preprint, not peer reviewed · Not summarized yet
Can Watermarking Techniques proposes logit-perturbation defenses against this paper’s attack on production-model layers.
Abstract
Model stealing attacks have recently been introduced, enabling the extraction of precise information from black-box commercial language models. In this work, we propose defense methods against a recent attack of \cite{carlini2024stealing} and extensions for extracting the hidden layer dimension of production language models. Our methods are inspired by watermarking techniques that perturb the logits layer of these models to prevent such attacks. We provide empirical experiments demonstrating the effectiveness of the proposed defense versus model quality degradation across various configurations, and propose an effective defense against such attacks while preserving model utility.
Prior work it builds on
-
PRADA: Protecting Against DNN Model Stealing AttacksMika Juuti, Sebastian Szyller, Samuel Marchal et al. · 2018 · European Symposium on Security and Privacy · cited 561 times · Not summarized yet
PRADA studies model extraction through prediction APIs, providing earlier context for this paper’s black-box model-stealing attack.
Abstract
Machine learning (ML) applications are increasingly prevalent. Protecting the confidentiality of ML models becomes paramount for two reasons: (a) a model can be a business advantage to its owner, and (b) an adversary may use a stolen model to find transferable adversarial examples that can evade classification by the original model. Access to the model can be restricted to be only via well-defined prediction APIs. Nevertheless, prediction APIs still provide enough information to allow an adversary to mount model extraction attacks by sending repeated queries via the prediction API. In this paper, we describe new model extraction attacks using novel approaches for generating synthetic queries…
-
Leaky DNN: Stealing Deep-Learning Model Secret with GPU Context-Switching Side-ChannelJunyin Wei, Yi-Cheng Zhang, Zhe Zhou et al. · 2020 · Dependable Systems and Networks · cited 131 times · Not summarized yet
Leaky DNN infers neural-network structure through GPU context-switching side channels, whereas this paper uses language-model API access.
Abstract
Machine learning has been attracting strong interests in recent years. Numerous companies have invested great efforts and resources to develop customized deep-learning models, which are their key intellectual properties. In this work, we investigate to what extent the secret of deep-learning models can be inferred by attackers. In particular, we focus on the scenario that a model developer and an adversary share the same GPU when training a Deep Neural Network (DNN) model. We exploit the GPU side-channel based on context-switching penalties. This side-channel allows us to extract the fine-grained structural secret of a DNN model, including its layer composition and hyper-parameters. Leveragi…
-
Cryptanalytic Extraction of Neural Network ModelsNicholas Carlini, Matthew Jagielski, Ilya Mironov · 2020 · Annual International Cryptology Conference · cited 182 times · Not summarized yet
Cryptanalytic Extraction steals neural-network parameters through oracle queries, an earlier black-box model-extraction approach.
Abstract
We argue that the machine learning problem of model extraction is actually a cryptanalytic problem in disguise, and should be studied as such. Given oracle access to a neural network, we introduce a differential attack that can efficiently steal the parameters of the remote model up to floating point precision. Our attack relies on the fact that ReLU neural networks are piecewise linear functions, and thus queries at the critical points reveal information about the model parameters. We evaluate our attack on multiple neural network models and extract models that are 2^20 times more precise and require 100x fewer queries than prior work. For example, we extract a 100,000 parameter neural netw…
-
High Accuracy and High Fidelity Extraction of Neural NetworksMatthew Jagielski, Nicholas Carlini, David Berthelot et al. · 2019 · USENIX Security Symposium · cited 515 times · Not summarized yet
High Accuracy and High Fidelity Extraction studies copying remotely deployed models through prediction access, framing objectives relevant to model stealing.
Abstract
In a model extraction attack, an adversary steals a copy of a remotely deployed machine learning model, given oracle prediction access. We taxonomize model extraction attacks around two objectives: *accuracy*, i.e., performing well on the underlying learning task, and *fidelity*, i.e., matching the predictions of the remote victim classifier on any input. To extract a high-accuracy model, we develop a learning-based attack exploiting the victim to supervise the training of an extracted model. Through analytical and empirical arguments, we then explain the inherent limitations that prevent any learning-based strategy from extracting a truly high-fidelity model---i.e., extracting a functionall…
-
Stealing Machine Learning Models via Prediction APIsFlorian Tramèr, Fan Zhang, A. Juels et al. · 2016 · USENIX Security Symposium · cited 2,282 times · Not summarized yet
Stealing Machine Learning Models via Prediction APIs studies black-box model extraction through public query interfaces, the broader setting of this attack.
Abstract
Machine learning (ML) models may be deemed confidential due to their sensitive training data, commercial value, or use in security applications. Increasingly often, confidential ML models are being deployed with publicly accessible query interfaces. ML-as-a-service ("predictive analytics") systems are an example: Some allow users to train models on potentially sensitive data and charge others for access on a pay-per-query basis. The tension between model confidentiality and public access motivates our investigation of model extraction attacks. In such attacks, an adversary with black-box access, but no prior knowledge of an ML model's parameters or training data, aims to duplicate the functi…
Papers that cite it
-
The Geometry of Last-Layer Model StealingSnigdha Chandan Khilar · 2026 · arXiv.org · preprint, not peer reviewed · cited 1 time · Not summarized yet
The Geometry of Last-Layer Model Stealing analyzes what can be recovered from a transformer’s final layer and cites this paper.
Abstract
This paper uses geometry to explain how a machine learning model can be stolen using an already existing well-known method. The author has shown the exact conditions required to perfectly copy the final layer of a transformer network. When looking deeper into the hidden layers the author has explained clear limits. The author has also demonstrated that a hidden network cannot be fully reverse engineered just by looking at the final results. The research clearly maps out what can and cannot be stolen from a model.
-
Clone What You Can't Steal: Black-Box LLM Replication via Logit Leakage and DistillationKanchon Gharami, H. Aluvihare, S. Moni et al. · 2025 · International Conference on Trust, Privacy and Security in Intelligent Systems and Applications · cited 3 times · Not summarized yet
Clone What You Can't Steal combines logit leakage and distillation for black-box LLM replication, building on prior output-projection extraction work.
Abstract
Large Language Models (LLMs) are increasingly deployed in mission-critical systems, facilitating tasks such as satellite operations, command-and-control, military decision support, and cyber defense. Many of these systems are accessed through application programming interfaces (APIs). When such APIs lack robust access controls, they can expose full or top $k$ logits, creating a significant and often overlooked attack surface. Prior art has mainly focused on reconstructing the output projection layer or distilling surface-level behaviors. However, regenerating a black-box model under tight query constraints remains underexplored. We address that gap by introducing a constrained replication pi…
-
Pandora's White-Box: Precise Training Data Detection and Extraction in Large Language ModelsJeffrey G. Wang, Jason Z Wang, Marvin Li et al. · 2024 · cited 12 times · Not summarized yet
Pandora’s White-Box develops training-data privacy attacks on LLMs and cites this paper, but targets data rather than model structure.
Abstract
In this paper we develop state-of-the-art privacy attacks against Large Language Models (LLMs), where an adversary with some access to the model tries to learn something about the underlying training data. Our headline results are new membership inference attacks (MIAs) against pretrained LLMs that perform hundreds of times better than baseline attacks, and a pipeline showing that over 50% (!) of the fine-tuning dataset can be extracted from a fine-tuned LLM in natural settings. We consider varying degrees of access to the underlying model, pretraining and fine-tuning data, and both MIAs and training data extraction. For pretraining data, we propose two new MIAs: a supervised neural network …
-
From Counterfactuals to Trees: Competitive Analysis of Model Extraction AttacksA. Khouna, Julien Ferry, Thibaut Vidal · 2025 · Neural Information Processing Systems · cited 4 times · Not summarized yet
From Counterfactuals to Trees formally analyzes oracle-query costs for model reconstruction and cites this paper.
Abstract
The advent of Machine Learning as a Service (MLaaS) has heightened the trade-off between model explainability and security. In particular, explainability techniques, such as counterfactual explanations, inadvertently increase the risk of model extraction attacks, enabling unauthorized replication of proprietary models. In this paper, we formalize and characterize the risks and inherent complexity of model reconstruction, focusing on the"oracle''queries required for faithfully inferring the underlying prediction function. We present the first formal analysis of model extraction attacks through the lens of competitive analysis, establishing a foundational framework to evaluate their efficiency…
-
Kraken: Higher-order EM Side-Channel Attacks on DNNs in Near and Far FieldPéter Horváth, Ilia Shumailov, Lukasz Chmielewski et al. · 2026 · 2026 IEEE Conference on Secure and Trustworthy Machine Learning (SaTML) · cited 3 times · Not summarized yet
Kraken extracts DNN parameters using physical GPU side channels, a different access route from this paper’s language-model API queries.
Abstract
The multi-million dollar investment required for modern machine learning (ML) has made large ML models a prime target for theft. In response, the field of model stealing has emerged. Attacks based on physical side-channel information have shown that DNN model extraction is feasible, even on CUDA Cores in a GPU. For the first time, our work demonstrates parameter extraction on the specialized GPU’s Tensor Core units, most commonly used GPU units nowadays due to their superior performance, via near-field physical side-channel attacks. Previous work targeted only the general-purpose CUDA Cores in the GPU, the functional units that have been part of the GPU since its inception. Our method is tai…
Go further
How are these papers found?
We compare the title and abstract of this paper with those of every paper summarized on this site, and with the papers Semantic Scholar recommends, those it cites and those citing it (for a much-cited paper, its most recent citations and, from OpenAlex, the most cited ones). Among the prior work and the follow-ups, the papers that use each other in depth, a method it uses and the much-cited follow-ups come a little higher. The levels (very close, close, related) come from the similarity of the texts, not from a judgment of quality; * marks a paper without an abstract, compared by its title. The sentence under a paper is written by an AI from the two abstracts: check it in the papers. A paper marked not relevant by three readers leaves the list.
Updated on 3 November 2026.