Abstract
Learning representations that are invariant to "nuisance" variables—such as a patient's scanner brand in medical imaging or protected demographic attributes in credit scoring—is a critical challenge for fair and robust machine learning. Existing methods often suffer from a "collapse paradox," where aggressive regularization creates dense clusters that paradoxically make nuisance variables easier for an adversary to identify. This paper introduces Inverse Contrastive Loss (ICL), a novel objective that prevents latent space collapse by inverting the logic of contrastive learning: it pushes samples with similar nuisance attributes apart and pulls those with different attributes together.
1. The Challenge: The Collapse Paradox
In many domains, we seek features that are predictive of a target variable but independent of an extraneous confounder. Standard approaches, such as minimizing Mutual Information (MI) or employing adversarial training, often fail due to two primary issues:
- Latent Space Collapse: Aggressive compression of the latent space to remove information often forces data into tiny, dense clusters. This high density makes it easier for a downstream adversary to classify the confounder, defeating the purpose of the invariance regularizer.
- Training Instability: Adversarial modules are notoriously difficult to tune and frequently require specialized, computationally expensive solvers.
2. Methods: Inverse Contrastive Loss (ICL)
The core innovation of this work is the inversion of standard contrastive objectives. While typical contrastive learning pulls similar samples together, ICL treats the nuisance variable $c$ as the basis for separation:
- Formal Inversion (FI): The model is penalized if samples with different values of $c$ are far apart, effectively pulling them together to "mix" the classes in the latent space.
- Weighted Neighborhood Kinks (AWNK): The model is penalized if samples with the same value of $c$ are too close, pushing them apart to prevent the formation of group-specific clusters.
This mechanism can be visualized as a physical spring system: samples with similar nuisance values are connected by "repulsion" springs, while those with dissimilar values are connected by "attraction" springs. This ensures the latent space remains uniform rather than clustering by the confounder. Theoretically, for binary variables, ICL is shown to be equivalent to a Regularized Maximum Mean Discrepancy (R-MMD), grounding the heuristic approach in statistical divergence theory.
3. Experimental Evaluation
The authors evaluated ICL across diverse benchmarks, including image data (MNIST, MNIST-ROT), fairness datasets (Adult, German Credit), and medical imaging (ADNI). In the ADNI dataset, ICL was used to neutralize "site effects" from different MRI scanner manufacturers (e.g., Siemens vs. GE), allowing for more robust Alzheimer's disease prediction.
As shown in the results table, ICL significantly outperforms standard MI and MMD approaches in achieving invariance. For instance, on the MNIST style experiment, ICL achieved an adversarial invariance measure of 32 (lower is better), compared to 50 for MI and 55 for MMD. On the Adult dataset, ICL reduced the adversary's ability to predict gender to 75% (down from 84% unregularized) while maintaining a stable 83-84% accuracy for the primary income prediction task.
4. Key Insights
- Invariance vs. Compression: A key finding is that simply "compressing" a representation to remove information (the Information Bottleneck approach) can backfire. True invariance requires ensuring that the distributions of different groups overlap perfectly in a spread-out space.
- Handling Continuity: Unlike many adversarial methods limited to discrete categories, ICL handles continuous variables (like Age) by using a neighborhood radius ($\delta$). Samples within the radius are pushed apart, while those outside are pulled together.
- Optimization Efficiency: ICL is designed to provide non-zero gradients even when samples are very close, making it highly compatible with standard first-order gradient descent methods.
5. Conclusion and Future Work
Inverse Contrastive Loss provides a stable, computationally efficient alternative to adversarial training for learning invariant representations. By preventing latent space collapse, it achieves superior performance in hiding nuisance variables across various domains. Future research will focus on reducing the computational overhead of pairwise distance calculations in large batches and expanding the theoretical framework to high-dimensional, non-discrete extraneous variables.
Summary updated