Fair Contrastive Learning for Facial Attribute Classification

Sungho Park, Jewook Lee, Pilhyeon Lee, Sunhee Hwang, Dohyung Kim, Hyeran Byun · DOI

Abstract

Learning visual representation of high quality is essential for image classification. Recently, a series of contrastive representation learning methods have achieved preeminent success. Particularly, Supervised Contrastive Learning (SupCon) outperformed the dominant methods based on cross-entropy loss in representation learning. However, there are potential ethical risks in supervised contrastive learning. In this paper, we analyze unfairness caused by supervised contrastive learning and propose a new Fair Supervised Contrastive Loss (FSCL) for fair visual representation learning. Inheriting the philosophy of supervised contrastive learning, it encourages representation of the same class to be closer to each other than that of different classes, while ensuring fairness by penalizing the inclusion of sensitive attribute information in representation. In addition, we introduce a group-wise normalization (FSCL+) to diminish the disparities of intra-group compactness and inter-class separability between demographic groups that arouse unfair classification. Through extensive experiments on CelebA and UTK Face, we validate that the proposed method significantly outperforms SupCon and existing state-of-the-art methods in terms of the trade-off between top-1 accuracy and fairness.

Introduction

Supervised Contrastive Learning (SupCon) has emerged as a powerful paradigm for visual representation learning, often surpassing traditional cross-entropy-based methods. However, this paper identifies a critical flaw: SupCon can inadvertently learn "ethical shortcuts." When datasets contain biases—such as a correlation between a target attribute (e.g., "wearing a hat") and a sensitive attribute (e.g., gender)—the model may rely on the sensitive attribute to minimize its loss.

The authors identify two primary sources of unfairness: Malignant Information Learning, where the loss function encourages the model to exploit sensitive features to separate classes, and Group-wise Data Imbalance, where majority demographic groups dominate the optimization process, leading to poor representation quality for minorities.

Proposed Method: Fair Supervised Contrastive Loss

To mitigate these issues, the authors propose Fair Supervised Contrastive Loss (FSCL) and its enhanced version, FSCL+.

Redefining Negative Samples

The core innovation of FSCL lies in how it selects negative samples. In standard SupCon, an anchor image is pushed away from all images of different classes. In contrast, FSCL forces the model to select negative samples that share the same sensitive attribute as the anchor but belong to a different target class.

Conceptual diagram of the Fair Supervised Contrastive Loss (FSCL) mechanism.

By aligning the sensitive attributes of the anchor and its negatives, the model can no longer use that sensitive information to distinguish between classes. It is forced to learn features that are truly representative of the target class and agnostic to the sensitive attribute.

Group-wise Normalization (FSCL+)

To address data imbalance, FSCL+ introduces a normalization factor that balances the contribution of different demographic groups to the total loss. This ensures more uniform intra-group compactness and inter-class separability across all demographics, preventing the model from over-optimizing for majority groups.

Experimental Results

The researchers evaluated FSCL+ on the CelebA and UTK Face datasets, as well as a modified "Dogs and Cats" dataset to test general bias mitigation.

Quantitative Performance and Robustness

On CelebA, FSCL+ achieved a dramatic reduction in Equalized Odds (EO)—a standard fairness metric—dropping it from ~30.5 (SupCon) to 6.5, while maintaining a competitive top-1 accuracy of ~79.1%. Notably, FSCL+ remains effective even when sensitive attribute labels are scarce; using a pseudo-labeling strategy, the method maintains performance with as little as 5% of the data labeled for sensitive attributes.

Visualizing the Representation Space

The impact of FSCL+ is clearly visible in t-SNE projections of the learned embedding space.

t-SNE visualization comparing the representation spaces of SupCon and FSCL+.

In the SupCon visualization, clusters are heavily influenced by sensitive attributes (indicated by color). In contrast, the FSCL+ embeddings show that images are clustered primarily by the target class, with sensitive attributes being well-mixed within those clusters. This demonstrates that the model has successfully learned to be "blind" to sensitive information.

Conclusion

This work highlights the inherent fairness risks in supervised contrastive learning and provides a robust solution through FSCL+. By restructuring the contrastive task and incorporating group-wise normalization, the authors demonstrate that it is possible to achieve high accuracy without sacrificing ethical standards. Future work will explore extending this framework to more complex tasks like object detection and reducing the dependency on ground-truth sensitive attribute labels.

Summary updated

BibTeX
@misc{park2022fair,
  author = {Sungho Park and Jewook Lee and Pilhyeon Lee and Sunhee Hwang and Dohyung Kim and Hyeran Byun},
  title = {{Fair Contrastive Learning for Facial Attribute Classification}},
  year = {2022},
  eprint = {2203.16209},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.16209},
}
Figure