Safety, Security & Responsible AI·Question 47 of 70Advanced

You suspect someone is distilling your model through your public API. How would you detect it and what can you actually do?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

First, separate two threats that get conflated. Weight extraction: recovering actual parameters. Published work has shown that parts of production models, notably the final embedding projection layer and hidden dimension, can be recovered through API access, and richer outputs like full logprobs make this dramatically cheaper. Behavioural cloning: harvesting input/output pairs and fine-tuning a smaller open model on them. The second is what actually happens commercially, it needs no cleverness, and it is cheap relative to training the teacher. That asymmetry is the whole problem.

Full worked answer

First, separate two threats that get conflated. Weight extraction: recovering actual parameters. Published work has shown that parts of production models, notably the final embedding projection layer and hidden dimension, can be recovered through API access, and richer outputs like full logprobs make this dramatically cheaper. Behavioural cloning: harvesting input/output pairs and fine-tuning a smaller open model on them. The second is what actually happens commercially, it needs no cleverness, and it is cheap relative to training the teacher. That asymmetry is the whole problem.

Detection signals. The tell is that a harvester queries like a dataset, not like a user. Look for: high volume with low repetition; near-uniform topic coverage rather than the power-law a real product produces; no conversational follow-ups, so single-turn only; templated or synthetic-looking prompt structure; temperature 0 with long deterministic outputs; heavy logprob usage; a steady round-the-clock rate with no diurnal pattern; and many accounts sharing an ASN, device fingerprint or payment instrument. Any one is weak. The combination is strong, and it is a straightforward anomaly-detection problem on the query stream. Cluster accounts by query-distribution shape rather than scoring requests individually.

Defences, layered. Rate and token quotas per account, plus friction on new accounts. Restrict output surface: do not expose full logprobs or large top-k, since that is the single biggest extraction lever, though it costs real customers a real feature and you should say so. Watermarking, with the caveat that it is fragile under paraphrase and fine-tuning. KYC for high-throughput tiers. Canary prompts: idiosyncratic inputs with distinctive responses that a cloned model will reproduce, giving you a fingerprint testable against a suspect model later, which is what makes the legal case. And the terms of service, which is not a cop-out: distillation clauses are the mechanism that actually gets used.

The honest conclusion, and the thing a senior candidate says out loud: you cannot prevent behavioural cloning against a public API without destroying the product, because the product is the outputs. You raise the cost, you make it detectable, and you make it legally actionable. This is a business and legal problem with a technical assist, not a problem you engineer away.

What a good answer covers

  • First, separate two threats that get conflated
  • Weight extraction: recovering actual parameters
  • Published work has shown that parts of production models, notably the final embedding projection layer…
  • Behavioural cloning: harvesting input/output pairs and fine-tuning a smaller open model on them
  • The second is what actually happens commercially, it needs no cleverness, and it is cheap relative to…

Key terms: Weight extraction · Behavioural cloning · Detection signals · Defences, layered · The honest conclusion

Interviewer follow-ups to expect

  1. Restricting logprobs breaks legitimate use cases like classification and eval scoring. How do you decide that tradeoff?

  2. If you fingerprint a suspect model via canaries, what would you need for that to hold up as evidence?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep