Zero-Shot Knowledge Distillation from a Decision-Based Black-Box Model

Zi Wang

TL;DR

This paper introduces a novel method to train a compact "student" model using a "teacher" model that operates as a complete black box. The teacher provides only final class labels (no probabilities) and the original training data is entirely inaccessible. By treating the teacher's decision boundaries as a source of "dark knowledge," the authors generate pseudo-samples and construct soft labels, allowing student models to achieve competitive performance even under extreme information constraints.

The Challenge of Black-Box Distillation

Knowledge Distillation (KD) is a highly effective technique for model compression, where a small student model learns to mimic a larger, high-performing teacher. Traditionally, this process requires three key components:

  1. Access to the original training data.
  2. Access to the teacher’s internal parameters (a "white-box" model).
  3. Access to "soft labels" (the full probability distribution across all classes, rather than just the final predicted class).

In real-world applications, these requirements are often deal-breakers. Companies frequently keep their models behind APIs that only return a single hard label (e.g., "This is a cat") to protect intellectual property and user privacy. Furthermore, the original training data might be proprietary, restricted, or deleted.

This paper tackles the most restrictive scenario possible: Zero-Shot Decision-Based Black-Box KD (ZSDB3KD). In this setting, researchers have no data, no parameters, and no probabilities—just a hard-label API.

Methods: Bridging the Information Gap

Overview of the ZSDB3KD pipeline

To overcome these severe limitations, the authors propose a two-stage approach that extracts knowledge directly from the geometry of the teacher's decision boundaries.

1. Constructing Soft Labels via "Sample Robustness"

Because the teacher only provides a hard label, the authors need a way to estimate the model's underlying confidence. They achieve this using a metric called Minimal Boundary Distance (MBD).

Visualizing Minimal Boundary Distance
  • The Logic: If a sample is located very far from the decision boundary of a specific class, the model is highly confident in its prediction. Conversely, if it sits close to the boundary, it represents a "near-miss" or lower confidence.
  • The Technique: The authors employ zeroth-order optimization (sampling random Gaussian noise) to estimate the gradient of the decision boundary without requiring internal model access. By measuring the distance from a sample to the boundaries of every other class, they can mathematically construct a synthetic probability distribution, effectively recovering the missing soft labels.

2. Generating Pseudo-Samples (The Zero-Shot Component)

Without access to the original training data, a "transfer set" must be created from scratch to train the student.

  • The process begins with random noise.
  • This noise is iteratively "pushed" away from the teacher's decision boundaries.
  • The core intuition is that natural images (which the teacher was originally trained on) typically reside in high-confidence regions far from decision boundaries. By maximizing this boundary distance, the random noise eventually evolves into recognizable features that mimic the underlying data distribution.

Experimental Setup

The researchers evaluated their approach across several standard computer vision benchmarks:

  • MNIST & Fashion-MNIST: Standard baselines for digit and clothing classification.
  • CIFAR-10 & CIFAR-100: More complex object classification tasks.
  • FLOWERS102: A high-resolution, fine-grained dataset used to test the limits of the approach.
  • Architectures: The experiments utilized LeNet-5, AlexNet, and various ResNet architectures (ResNet-18, 34, 50).

Key Insights

  • Boundaries are Knowledge: The most striking insight from this work is that the geometry of a model's decision boundaries contains almost as much distillable information as the model's actual output probabilities.
  • Zeroth-Order Optimization is Viable: You don't need to see the internal weights of a model to understand its behavior. By probing the model with noisy inputs and observing label shifts, you can effectively map out its internal logic.
  • Pushing Away from Confusion: To generate synthetic training data, the goal isn't just to find a sample that crosses into "Class A"; it is to find the "most Class A" sample possible by moving it as far away as possible from regions where the model might confuse it with other classes.

Key Results

  • Outperforming Surrogates: In scenarios where training data is available, the proposed DB3KD method outperformed training a student against a local "surrogate" teacher. On CIFAR-10, DB3KD-MBD achieved 78.30% accuracy, nearly matching the teacher's original 79.30%.
  • Zero-Shot Success: In the most difficult "Zero-Shot" setting (no data, black-box teacher), the method achieved 96.54% accuracy on MNIST and 59.46% on CIFAR-10. While naturally lower than white-box methods, this represents a massive leap over using raw noise, which typically results in near-zero accuracy.
  • Visual Evolution: The optimization process successfully morphs random noise into clear, recognizable features (e.g., digits 0-9) simply by pushing the samples away from decision boundaries.

Limitations and Future Work

  • Query Efficiency: The zeroth-order optimization process requires a massive number of queries to the teacher API (often thousands per sample). In a commercial setting where APIs charge per query, this could become prohibitively expensive.
  • Complexity Scaling: While the method works well on MNIST and CIFAR, scaling it to massive, high-dimensional datasets like ImageNet remains a significant challenge due to the vast search space.
  • Future Directions: The authors suggest that improving the efficiency of the boundary search and exploring more sophisticated data generation techniques could make this approach highly practical for large-scale industrial applications.

Summary updated

BibTeX
@inproceedings{wang2021zero,
  author = {Zi Wang},
  title = {{Zero-Shot Knowledge Distillation from a Decision-Based Black-Box Model}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
}
Figure