Analyzing and Improving Representations with the Soft Nearest Neighbor Loss
By Nicholas Frosst, Nicolas Papernot, Geoffrey E. Hinton. 2019
194 citations recorded by the source corpus.
We explore and expand the $\textit{Soft Nearest Neighbor Loss}$ to measure the $\textit{entanglement}$ of class manifolds in representation space: i.e., how close pairs of points from the same class are relative to pairs of points from different classes. We demonstrate several use cases of the loss. As an analytical tool, it provides insights into the evolution of class similarity structures during learning. Surprisingly, we find that $\textit{maximizing}$ the entanglement of representations of different classes in the hidden layers is beneficial for discrimination in the final layer, possibly because it encourages representations to identify class-independent similarity structures. Maximizing the soft nearest neighbor loss in the hidden layers leads not only to improved generalization but also to better-calibrated estimates of uncertainty on outlier data. Data that is not from the training distribution can be recognized by observing that in the hidden layers, it has fewer than the normal number of neighbors from the predicted class.
Subfields: Artificial Intelligence, Statistical and Nonlinear Physics
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Artificial Intelligence
- Sergey Levine
- Trevor Darrell
- Andrew Zisserman
- Pieter Abbeel
- Quoc V. Le
- Yoshua Bengio
- Bernt Schiele
- Stefano Soatto
In Statistical and Nonlinear Physics
- Stefano Soatto
- Hengrui Jia
- Christopher A. Choquette-Choo
- Micah Goldblum
- Pratik Chaudhari
- Mohammad Norouzi
- Ting-Li Chen
- Ce Liu
Citations in the corpus
- Unraveling Meta-Learning: Understanding Feature Representations for Few-Shot Tasks (2020, background): “Yet other work finds that features generated by a pre-trained model on data from classes absent from training are entangled, but the logits of the unseen data tend to be clustered (Frosst et al., 2019).”
- Supervised Contrastive Learning (2020, methodology): “[12] also uses a closely related loss formulation to ours to entangle representations at intermediate layers by maximizing the loss.”
- A Baseline for Few-Shot Image Classification (2019, background): “This is motivated from [40] who show that activations of all layers are entangled without any class-specific clusters.”
- With a Little Help from My Friends: Nearest-Neighbor Contrastive Learning of Visual Representations (2021, methodology): “Inspired by recent work [18, 21] we also investigate using a soft-nearest neighbor, a convex combination of embeddings in the support-set where each one is weighted by its similarity to the embedding (see [18] for details).”
- On the Difficulty of Defending Self-Supervised Learning against Model Extraction (2022, methodology): “Finally, modern batch contrastive approaches , such as In-foNCE (van den Oord et al., 2018) or Soft Nearest Neighbor (SoftNN) (Frosst et al., 2019) compare not only positive but also the negative pair samples in terms of their distances and learn representations so that positive pairs have similar…”
- Entangled Watermarks as a Defense against Model Extraction (2020, methodology): “Introduced by Srivastava and Hinton [35], the SNNL was modified and analyzed by Frosst et al. [19].”
- Measuring Domain Shift for Deep Learning in Histopathology (2020, background): “…DNNs trained with natural images, for example what representations the model learns, how the choice of loss function and batch size affects the representation [38]– [40] and how this can be leveraged for transfer learning, novelty detection and detection of adversarial examples [39], [41], [42].”
- Dissecting Supervised Constrastive Learning (2021, background): “…the triplet loss (Weinberger & Saul, 2009), the N -pairs loss (Sohn, 2016), or the soft nearest-neighbor loss (Salakhutdinov & Hinton, 2007; Frosst et al., 2019) and contributes to the the success of self-supervised learning, framed as an instance discrimination task (van den Oord et al.,…”
- On Episodes, Prototypical Networks, and Few-shot Learning (2020, background): “[16]), except for a few important differences which we discuss at the end of this section.”
- Why Do Better Loss Functions Lead to Less Transferable Features? (2020, background): “More generally, studies have investigated how class information evolves through the hidden layers of neural networks using linear classifiers [2], binning estimators of mutual information [61, 58, 26], Euclidean distances [59], the soft nearest neighbor loss [24], and manifold geometry [3, 16].”
- Syntriever: How to Train Your Retriever with Synthetic Data from LLMs (2025, unknown): “The retriever is then trained by modified Soft Nearest-Neighbor loss (Frosst et al., 2019) to cluster multiple relevant passages together in the embedding space.”