Large Margin Deep Networks for Classification

Gamaleldin F. Elsayed, Dilip Krishnan, Hossein Mobahi, Kevin Regan, Samy Bengio

TL;DR

This paper introduces a novel, differentiable loss function that forces deep neural networks to maintain a "large margin"—a safety distance—between data points and decision boundaries. By applying this margin across hidden layers and using a first-order approximation to keep it computationally tractable, the authors significantly improve model generalization, resistance to label noise, and robustness against adversarial attacks.

The "Margin Problem" in Deep Learning

In classical machine learning, the "margin" is the minimum distance between a training sample and the decision boundary. Support Vector Machines (SVMs) are famous for maximizing this margin, which theoretically leads to better generalization.

However, deep learning has a margin problem. While deep networks are incredibly powerful, they are often brittle. Because standard training (using cross-entropy loss) doesn't explicitly maximize the margin in the input or hidden spaces, models can produce decision boundaries that pass dangerously close to training data.

Conceptual margin and spiral dataset comparison

This lack of a safety buffer makes networks vulnerable to:

  1. Adversarial Attacks: Tiny, invisible perturbations that easily push a data point across a tight decision boundary, flipping the prediction.
  2. Noisy Labels: Overfitting to incorrectly labeled data by creating highly complex, convoluted boundaries.
  3. Poor Generalization: Failing to accurately classify unseen data when training samples are scarce.

Calculating the exact margin in a deep, non-linear network is mathematically intractable. This paper seeks a way to approximate and enforce these margins efficiently.

Methods: Approximating the Margin

The authors propose a Large Margin Loss function based on a first-order Taylor approximation.

  • Linearization: Since finding the exact distance to a complex, curvy decision boundary is hard, they linearize the network's output locally. This allows them to derive a closed-form solution for the distance to the boundary.
  • Flexible Norms ($l_p$): Their formulation allows practitioners to define the margin using different metrics ($l_1, l_2,$ or $l_\infty$), depending on the type of robustness desired.
  • Hidden Layer Margins: Crucially, they don't just enforce a margin at the input layer. They apply the loss to intermediate representations (hidden layers), ensuring the "internal logic" of the network also maintains a safety buffer.
  • Optimization Tricks: To prevent training from becoming too slow, they use a subset of classes for the margin calculation and treat the denominator of their distance formula as a constant during backpropagation to avoid expensive second-order derivatives.

Key Insights and Results

The researchers evaluated their approach across standard benchmarks (MNIST, CIFAR-10, and ImageNet) using various architectures like CNNs, ResNets, and Inception v3. The large margin loss acts as a powerful regularizer that is complementary to techniques like Dropout, Batch Normalization, and Weight Decay.

Performance on noisy labels and limited training data

The "Large Margin" models consistently outperformed standard cross-entropy baselines:

  • Adversarial Robustness: On MNIST, the margin-based model outperformed common baselines by up to 21%. On CIFAR-10, it showed a 14% improvement, and on ImageNet, an 11% boost against adversarial perturbations.
  • Handling "Dirty" Data: Large margin classifiers are naturally more resistant to label noise because they are less likely to "reach out" and create a tiny island in the decision space just to satisfy a single mislabeled point. When 80% of MNIST labels were randomly flipped, the $l_2$ margin model maintained 96.4% accuracy, while standard cross-entropy dropped to 93.9%.
  • Limited Data Generalization: In a "small data" regime (using only a tiny fraction of MNIST), the large margin approach improved test accuracy by about 3.7% over standard methods.

Limitations and Future Work

While powerful, the method has trade-offs. Training is computationally more expensive; the authors note their method is roughly 20% to 60% slower in wall-clock time than standard cross-entropy due to the extra gradient computations. Additionally, it introduces a new hyperparameter, $\gamma$ (the desired margin size), which may need to be tuned for each layer. Finally, because the method relies on a first-order approximation, the "perceived" margin might deviate from the "actual" margin in highly non-linear regions of the network. Exploring higher-order approximations could be a future path, though likely at a much higher computational cost.

Summary updated

BibTeX
@inproceedings{elsayed2018large,
  author = {Gamaleldin F. Elsayed and Dilip Krishnan and Hossein Mobahi and Kevin Regan and Samy Bengio},
  title = {{Large Margin Deep Networks for Classification}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
  url = {https://openreview.net/forum?id=SyNTHPW_-B},
}
Figure