Abstract
Deep neural networks for classification are typically viewed as purely discriminative models. This research reveals that the penultimate layer of a standard classifier naturally encodes a generative model of the features it learns. By leveraging directional statistics—specifically the von Mises-Fisher (vMF) distribution—the authors demonstrate a mathematical duality between standard cross-entropy loss and hyperspherical clustering. This insight leads to Class-wise Knowledge Distillation (CKD), a method that enables robust knowledge transfer without requiring original training data, significantly outperforming standard distillation under domain shifts.
Introduction
In modern deep learning, classifiers are often treated as "black boxes" that map inputs to labels. However, the penultimate layer—the representation just before the final softmax—contains the most refined features of the data. Traditional knowledge distillation (KD) requires passing large datasets through a "teacher" model to train a "student." This process is often hindered by data privacy concerns or domain shifts between the teacher's training environment and the student's operational environment. This paper addresses whether we can recover the distribution of these internal features using only the network's weights, effectively treating the classifier as a generative model.
Methodology: The vMF Connection
The core of this work lies in the discovery that training with Softmax and Cross-Entropy loss naturally encourages activations to cluster around the directions of the weights in the final layer.
Hyperspherical Clustering
The researchers model these activations using the von Mises-Fisher (vMF) distribution, which can be thought of as a Gaussian distribution projected onto a hypersphere. Unlike Euclidean models, vMF focuses on the direction of feature vectors rather than their magnitude.
Weights as Prototypes
By treating the final classification layer's weights as "mean directions" for class-specific vMF distributions, the authors establish a generative-discriminative pair. This allows for the synthesis of "fake" activations for any class based solely on the model's weights. This suggests that deep classifiers primarily learn "where" a feature points on a hypersphere, rather than its absolute magnitude.
Class-wise Knowledge Distillation (CKD)
Building on this, Class-wise Knowledge Distillation (CKD) uses the teacher’s final weights to estimate inter-class affinities ($p(y|i)$). This allows a student model to learn the relationships between classes (e.g., that "cats" are more similar to "dogs" than "trucks") even when the input data is noisy or significantly different from what the teacher originally saw.
Experimental Validation
The proposed framework was validated across MNIST, CIFAR, and ImageNet benchmarks, focusing on robustness and generative capabilities.
Robustness to Domain Shift
One of the most striking results occurred on the CIFAR-100 dataset. When student models were trained on heavily downsampled images (x0.25), standard KD accuracy dropped to 20.27%. In contrast, the CKD method maintained an accuracy of 49.72%. This stability stems from the fact that CKD relies on the teacher's fixed weights rather than its potentially erratic predictions on corrupted data.
Generative Performance
The vMF prior was integrated into Variational Auto-Encoders (HVAE-L) and Generative Adversarial Networks (SNGAN). On CIFAR-10, the SNGAN with a vMF prior achieved an Inception Score of 8.511 (up from 8.406), indicating higher diversity and quality in generated images. On MNIST, the HVAE-L achieved superior Log-Likelihood and ELBO scores compared to standard hyperspherical VAEs.
Conclusion
This research shifts the perspective on classifiers from purely discriminative tools to implicit generative models. By focusing on the directional statistics of the penultimate layer, the authors provide a robust framework for data-free distillation and improved generative modeling. Future work may extend this to self-attention mechanisms and explore its utility in anomaly detection, where "out-of-distribution" samples can be identified by their distance from the established vMF clusters.
Summary updated