Abstract
Unsupervised sentence representation learning (SRL) has been significantly advanced by contrastive learning frameworks such as SimCSE. However, these methods often struggle with the "anisotropy" inherent in pre-trained language models (PLMs), where embeddings are clustered in a narrow cone rather than being uniformly distributed. This paper introduces a simple yet effective temperature cool-down strategy. By initiating training with a higher temperature to broadly distribute representations before transitioning to a standard low temperature, the model achieves superior alignment and uniformity. Our results demonstrate that this approach improves performance on Semantic Textual Similarity (STS) benchmarks and enhances training robustness across different model architectures.
1. Introduction
In unsupervised SRL, the goal is to map sentences into a vector space where semantically similar sentences are close together. Contrastive learning achieves this by pulling "positive" pairs (e.g., the same sentence with different dropout masks) closer and pushing "negative" pairs (different sentences in a batch) apart. A critical hyperparameter in this process is the temperature ($\tau$), which scales the similarity scores and determines the model's focus on "hard negatives"—samples that are already close in the embedding space.
2. The Challenge of Anisotropy
PLMs like BERT and RoBERTa naturally suffer from anisotropy, meaning their initial embedding space is cramped into a narrow, cone-like distribution. When training begins with a low temperature, the model immediately attempts to aggressively repel these naturally close neighbors. This leads to "unintended pulling and pushing" in the early stages of fine-tuning, preventing the model from reaching an optimal, uniform distribution on the unit hypersphere. This instability often results in sub-optimal representations and high sensitivity to random seeds.
3. Proposed Method: Temperature Cool-down
To address the early-stage instability caused by anisotropy, we propose a Temperature Cool-down strategy. Instead of a fixed temperature, we vary $\tau$ during the initial phase of training. We evaluate two primary schedules:
- Temperature Cool-down with Constant (TCC): The model starts with a high initial temperature ($\tau_i$) for a small percentage of training steps, then immediately drops to the target temperature ($\tau$).
- Temperature Cool-down with Step function (TCS): A multi-step approach that gradually reduces the temperature from $\tau_i$ to a median value before settling at $\tau$.
The intuition is that a higher initial temperature acts as a "soft" repulsion mechanism. It pushes all instances apart more equally, regardless of their initial proximity, effectively "preparing" the representation space to be more uniform before the fine-grained, low-temperature training takes over.
4. Experimental Results
We evaluated our strategy using 1 million randomly sampled sentences from English Wikipedia for training and the standard Semantic Textual Similarity (STS) benchmarks for evaluation.
4.1 Performance and Robustness
Adding the TCC strategy to the SimCSE framework yielded significant improvements:
- BERT-base: Average STS scores improved by ~1.5% (from 76.95 to 78.10).
- RoBERTa-base: Average STS scores improved by ~1.4%.
- Stability: The cool-down method showed significantly lower standard deviation across different runs, making the training process more reliable and less dependent on specific random seeds.
4.2 Alignment vs. Uniformity
Our analysis reveals that while a higher initial temperature leads to higher uniformity loss (a "messier" space) at the start, it actually improves alignment (keeping positive pairs close). This suggests that the cool-down period allows the model to find a better global structure before focusing on local discriminative features.
5. Conclusion
Temperature cool-down is a simple, plug-and-play strategy that mitigates the negative effects of anisotropy in PLMs during contrastive learning. By managing the repulsion force in the early stages of training, we achieve more stable dynamics and higher-quality sentence representations. Future work will explore more continuous schedules, such as exponential decay or cosine cool-down, to further optimize the transition between the exploration and refinement phases of training.
Summary updated