Generalization Beyond Feature Alignment

Yibing Liu, Chris Xing Tian, Haoliang Li, Shiqi Wang

TL;DR

This paper argues that standard contrastive learning for domain generalization (DG) over-aligns features, hindering generalization. They propose "Concept Contrast" (CoCo), which aligns high-level concepts represented by groups of neurons instead of individual feature elements, leading to more diverse representations and improved DG performance.

What Problem Does This Paper Address?

Domain generalization (DG) aims to train models that perform well on unseen data distributions, a crucial problem in real-world applications where data can vary significantly. Contrastive learning has been a successful approach for DG by learning invariant representations. However, this paper identifies a critical flaw: the standard method of aligning feature representations between similar samples (positive pairs) might be too aggressive. By forcing individual neuron activations to be identical, it can reduce the diversity of learned features, leading to overfitting and poor generalization. The authors propose that this "feature alignment" might be too granular and overlook the fact that different neurons can represent the same underlying visual concept.

Methods

The core of the paper is the Concept Contrast (CoCo) method. Instead of aligning individual feature elements (as in standard contrastive learning), CoCo focuses on aligning higher-level concepts. This is achieved in two main steps:

  1. Neuron Summarization: The authors first group neurons that tend to detect similar visual concepts. This is done by analyzing which neurons activate for the same sets of images. They use techniques like neuron activation thresholds and clustering (e.g., K-Means) to form "concept clusters."
  2. Concept Activation Vectors (CAVs): For each concept cluster, they compute a Concept Activation Vector (CAV). This vector aggregates the activations of neurons within that cluster, representing the concept's presence in a given input.
  3. Concept-Level Contrastive Loss: CoCo then applies a contrastive loss, but instead of comparing feature vectors, it compares these CAVs. This relaxes the strict alignment requirement on individual neurons, allowing for more diverse representations while still enforcing invariance at the concept level. CoCo is designed as a plug-and-play module that can be integrated into existing contrastive DG methods.

Datasets

The paper evaluates CoCo on several standard DG benchmarks:

  • PACS: (4 domains)
  • OfficeHome: (4 domains)
  • TerraInc: (4 domains)
  • DomainNet: (6 domains)

They also conduct experiments on a Synthetic-to-Real generalization task using the VisDA-17 dataset.

Key Insights and Ideas

  • Feature alignment can be detrimental: The paper's central insight is that aggressively aligning individual feature elements in contrastive learning can hurt generalization by reducing feature diversity.
  • Neurons represent concepts: Drawing from neuron interpretability research, the authors highlight that neurons often act as "concept detectors," and multiple neurons can represent the same concept in different ways.
  • Concept-level alignment is more robust: By aligning concepts rather than raw features, CoCo allows for more flexible and diverse feature representations, which are crucial for generalization.
  • Neuron coverage as a proxy for generalization: The paper uses "neuron coverage" (the proportion of activated neurons) as a metric to show that CoCo encourages the model to utilize a broader set of neurons, leading to better generalization.

Key Results

  • Consistent Improvement: CoCo consistently improves the performance of four canonical contrastive DG methods (SelfReg, CondCAD) across all tested datasets, achieving state-of-the-art results on the DomainBed benchmark.
  • Feature Diversity: Figure 4 demonstrates that CoCo significantly increases feature diversity (lower hyperspherical energy) compared to standard feature-level contrastive methods.
  • Neuron Coverage: Figure 5 shows that CoCo increases neuron coverage by up to 11.5% on SelfReg over PACS, indicating a broader utilization of the network's capacity.
  • Synthetic-to-Real: CoCo also enhances generalization on the synthetic-to-real task, improving feature diversity and accuracy.
  • Computational Efficiency: The additional computational cost of CoCo is minimal, around 7.6 seconds per 1,000 training steps, making it practical.

Limitations and Future Work

  • Neuron Summarization Dependency: The effectiveness of CoCo relies on the quality of neuron summarization and concept clustering. The paper uses annotated data (class and domain) for this, and while it shows improvements even without annotations, further research into unsupervised concept discovery could be beneficial.
  • Hyperparameter Sensitivity: While the paper analyzes hyperparameters like activation threshold (t) and the ratio of activated images (λ), finding optimal values might still require tuning.
  • Future Work: The authors suggest that CoCo's ability to improve generalization by promoting concept-level alignment and broader neuron utilization opens avenues for further research in understanding and enhancing model generalization. The plug-and-play nature of CoCo also makes it a promising component for future DG methods.

Summary updated

BibTeX
@article{liu2024generalization,
  author = {Yibing Liu and Chris Xing Tian and Haoliang Li and Shiqi Wang},
  title = {{Generalization Beyond Feature Alignment}},
  journal = {IEEE Transactions on Image Processing},
  year = {2024},
  url = {https://openreview.net/forum?id=8b0wvx7s8B},
}
Figure