The TWIML AI Podcast
The TWIML AI Podcast

Stealing Part of a Production Language Model with Nicholas Carlini - #702

Today, we're joined by Nicholas Carlini, research scientist at Google DeepMind to discuss adversarial machine learning and model security, focusing on his 2024 ICML best paper winner, “Stealing part of a production language model.” We dig into this work, which demonstrated the ability to succes

Featured Speakers

Nicholas Carlini Guest

Topics Discussed

Episode Summary

Executive Summary: Nicholas Carlini explains how language models changed adversarial ML from hypothetical security research into a real-world attack surface. He details a model-stealing attack that recovers a production model’s final projection/embedding layer via query responses and SVD, why it forced API changes at OpenAI and Google, and argues that “differentially private” fine-tuning on top of non-private pretraining can mislead users and weaken the meaning of privacy.

Main Topics: Adversarial ML becomes practically relevant (Priority: 5/5): Carlini argues the core problems in adversarial ML—prompt injection, poisoning, data extraction—didn’t change, but LLM deployment made them urgent because attacks now target real production systems rather than hypothetical setups. Model stealing of production language models (Priority: 5/5): The central technical discussion covers stealing the last linear layer of a language model (and often the shared input embedding matrix) using queried probability vectors and singular value decomposition to recover a functionally equivalent component. Attack mechanics and query strategy (Priority: 5/5): He explains that the attack relies on repeated queries, full probability-vector access, and linear algebra on a low-rank output space. Nonlinearity in earlier layers helps generate broad coverage without carefully crafted inputs. API mitigations and defensive change (Priority: 5/5): OpenAI and Google changed their APIs after disclosure: restricting or removing logit bias combinations and limiting access to probabilities. Carlini frames this as a rare case where security research caused non-security teams to ship a breaking change. Differential privacy and pretraining/fine-tuning (Priority: 4/5): A separate paper argues that calling a model 'differentially private' after only private fine-tuning on top of non-private pretraining can be misleading, because the model may still memorize and reveal data from the pretraining corpus. Privacy, user expectations, and benchmark mismatch (Priority: 4/5): Carlini stresses that privacy harms are not purely mathematical: users may care if a model reveals information that was public only incidentally, or data that is now gone. He also criticizes using standard accuracy benchmarks to claim private-learning progress.

Key Arguments: LLM APIs create a real threat model for model stealing because attackers can query production models without seeing weights. The attack is not about copying exact bits; it recovers a functionally equivalent layer, which is sufficient for practical use. Recovering the final layer is valuable because it can reveal the model width and support other attacks, even if it is not the whole model. The technical novelty is largely in scaling and API constraints, not in difficult math; the core math is linear algebra/SVD on low-rank outputs. OpenAI and Google’s API changes validate the severity of the attack because they reduced functionality to protect against it. Differential privacy applied only during fine-tuning does not make the entire model private if pretraining used non-private data. Using the term 'differential privacy' for partial privacy can confuse users and dilute the meaning of true end-to-end privacy. Privacy should be judged partly by user expectations and harm, not only by formal mathematical definitions. Benchmarking private learning with standard accuracy tasks is misleading when foundation models already solve those tasks zero-shot. Future work should reduce assumptions, extend attacks to more layers, and scale them to larger models.

Data Points: Conference award: Best Paper Award - Carlini’s model-stealing paper won a Best Paper Award at ICML 2024. Early model-stealing paper year: 2016 - He references early work by Florian Tramèr and collaborators on stealing simple prediction models. Prior layer-stealing work year: 2020 - He and David Rolnick independently showed functionally equivalent stealing for small ReLU networks. Neural network size in earlier work: under ~50 neurons - The earlier theoretical stealing result applied to tiny ReLU networks. Floating-point precision in earlier work: float64 - The earlier theoretical setting assumed 64-bit floating point computation. Token vocabulary size example: ~100,000 tokens - Used to explain the high-dimensional output probability space of language models. Hidden dimension example: ~4,000 to 8,000 - Used as an example width for model hidden states and low-rank output subspace. Initial top-k probability exposure: top 5 - At the time of the attack, APIs exposed the top five token probabilities. Post-mitigation top-k exposure: top 20 - He says OpenAI increased the returned probabilities to about 20 tokens, but made them invariant to logit bias. Attack cost: a couple hundred to a couple thousand dollars - Estimated cost to run the implemented attack under the original API behavior. Post-mitigation cost estimate: 5x to 50x more expensive - Estimated increase if forced to use binary-search-style logit-bias workarounds.

Pivotal Quotes: "The way that GPT-4 works would be functionally identical if the entire field of adversarial machine learning dropped off the face of the earth." — Nicholas Carlini: He is emphasizing how little adversarial ML had influenced the design of frontier models before recent security incidents. "We could finally convince someone to make a breaking change to fix some security problem." — Nicholas Carlini: He describes OpenAI and Google modifying APIs in response to the model-stealing attack. "You have this mathematical definition, but it actually relates to real people, and we should acknowledge that people exist in the world." — Nicholas Carlini: He explains why privacy claims must account for user perception and real-world harm, not only formal definitions.

Implications: LLM security is now forcing product and API changes, not just papers. Future model releases may need stricter output controls, and privacy claims will likely face closer scrutiny when pretraining is non-private but fine-tuning is labeled private.

🔓 Sign Up for Unlimited Episode Search

About The TWIML AI Podcast

View all episodes from The TWIML AI Podcast