Toward Certified Robustness of Distance Metric Learning

Xiaochen Yang, Yiwen Guo, Mingzhi Dong, Jing-Hao XueIEEE TNNLS 2024 · DOI

Abstract

Distance Metric Learning (DML) aims to learn a transformation that pulls similar items together and pushes dissimilar ones apart. While effective, traditional DML methods often lack "certified robustness," where small input perturbations can lead to misclassification due to excessive "stretching" of the feature space. This paper introduces LMNN-PL (Large Margin Nearest Neighbor with Perturbation Loss), a framework that optimizes for "adversarial margins" in the input space. By minimizing a newly derived perturbation loss, the proposed method achieves both certified robustness against noise and improved generalization on unseen data across diverse datasets.

Introduction

DML algorithms, such as Large Margin Nearest Neighbor (LMNN), typically focus on maintaining a margin in the learned feature space. However, a large feature-space margin does not guarantee safety in the input space. Because the learned metric can warp the space, a minute perturbation in the input can be magnified, causing the model to flip its prediction. This research addresses the need for certified robustness—the guarantee that a model's prediction remains stable within a specific radius of the original input.

Methodology

The proposed framework, LMNN-PL, introduces three core innovations:

  1. Adversarial Margin: Rather than focusing solely on feature distances, the authors define an adversarial margin as the minimum Euclidean distance in the input space required to change a model's classification.
  2. Closed-Form Solution: Unlike iterative deep learning "attacks," the authors derive a geometric, closed-form solution to calculate this margin for Mahalanobis distances.
  3. Perturbation Loss ($J_P$): A hinge-like loss function is introduced to penalize instances with small adversarial margins. This acts as a data-dependent regularizer that can be integrated into existing triplet-based DML algorithms.
Conceptual comparison between traditional DML and the proposed method focusing on adversarial margins in the input space.

By optimizing this loss, the model learns a metric that is discriminative yet "smooth," ensuring that small input changes do not result in large jumps in the feature space.

Key Insights: The Stretching Effect and Generalization

A critical observation is the "stretching effect" in traditional DML. To force a margin, standard algorithms often assign high weights to features with low separability, making the model hypersensitive to noise in those dimensions. LMNN-PL corrects this by penalizing extreme stretching.

Visualization of data distributions under Euclidean, LMNN, and LMNN-PL metrics, highlighting how LMNN-PL avoids the extreme stretching seen in standard LMNN.

Furthermore, the authors establish a theoretical link between robustness and generalization. Using algorithmic robustness theory, they prove that increasing the adversarial margin directly reduces the gap between training and test error.

Experimental Results

The method was evaluated on 16 datasets, including 13 from the UCI repository and 3 high-dimensional datasets (Isolet, MNIST-2k, and APS Failure).

  • Accuracy: LMNN-PL outperformed standard LMNN on 12 of the 13 UCI datasets.
  • Noise Resilience: Under 5 dB SNR Gaussian noise, LMNN-PL maintained significantly higher accuracy. For the Yeast dataset, it surpassed the best LMNN variant by over 10%.
  • Adversarial Defense: The method showed slower performance degradation against deliberate adversarial attacks compared to traditional DML.
  • Efficiency: The computational complexity remains comparable to standard LMNN, ensuring practical applicability.

Conclusion and Future Work

LMNN-PL provides a robust framework for DML by focusing on input-space adversarial margins. While currently focused on linear Mahalanobis distances, future work aims to extend these certified robustness principles to non-linear deep metric learning and more complex distance metrics.

Summary updated

BibTeX
@article{yang2024toward,
  author = {Xiaochen Yang and Yiwen Guo and Mingzhi Dong and Jing-Hao Xue},
  title = {{Toward Certified Robustness of Distance Metric Learning}},
  journal = {IEEE Trans. Neural Networks Learn. Syst.},
  year = {2024},
  doi = {10.1109/tnnls.2022.3199902},
}
Figure