Abstract
Deep Neural Networks (DNNs) often learn representations that are redundant or lack explicit class-specific structure. This paper introduces class-wise representation regularizers—specifically Class-wise Covariance Regularization (cw-CR) and Class-wise Variance Regularization (cw-VR)—to explicitly shape hidden layer activations. By minimizing intra-class variance and covariance, these methods encourage the model to learn more discriminative and compact features. Experimental results across 22 tasks demonstrate that these class-aware penalties consistently outperform standard weight decay and class-agnostic representation regularizers, achieving state-of-the-art results on architectures like ResNet.
Introduction
In deep learning, the quality of the "representation"—the pattern of activations in hidden layers—is critical for generalization. Ideally, these representations should be sparse, decorrelated, and distinct for different categories. While standard techniques like L1/L2 regularization target the model's weights, they only indirectly influence these activations.
Existing representation-based regularizers, such as DeCov, typically analyze the statistical characteristics of the entire dataset simultaneously. However, this approach ignores a vital signal: class labels. For classification tasks, we desire features that are consistent within a class but distinct between classes. By ignoring labels, standard methods may inadvertently suppress features essential for distinguishing similar categories. This paper proposes leveraging class information to regularize activations directly.
Methodology
The authors propose two primary class-aware regularizers added as penalty terms to the standard cross-entropy loss:
- cw-CR (Class-wise Covariance Regularizer): This targets the off-diagonal elements of the covariance matrix calculated for each class individually. It encourages units within a layer to be independent for samples of the same class, thereby reducing "co-adaptation."
- cw-VR (Class-wise Variance Regularizer): This minimizes the variance of each unit's activation for samples within the same class. Intuitively, it forces the network to produce highly similar, compact activation patterns for all instances of a specific category (e.g., all "cats").
These are compared against their "all-class" counterparts (CR and VR), where CR is functionally equivalent to the DeCov method.
Visualizing the "Needle" Effect
One of the most striking findings is the impact of these regularizers on the geometry of the representation space. Visualization via Principal Component Analysis (PCA) reveals that cw-VR and cw-CR produce incredibly distinct, needle-like clusters for each class.
As shown in the figure above, baseline models exhibit significant overlap between classes even after extensive training. In contrast, the class-wise regularizers (particularly cw-VR) collapse the intra-class variance so effectively that each class occupies a very narrow, distinct region of the feature space. While this process naturally leads to smaller overall activation values—a phenomenon termed "activation squashing"—the relative distinctness of the classes remains high, facilitating better classification accuracy.
Layer-wise Sensitivity
The effectiveness of these regularizers is not uniform across the network. The authors found that regularizing the layers closest to the output is significantly more beneficial than regularizing lower layers.
Lower layers typically represent simple, shared visual concepts like edges or textures. Forcing these early features into class-specific shapes can be counterproductive. Conversely, upper layers represent complex, class-specific concepts where this shaping is most appropriate. As seen in the layer-wise analysis, the test error generally decreases as the regularization is moved toward the final fully connected or output layers.
Key Results and Performance
The proposed regularizers demonstrated broad success, outperforming the baseline and standard weight decay in 21 out of 22 experimental scenarios.
- ResNet Performance: On CIFAR-10, adding cw-VR to a ResNet-110 model reduced the error rate from 6.43% to 6.00%.
- Dominance of cw-VR: cw-VR emerged as the strongest overall regularizer, achieving the best performance in 13 out of the 22 tasks.
- Versatility: Beyond classification, the approach showed promise in image reconstruction, where cw-VR reduced the mean squared error of a deep autoencoder by approximately 17%.
Conclusion and Future Work
Class-wise representation regularizers provide a computationally efficient way to improve DNN performance by explicitly shaping the activation space. While highly effective, the methods require careful hyperparameter tuning to avoid excessive activation squashing. Future research may explore stable ways to combine intra-class variance reduction with explicit inter-class distance maximization to further enhance discriminative power.
Summary updated