Feature Variance Regularization: A Simple Way to Improve the Generalizability of Neural Networks

Ranran Huang, Hanbo Sun, Ji Liu, Lu Tian, Li Wang, Yi Shan, Yu WangAAAI 2020

Abstract

Deep neural networks often overfit to training data by memorizing sample-specific noise rather than learning generalizable semantic features. We present Feature Variance Regularization (FVR), a simple yet effective technique that penalizes the empirical variance of features during training. By constraining features to stay closer to their class means, FVR encourages the model to ignore idiosyncratic noise and focus on robust, shared characteristics. Our experiments across various benchmarks, including CIFAR-100, ImageNet, and fine-grained classification tasks, demonstrate that FVR significantly improves generalizability and robustness, particularly in data-scarce scenarios.

Introduction

The standard training paradigm for deep neural networks is Empirical Risk Minimization (ERM), which minimizes the average loss over the training set. While effective, ERM often leads models to become overly confident by exploiting non-essential patterns—such as background textures or specific lighting—that are unique to the training samples but do not generalize to the broader population. This creates a discrepancy between the empirical feature distribution and the true data distribution.

To address this, we propose Feature Variance Regularization (FVR). The core idea is to "pull" the features of training samples closer together in the feature space, preventing the network from relying on tiny, noisy differences to distinguish between samples.

Methodology

FVR modifies the standard classification objective by adding a penalty term proportional to the variance of the features extracted by the network. The total loss function is defined as:

$$L = Loss_{classification} + \gamma \cdot Var[\Phi(X)]$$

where $\gamma$ is a regularization hyperparameter and $Var[\Phi(X)]$ represents the sum of variances across all feature dimensions for a given mini-batch.

Theoretical Grounding

The motivation for FVR is rooted in statistical learning theory. Using Bernstein-type bounds, it can be shown that feature variance serves as an upper bound for "feature deviation"—the distance between the empirical mean of training features and the true population mean. By minimizing this variance, we mathematically constrain the model's potential for deviation on unseen data, thereby improving generalization.

Implementation

FVR is computationally efficient and easy to implement. It can be applied to the penultimate layer or across multiple deep layers (referred to as "two-scale" FVR). Unlike techniques like Label Smoothing, FVR operates directly on the feature space, making it more robust to label noise.

Experimental Results

We evaluated FVR across several standard computer vision benchmarks:

  • General Classification: On CIFAR-100 with a ResNet18 backbone, FVR achieved an accuracy of 76.22%, significantly outperforming standard ERM (72.94%) and other regularization techniques like Dropout (74.18%) and Label Smoothing (74.70%).
  • ImageNet: FVR improved Top-1 accuracy by 0.57% on the full dataset. Its impact was even more pronounced in low-data regimes; with only 10% of the training data, FVR provided a 1.71% improvement.
  • Fine-Grained Visual Categorization (FGVC): On challenging datasets like CUB-200-2011, FVR boosted ResNet50 accuracy from 85.4% to 87.1%, outperforming several specialized architectures.
  • Semantic Segmentation: On the Cityscapes dataset, FVR yielded a 1.8% mIOU gain using the ENet architecture.

Analysis and Visualization

Decision Boundaries and Feature Stability

Visualizing decision boundaries on synthetic datasets reveals that FVR produces more stable and robust boundaries compared to ERM. As shown in Figure 1, while ERM's performance and feature distribution can fluctuate significantly with changes in model capacity (hidden size), FVR maintains high accuracy and a more consistent feature representation.

Comparison of decision boundaries and feature PCA for ERM and FVR across different hidden layer sizes.

Feature Clustering

The effect of "pulling" features together is clearly visible in t-SNE visualizations. In Figure 2, the baseline model shows significant overlap and "noise" in the center of the feature space (indicated by the red circle). In contrast, the FVR-trained model produces much tighter, better-separated clusters, indicating that it has learned more discriminative and stable features.

t-SNE visualization of features for the baseline model versus FVR.

Robustness and Focus

Qualitative analysis using Grad-CAM shows that FVR-trained models focus more tightly on the actual objects of interest, whereas ERM models often rely on background cues. Furthermore, FVR demonstrates superior robustness to label noise compared to label smoothing, as it regularizes the internal representations rather than the output targets.

Conclusion

Feature Variance Regularization is a simple, theoretically grounded, and effective method for improving the generalization of neural networks. By penalizing feature variance, FVR forces models to ignore sample-specific noise and learn robust semantic features. Its effectiveness across diverse tasks and its particular strength in low-data scenarios make it a valuable tool for practical deep learning applications. Future work will explore the application of FVR to other domains such as Natural Language Processing.

Summary updated

BibTeX
@inproceedings{huang2020feature,
  author = {Ranran Huang and Hanbo Sun and Ji Liu and Lu Tian and Li Wang and Yi Shan and Yu Wang},
  title = {{Feature Variance Regularization: A Simple Way to Improve the Generalizability of Neural Networks}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2020},
  doi = {10.1609/aaai.v34i04.5840},
}
Figure