THIS EXPLANATION
THE ROOM
CDA·55 Computing, Data & AI 6 MIN · 8 STATIONS

Copying something you can only question

A Socratic walk-through of copying something you can only question — reasoned out one step at a time, not lectured.

abcdefgh
a

The question we started with

THE QUESTION #

How do you reconstruct a system you are never allowed to look inside?

A company spends a fortune training a model and then does the only commercially sensible thing: it hides the weights and sells access to the answers. You may ask it anything; you may not see it. That feels like a safe trade, because the valuable object never leaves the building.

But consider what you are being handed instead. Every query returns a point on the function the model computes. Ask enough questions and you are accumulating a description of that function. So the question worth sitting with is not whether answers leak information about the thing that produced them — they must — but exactly what they leak, and where that leakage stops. Those two halves get conflated constantly, and the conflation is where both the panic and the complacency come from.

b

Reasoning it through

REASONING #

Start with the simplest case, because it is the one where the answer is exact. Suppose the hidden model is a logistic regression over ten features, and the API returns a confidence score rather than a bare label. Each query then gives you one equation in the model's parameters. Eleven well-chosen queries give you eleven equations, and you solve them. Tramer and colleagues demonstrated exactly this at USENIX Security in 2016 against commercial prediction APIs, recovering the parameters of logistic regressions and decision trees outright. Nothing statistical about it — it is algebra, and the leak came from returning confidences rather than labels.

Now scale that up and watch the guarantee weaken. For a deep network there is no small system of equations to solve, so what does querying buy you instead? Training data. Each query-and-answer pair is a labelled example produced by the target itself, and a fresh model trained on enough of them will approximate the target's behaviour. Notice what has changed: you are no longer recovering the model, you are training a substitute on its outputs — distillation, done without permission.

That distinction has consequences worth being precise about, and the literature separates them. Fidelity is how closely the copy agrees with the original, including on the original's mistakes. Accuracy is how often the copy is right. A distilled substitute can reach high accuracy while diverging from the target on the awkward inputs, and if your reason for copying is to find adversarial examples that transfer, fidelity is the property you actually need.

Then ask the sharper question: is exact weight recovery even a coherent goal? For a neural network, no. Permute the neurons in a hidden layer and rescale a pair of weights and you get a numerically different network that computes exactly the same function. Behaviour cannot distinguish them, because behaviour is all you ever see. Anything recovered from queries is recovered up to those symmetries at best.

Which makes the 2024 result from Carlini and colleagues instructive rather than contradictory. They showed that the final embedding projection layer of a production language model could be recovered — along with the hidden dimension — from ordinary API access, for a modest query cost. But read the claim carefully: it is the last layer, and it is recovered up to an affine transformation, because that is the resolution the outputs allow. The rest of the network stayed hidden. What made even this possible was an interface returning fine-grained logit information, and the mitigation was to restrict that interface.

So collect the pattern. The richer the output, the more each query tells you: full logit vectors leak the most, then ranked probabilities, then a top-1 label with a score, then a bare label. And what does not come out? Not the training data — that is memorisation extraction, a different attack with a different mechanism. Not the architecture beyond what the outputs constrain. Not the interior of the network. What you get is the input-output map, sampled where you chose to sample it, which means the copy is faithful on the distribution you queried and unreliable off it.

c

The analogy

THE ANALOGY #
THE FIGURE

Imagine trying to reproduce a chef's recipe with no access to the kitchen — you may only send in ingredients and taste what comes back. Send in enough combinations and you can learn the dish well enough to serve something a diner would accept, and you can learn precisely which combinations the chef handles badly. What you never learn is the kitchen: which pan, what order, what temperature. You have reconstructed the behaviour of the cooking, not the cooking.

WHERE IT BREAKS DOWN

a chef improvises, so two identical orders can differ, whereas a deployed model at temperature zero is a deterministic function — and that determinism is what turns the tasting into measurement rather than sampling, making the copy far more tractable than the kitchen analogy suggests.

d

Clarifying the model

THE MODEL #

Three clarifications.

First, the common overstatement: extraction does not "steal the model" in the sense of recovering the weights. Outside small, structured models it produces a functional imitation whose quality is bounded by how well the query distribution covered the input space.

Second, the common understatement: an imitation is often enough for the attacker's purpose. It removes the per-query fee, it can be probed offline without rate limits, and it serves as a local stand-in for crafting attacks meant to transfer back to the original.

Third, the defences follow directly from the reasoning and each has a cost. Return less — labels rather than confidences, rounded scores rather than exact ones — and you lose utility for honest callers. Rate-limit and monitor for query patterns that look like systematic coverage rather than use, and you risk false positives. Watermark the outputs, which does not prevent copying but supports a later claim of ownership. There is no defence that keeps the interface fully informative and fully private, because the information is the interface.

e

A picture of it

THE PICTURE #
Copying something you can only question
Copying something you can only question Enter at the parallelogram of chosen inputs and go down to the diamond, which is the only real branch: everything depends on how much detail the interface returns. Each branch ends in a store -- what you actually hold afterwards. The flagged node at the bottom is the honest limit that both paths run into, and the rounded node is why an attacker settles for an imitation anyway. {"generator":"mermaid-svg-renderer@3.2.1","source":"../Socrates/.diagram-cache/_src/copying-something-you-can-only-question.md","sourceIndex":1,"sourceLine":4,"sourceHash":"cd57ebf3e2fd79414c5c56f958e76bf1e315381ca43d5e83149f8dea8286357e","diagramType":"flowchart-v2","layoutVariant":"source","repairedDuplicateIds":[],"motion":"entrance-with-reduced-motion-fallback","presentation":"editorial","attempt":1,"viewBox":{"x":0,"y":0,"width":1077,"height":920},"qa":{"passed":true,"findings":[]}} full logit vector label with score bare label only Chosen query inputs Paid query interface How much detail comes back Solve for the final layer Train a substitute on the pairs Many more queries for the samecopy Last layer up to an affinetransform Functional imitation Offline probing and transferableattacks Interior weights and training datastay hidden
KINDSsourceprocessdecisionoutcomeriskconnector

How to readEnter at the parallelogram of chosen inputs and go down to the diamond, which is the only real branch: everything depends on how much detail the interface returns. Each branch ends in a store — what you actually hold afterwards. The flagged node at the bottom is the honest limit that both paths run into, and the rounded node is why an attacker settles for an imitation anyway.

f

What became clearer

WHAT CLEARED #
WHAT CLEARED

Answers are evidence about the thing that gave them, so a query interface is a slow, paid channel for exporting a model's behaviour. But behaviour is the ceiling: what comes out is a function-shaped copy, accurate where you asked and untrustworthy where you did not, with the interior unrecoverable in principle because different interiors produce identical answers.

g

Where to go next

ONWARD #
  • Distillation as the legitimate twin of this attack, and why the line between them is contractual rather than technical.
  • Membership inference and memorisation extraction: what queries reveal about the training data rather than the model.
  • Watermarking model outputs, and how robust such marks are to paraphrase.
h

Key terms

TERMS #
TermWhat it means
Model extractionreconstructing a model, or a functional substitute for it, from its responses to chosen queries.
Fidelity vs accuracywhether a copy agrees with the target (including its errors) versus whether the copy is correct.
Logitsthe raw pre-normalisation scores a classifier produces, the most information-rich output an interface can return.
Permutation symmetrythe fact that reordering hidden units yields a different parameter set computing the identical function.
Transferable adversarial examplean input crafted against a substitute model that also fools the original.

Every term the collection defines is gathered in the glossary.

Nearby on the shelf

4