Label Anchored Contrastive Learning for Language Understanding

Zhenyu Zhang, Yuming Zhao, Meng Chen, Xiaodong He · DOI

Abstract

Contrastive learning (CL) has significantly advanced representation learning by teaching models to distinguish between similar and dissimilar data points. However, applying CL to Natural Language Understanding (NLU) remains challenging due to the discrete nature of language—which makes data augmentation difficult—and the traditional treatment of labels as mere categorical indices. We present Label Anchored Contrastive Learning (LaCon), a novel framework that treats class labels as semantic anchors within the same embedding space as text instances. By optimizing instance-centered and label-centered objectives alongside a label regularizer, LaCon achieves state-of-the-art results on NLU benchmarks and demonstrates substantial gains in few-shot and imbalanced data scenarios.

Introduction

In standard supervised learning, labels are often underutilized, acting only as grouping tags rather than semantic guides. Furthermore, Pre-trained Language Models (PtLMs) like BERT often suffer from anisotropy, where embeddings are confined to a narrow "cone" in the vector space, limiting their discriminative power. While Contrastive Learning (CL) offers a solution, its reliance on self-supervised data augmentation (e.g., word deletion or back-translation) is risky in NLP, where a single word change can fundamentally alter a sentence's meaning.

LaCon addresses these hurdles by discarding complex data augmentation in favor of using label embeddings as anchors. This approach creates a joint semantic space where classification is performed by identifying the nearest label vector to a given sentence vector.

The LaCon Framework

LaCon introduces three complementary objectives to refine the embedding space:

  1. Multi-head Instance-centered Contrastive Loss (ICL): This objective treats each text instance as an anchor, pulling it toward its corresponding label embedding while pushing it away from incorrect labels. By utilizing a "multi-head" approach similar to Transformers, the model splits embeddings into subspaces to capture diverse semantic granularities.
  2. Label-centered Contrastive Loss (LCL): This flips the perspective by using the label as the anchor. It pulls all instances of a specific class toward that label, providing a more stable training signal than standard supervised CL, which typically compares every instance to every other instance in a batch.
  3. Label Embedding Regularizer (LER): To combat anisotropy, LER forces label embeddings to spread out uniformly across the unit hypersphere. This prevents the model from collapsing labels into a single point and ensures a well-distributed representation space.

Experimental Results

Benchmark Performance

LaCon was evaluated across a comprehensive suite of NLU benchmarks, including GLUE, CLUE, and general classification tasks like DBpedia and Yelp Review. LaCon-vanilla consistently outperformed BERT fine-tuned with standard Cross-Entropy, showing improvements such as a 4.1% increase on RTE and a 2.3% gain on Tnews.

Few-Shot and Imbalanced Data

The framework's most significant strengths appeared in data-constrained environments. In few-shot settings (20 samples per class), LaCon achieved a 9.4% improvement on the BUSTM task and a 7.0% improvement on QQP compared to standard fine-tuning. This success is attributed to the model's ability to transfer structural knowledge from majority classes to minority classes via shared label embeddings.

Efficiency and Theoretical Impact

Unlike standard supervised CL (SCL), which has a complexity of $O(N^2)$ relative to batch size, LaCon’s ICL only compares instances to labels, reducing complexity to $O(NC)$, where $C$ is the number of classes. Theoretically, minimizing the ICL loss is asymptotically equivalent to flattening the singular value distribution of the embedding matrix, directly addressing the anisotropy problem inherent in PtLMs.

Conclusion

Label Anchored Contrastive Learning (LaCon) redefines the role of labels in NLU by treating them as semantic anchors. By moving away from problematic data augmentations and focusing on a joint label-instance embedding space, LaCon provides a robust, efficient, and highly effective framework for language understanding, particularly in challenging few-shot and imbalanced scenarios. Future work will explore extending this label-anchored philosophy to other domains such as Computer Vision and Speech processing.

Summary updated

BibTeX
@inproceedings{zhang2022label,
  author = {Zhenyu Zhang and Yuming Zhao and Meng Chen and Xiaodong He},
  title = {{Label Anchored Contrastive Learning for Language Understanding}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.naacl-main.103},
}
Figure