Why Large Models Can't Fully Prevent Knowledge Distillation Attacks

    Knowledge distillation—and its modern variant, model extraction—is a persistent challenge for large language models served through APIs. This article explains why preventing distillation entirely is difficult from an information-theoretic standpoint: any output useful enough for legitimate users also carries enough signal for a would-be distiller. It reviews common defenses such as output watermarking, anomaly detection, rate limiting, withholding probability distributions, and terms of service, outlining the limits of each. It also explains why claims that a model "prevented" distillation often fail to hold up, and argues for judging defenses through independent, pre-registered benchmarks. The core takeaway: distillation cannot be stopped outright, but a defense-in-depth approach can make it expensive, traceable, and accountable.

    Why Large Models Can’t Fully Prevent Knowledge Distillation Attacks

    Introduction: A question that keeps coming up

    Whenever a leading large model is released, a sharp challenge inevitably appears in the community: why can’t top models “prevent” distillation? People joke that a model seems to “prevent” distillation when it is weak, “fails to prevent” it when it is strong, and “happens to protect the key part” when it performs normally. The very fact that these seemingly contradictory conclusions coexist shows that the claim “preventing distillation” needs to be broken down more rigorously. This article takes no side on any specific product. Instead, it returns to the technical fundamentals to answer a more basic question: why large models cannot completely prevent distillation in an information-theoretic sense, and how far engineering can actually go in defending against it.

    1. First, clarify the concepts: two kinds of “distillation”

    1.1 Classic knowledge distillation

    Knowledge distillation was originally a model compression technique: a large “teacher model” produces soft labels (the class probability distribution) to train a smaller “student model.” Because soft labels carry “dark knowledge” such as the similarity between classes, the student can approximate the teacher’s performance with far fewer parameters.

    1.2 API-based “distillation” (model extraction)

    When people discuss distillation of large models today, they usually mean a different scenario: an attacker treats a closed model that is exposed only through an interface (API) as the teacher, collects a large number of “input–output” pairs through massive, systematic queries, and then trains a functionally similar replacement model from this data. This kind of attack is closer to what academia calls “model extraction.”

    Both scenarios share one thing in common: a model’s value seeps outward through its outputs, and this seepage is very hard to plug completely.

    2. The root cause: as long as the output is useful, it must leak learnable signals

    This is the most important point in the article, and it is best understood from an information-theoretic perspective.

    A model is valuable because it can give “useful” outputs for inputs; and “useful” precisely means that the output is strongly correlated with the true answer and with human preference. What the attacker has to do is use these “input–output” pairs as supervisory signals to fit a new function.

    Here lies an unavoidable fundamental contradiction:

    • If the output is useful enough for ordinary users, it must also be informative enough for a potential distiller;
    • If the output were made completely uninformative in order to prevent distillation, the model would lose its reason for existence.

    In other words, “usefulness” and “resistance to extraction” trade off against each other at the information level. This is not a question of any vendor’s engineering ability; it is determined by the very definition of the problem.

    The conceptual sketch below shows that even if only the best answer is returned (without returning a probability distribution), the student model can still complete distillation.

    1. # Conceptual sketch: even returning only the top-1 result, the student can still fit the teacher
    2. teacher_output = model.generate(prompt) # the only result a user can obtain
    3. dataset.append((prompt, teacher_output)) # the attacker does not need logits/probabilities
    4. # as long as there are enough (prompt, teacher_output) pairs, standard supervised learning can approximate the teacher
    5. student.train(dataset)

    The key point is this: the fact that the model must deliver a result is itself the source of the leak.

    3. Common defenses and their limits

    Although it cannot be plugged completely, engineering still offers multiple layers of measures that can raise the cost of distillation. Viewed rationally, most of them “raise the threshold” rather than “eliminate the possibility.”

    3.1 Output perturbation and watermarking

    The idea is to embed subtle, statistically detectable perturbations (watermarking) into the generated text, so that one can later determine whether a piece of data originated from this model, for provenance tracking or rights protection.

    • Limit: watermarks are mainly for “forensics/accountability” and cannot stop data from being collected; their robustness drops against post-processing such as paraphrasing, translation, and resampling; excessive perturbation, in turn, harms output quality.

    3.2 API access risk control and anomaly detection

    By analyzing query patterns, one can identify suspicious “data-scraping” behavior—for example, whether prompts are highly systematic, whether large-scale sampling is done on the same questions, and whether the call cadence shows machine-like characteristics.

    • Limit: attackers can use multiple accounts, distributed proxies, and rate disguise to appear as normal users, evading detection on any single dimension.
    1. # Conceptual sketch: multi-dimensional anomaly scoring, not a single threshold
    2. score = 0
    3. score += 3 if query_diversity(window) < 0.1 else 0 # highly repetitive/systematic prompts
    4. score += 2 if request_cadence_is_machine_like() else 0 # overly regular cadence
    5. score += 2 if account_graph_shares_fingerprint() else 0 # multiple accounts sharing a fingerprint
    6. flag_as_abuse = score >= threshold

    3.3 Rate and quota limits

    Limiting the number of calls per unit of time can significantly raise the time and financial cost of “collecting the same amount of data.”

    • Limit: it only slows things down, it does not stop them; for resource-rich organizations, this is merely a cost issue.

    3.4 Return only results, not distributions

    Not exposing the full probability distribution (logits) and giving only the final answer reduces the amount of information from a single query.

    • Limit: as described in Section 2, the top-1 result alone is usually enough to support distillation—it just converges more slowly.

    Prohibiting the use of outputs to train competing models in the terms of service.

    • Limit: this is an after-the-fact accountability measure; technically it cannot prevent the behavior from occurring, and cross-border enforcement is also quite difficult.

    4. “Shoot the arrow first, then draw the target”: why the conclusion that something was “prevented” often doesn’t hold

    Back to the joke at the beginning. In an evaluation context, “shooting the arrow first and then drawing the target” refers to first obtaining some result and then defining the criteria for “success” around it, so the “hit rate” is always high. This should make us wary of conclusions such as “model X prevented distillation”:

    • If the model being defended is used to judge whether distillation succeeded, that amounts to letting the referee and the athlete be the same person;
    • If the evaluation set comes from the same source and follows the same distribution as the defense target, it is no surprise that the defender “happens” to cover the test points;
    • A truly credible evaluation should be verified by an independent third party, using a broader test set that did not take part in the defense design, with the criteria fixed in advance.

    The independence of the evaluation often matters more to the credibility of a conclusion than the defense measures themselves.

    5. A rational view: what engineering can actually do

    Overall, distillation cannot be completely prevented in a mathematical sense, but a “defense-in-depth” approach can raise the cost of an attack to an uneconomical level:

    1. Layering: combine watermarking (provenance) + risk control (identification) + rate limiting (raising cost) + legal measures (accountability);
    2. Continuous operation: treat anomaly detection as a long-term contest, iterating the rules as new collection patterns emerge;
    3. Clarifying the goal: shift the goal from “absolutely preventing” to “making distillation expensive, traceable, and accountable”;
    4. Independent evaluation: use a neutral, pre-fixed benchmark to assess the real effectiveness of protection, avoiding self-serving conclusions.

    For teams building protection systems on top of general cloud capabilities (such as logging services, monitoring and alerting, containerized elastic gateways, and so on), platforms such as Baidu AI Cloud can help turn these measures into a sustainably running pipeline rather than a one-off stack of rules.

    Conclusion

    The answer to the question “why can’t distillation be prevented” lies not in the idea that some vendor is not trying hard enough, but in this: a system that must continuously output useful results will naturally release learnable signals to the outside world. The truly professional attitude is to acknowledge this underlying constraint and make clear-headed engineering trade-offs among cost, experience, and compliance—turning “cannot be prevented” into “not worth it.”