Large Margin Discriminative Loss for Classification

Hai-Vy Nguyen, Fabrice Gamboa, Sixin Zhang, Reda Chhaibi, Serge Gratton, Thierry GiacconearXiv 2024 · OpenReview

Abstract

In this paper, we introduce a novel discriminative loss function with large margin in the context of Deep Learning. This loss boosts the discriminative power of neural networks, represented by intra-class compactness and inter-class separability. On the one hand, the class compactness is ensured by close distance of samples of the same class to each other. On the other hand, the inter-class separability is boosted by a margin loss that ensures the minimum distance of each class to its closest boundary. All the terms in our loss have an explicit meaning, giving a direct view of the obtained feature space. We analyze mathematically the relation between compactness and margin term, giving a guideline about the impact of the hyper-parameters on the learned features. Moreover, we also analyze properties of the gradient of the loss with respect to the parameters of the neural network. Based on this, we design a strategy called partial momentum updating that enjoys simultaneously stability and consistency in training. Furthermore, we provide theoretical insights explaining why our method can avoid trivial solutions that do not improve the generalization capability of the model. Besides, we also investigate generalization errors to have better theoretical insights. The experiments show promising results of our method.

Introduction

Deep learning models are notoriously brittle. Minor perturbations, such as sensor noise or environmental occlusions, can significantly degrade the performance of state-of-the-art classifiers. While data augmentation via noise injection is a common remedy, it often introduces an "accuracy tax"—a trade-off where robustness to noise comes at the cost of performance on clean, uncorrupted data. This paper addresses the robustness-accuracy trade-off by rethinking the geometric structure of the feature space in neural networks.

The core challenge lies in the fact that training on noisy data often leads to "blurred" internal representations, where decision boundaries become less distinct. The authors propose a novel training framework that combines a discriminative loss at the penultimate layer with a class-wise feature alignment strategy, ensuring that models remain rock-solid against perturbations without sacrificing clean-data accuracy.

Methods

The proposed framework introduces a two-pronged objective function applied at the penultimate layer of the network:

  1. Discriminative Loss ($L_{clean}$): This component explicitly enforces intra-class compactness and inter-class separability. By pushing features of the same class toward a central centroid and maintaining a minimum margin between these centroids and decision boundaries, the model learns a more structured feature space.
  2. Class-wise Feature Alignment ($L_{noisy}$): Instead of forcing point-to-point stability, which can be overly restrictive, this loss aligns the cluster of noisy features with the cluster of clean features for each class. This preserves the network's expressiveness while preventing noisy inputs from drifting across decision boundaries.
  3. Partial Momentum Strategy: To ensure stable training, the authors utilize a momentum-based update for class centroids, balancing stability with the need for consistent gradients.
Comparison of feature space organization between standard training (a) and the proposed discriminative loss framework (b) for both clean and noisy data.

Key Insights

  • Curvature Regularization: The paper provides theoretical evidence that noise injection acts as a curvature regularizer. By reducing the Hessian eigenvalues of the loss landscape, the model becomes more stable, meaning small input changes result in minimal output variations.
  • Cluster Alignment: Shifting from point-to-point to cluster-to-cluster alignment allows the model to learn that noisy samples still belong to their respective class regions without over-constraining the feature learning process.
  • Feature Space Structuring: t-SNE visualizations demonstrate that the discriminative loss applied at the penultimate layer "trickles down," leading to more structured features in earlier layers of the network.

Experimental Results

The method was validated on CIFAR-10, SVHN, and a custom Road Condition Image Dataset. Key findings include:

  • Robustness: On CIFAR-10 with high Gaussian noise (20/255), the proposed method achieved 89.42% accuracy, compared to 50.32% for the baseline.
  • Generalization: Models trained with Gaussian noise showed "transferable robustness" to other perturbations like random occlusions and resolution degradation.
  • Accuracy Preservation: In nearly all tests, the proposed method matched or exceeded the clean-data accuracy of standard models, effectively eliminating the robustness-accuracy tax.

Conclusion

By focusing on the geometry of the feature space and employing a principled discriminative loss, this work provides a theoretically grounded path toward robust deep learning. Future work may extend these proofs to non-Gaussian noise types and optimize the computational overhead associated with dual-pass training.

Summary updated

BibTeX
@misc{nguyen2024large,
  author = {Hai-Vy Nguyen and Fabrice Gamboa and Sixin Zhang and Reda Chhaibi and Serge Gratton and Thierry Giaccone},
  title = {{Large Margin Discriminative Loss for Classification}},
  year = {2024},
  eprint = {2405.18499},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.18499},
}
Figure