Skip to content

Stealing part of a production-grade language model

Stealing Part of a Production Language Model

arXiv· arXiv:2403.06634· Nicholas Carlini, Daniel Paleka, Krishnamurthy Dj Dvijotham, Thomas Steinke, Jonathan Hayase, A. Feder Cooper, Katherine Lee, Matthew Jagielski, Milad Nasr, Arthur Conmy, Itay Yona, Eric Wallace, David Rolnick, Florian TramèrGoogle DeepMind; ETH Zurich; University of Washington; OpenAI; McGill UniversityIndexed by this site · 16 days ago· Originally publishedSelected AttacksSelectedAttention43

Translation in progress — untranslated text is omitted.

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

AI summaryResearchers propose a model-stealing attack against production-grade language models that, using only regular API access, recovers the transformer's embedding projection layer up to symmetry, extracting the full projection matrices of OpenAI ada and babbage for less than $20. The authors claim this is the first attack that can exactly extract information from black-box production models such as ChatGPT and PaLM-2; it exploits the low-rank nature of the model's last layer projecting from the hidden dimension to a higher-dimensional logit space, recovering the hidden dimension and weight matrix through the logprobs and logit bias interfaces. On five OpenAI models, the extracted weights differ from the true weights by less than 7×10⁻⁴; the authors confirm that the hidden dimensions of ada and babbage are 1024 and 2048, respectively, and recover the hidden dimension size of gpt-3.5-turbo for less than $200, estimating that fully extracting its projection matrix would cost less than $2000.

Questions
The architectures and weights of production language models such as GPT-4 and PaLM-2 are secret, but the models themselves are exposed through APIs. The authors ask: how much exact information about a production model can an attacker learn solely through API queries.
Methods
Exploits the low-rank structure of the transformer's final layer, which projects from a low-dimensional hidden space to high-dimensional logits: first reconstruct the full logit vector via the top-K logprobs plus logit bias API, then perform SVD on the query result matrix to recover the hidden dimension h and the embedding projection matrix W (up to an h×h transformation).
Experiments and results
Nearly perfect recovery of hidden dimensions and projection matrices on 6 open-source models; for five OpenAI production models, extracted the full projection matrices of ada and babbage for less than 20 USD (RMS error 5·10⁻⁴ and 7·10⁻⁴), and confirmed the hidden dimension of gpt-3.5-turbo. After responsible disclosure, OpenAI and Google have implemented defenses.
Limitations and future work
The authors note that the attack can only recover a single layer, since due to the model's nonlinearity they see no obvious way to extend it to more layers; all attacks rely on the logit bias capability; the weights can only be recovered up to an h×h transformation rather than bit-for-bit exactly. Experiments were validated only on five OpenAI production models, and full matrix extraction was not achieved for babbage-002 and gpt-3.5.
Why it was selectedThe authors extracted complete projection matrices from OpenAI production models at a cost of less than $20; API providers that expose logit bias and logprobs can use this to check their own interfaces for leakage risk.

The authors extracted complete projection matrices from OpenAI production models at a cost of less than $20; API providers that expose logit bias and logprobs can use this to check their own interfaces for leakage risk.

Related events and news

1 events · 2 news mentions

News that mentions this paper

Mindgard 博客解析模型抽取与蒸馏攻击

Read originalarxiv.org