Stealing Part of a Production Language Model

The paper demonstrates the first practical attack that extracts the embedding-projection layer of production LLMs through their ordinary logit APIs.
Ask this paper
Attack setup: By querying the API with carefully chosen prompts and analyzing the logit outputs, the attacker can reconstruct the final projection matrix from public API access alone.
Concrete extractions: The attack recovers Ada (hidden dim 1024) and Babbage (hidden dim 2048) matrices for under $20, and estimates GPT-3.5-turbo's hidden dimension for under $2,000.
Cross-provider: Similar attacks apply to other production LLMs including PaLM-2, indicating the vulnerability is structural rather than tied to any one provider.
Mitigations: The authors propose defenses such as restricting logit-bias API features, adding noise, and careful API design to close off the attack surface.
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.