Studying the impact of magnitude pruning on contrastive learning methods

Francesco Corti, Rahim Entezari, Sara Hooker, Davide Bacciu, Olga SaukharXiv 2022 · DOI

Abstract

Contrastive learning is celebrated for producing high-quality representations, but these structures are surprisingly fragile under model compression. This study investigates the interaction between Supervised Contrastive Learning (SCL) and magnitude pruning. We demonstrate that SCL models are significantly more vulnerable to pruning than traditional cross-entropy models, particularly when pruning occurs early in the training cycle. Our results highlight a critical trade-off between representation quality and sparsifiability.

Introduction

As deep learning models scale, pruning—the removal of redundant weights—has become essential for edge deployment. Simultaneously, Supervised Contrastive Learning (SCL) has emerged as a powerful technique for learning robust feature representations by grouping similar examples in a latent space. However, the interplay between these two techniques remains under-explored. This paper investigates whether the structured representations learned via SCL mitigate or exacerbate the selective forgetting typically associated with model pruning.

Methods and Experimental Setup

We compare two training objectives: standard Supervised (Sup) cross-entropy and Supervised Contrastive Learning (SCL). Pruning is executed via three Magnitude Pruning schedules:

  • One-Shot: Pruning once after training is complete, followed by fine-tuning.
  • Gradual Magnitude Pruning (GMP): Incremental weight removal throughout the entire training process.
  • Delayed GMP ($\Delta$GMP): Postponing pruning until initial latent structures are established (e.g., epoch 50).

Evaluation utilizes CIFAR-10 on a WideResNet-16-2 backbone. We measure impact using Pruning Identified Exemplars (PIEs)—samples the dense model classifies correctly but the sparse model misses—and the Q-Score, an unsupervised metric for latent feature quality. Visual analysis is conducted via UMAP.

The Vulnerability of Contrastive Representations

Our analysis reveals that SCL is a "high-capacity" specialist. While it produces superior representations in dense models, it is far more sensitive to parameter loss. At 90% sparsity, SCL models with GMP result in 748 PIEs, nearly three times the 273 PIEs observed in standard supervised models.

UMAP visualizations for Supervised training: dense (left), 95% GMP pruned (center), and 95% One-Shot pruned (right).

As shown in Figure 1, traditional supervised models maintain relatively robust decision boundaries even at 95% sparsity. In contrast, SCL models suffer from "cluster collapse."

UMAP visualizations for SCL training: dense (left), 95% GMP pruned (center), and 95% One-Shot pruned (right). Note the significant cluster degradation in the GMP case.

Figure 2 illustrates that at high sparsity, the tight clusters formed by SCL begin to "bleed" into one another, turning into a disorganized cloud. This collapse is reflected in the Q-Score, which drops sharply for SCL as sparsity increases, while remaining stable for supervised models.

The Critical Role of Pruning Schedules

For contrastive learning, the pruning schedule is more impactful than the final sparsity level. Early pruning (GMP) is devastating because the model requires its full capacity to organize the feature space. Delaying pruning (One-Shot or $\Delta$GMP) allows the model to establish its clusters first, leading to significantly better performance and representation retention.

Conclusion

While SCL achieves higher initial accuracy (~92% vs ~90.5%), its performance degrades faster than standard supervised learning under magnitude pruning. Current pruning methods are "blind" to the geometric structures SCL builds. Future work should explore representation-aware pruning algorithms designed to preserve the latent manifolds essential for contrastive learning.

Summary updated

BibTeX
@misc{corti2022studying,
  author = {Francesco Corti and Rahim Entezari and Sara Hooker and Davide Bacciu and Olga Saukh},
  title = {{Studying the impact of magnitude pruning on contrastive learning methods}},
  year = {2022},
  eprint = {2207.00200},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2207.00200},
}
Figure