SimReg: Achieving Higher Performance in the Pretraining via Embedding Similarity Regularization

Yan Sun, Guoxia Wang, Jinle Zeng, JiaBin Yang, Shuai Li, Li Shen, Dacheng Tao, DianHai Yu, Haifeng Wang

TL;DR

Standard cross-entropy loss in large language model (LLM) pretraining often fails to create well-separated token representations, limiting training efficiency. SimReg addresses this by introducing a lightweight embedding similarity regularization loss that clusters tokens predicting the same target while pushing different tokens apart. This simple contrastive tweak accelerates training convergence by over 30% and boosts downstream zero-shot performance by more than 1% with virtually zero computational overhead.

What Problem Does This Paper Address?

At their core, modern LLMs are trained on a simple objective: next-token prediction. From a machine learning perspective, this is essentially a massive multi-class classification problem where the model uses the context of preceding words to predict a categorical distribution over the vocabulary.

However, language is highly context-dependent. The word "walls" in "The cat jumps over walls" and "A child paints near walls" appears in entirely different environments. Because standard cross-entropy loss only focuses on matching the final token prediction to the ground truth, it allows the underlying token embeddings to suffer from high intra-class variance (same target token, wildly different embeddings) and high inter-class similarity (different target tokens, overlapping embeddings).

The authors discover a critical bottleneck in standard pretraining: cross-entropy loss stops driving feature separability early in the training process. Once the embeddings are "good enough" to sustain basic classification, the model stops optimizing their geometric arrangement, leaving significant representation capacity on the table.

Figure 2: (a) We analyze the token ID distribution over 1B training samples from the C4 dataset and find that only about 2% of tokens occur with extremely high frequency, resulting in a pronounced long- tail effect in the classification data. (b) We observe that the contrastive similarity loss of embeddings does not continue to decrease after reaching a basic threshold and then the feature similarity is no longer further optimized. Simply increasing the model size does not improve this performance.

Methods

To enforce geometric structure on the embedding space, the authors introduce SimReg (Similarity Regularization), an auxiliary contrastive loss term added to the standard cross-entropy objective.

For any given sequence during pretraining, tokens are partitioned into:

  • Positive groups: Tokens that share the same ground-truth next-token label.
  • Negative groups: Tokens with different next-token labels.

SimReg minimizes the distance between positive pairs and maximizes the distance between negative pairs using cosine similarity with a temperature coefficient ($\tau$). To adapt this framework to the unique challenges of language modeling, the authors introduced three key innovations:

  1. Self-Sample Similarity: Because rare words might only appear once in a sequence, the positive group includes a token's similarity to itself to ensure a valid contrastive pair always exists.
  2. Group-Level Averaging: Natural language is heavily long-tailed. To prevent highly frequent tokens (like "the" or "and") from dominating the loss, SimReg averages at the group level rather than the sample level.
  3. Chunk-wise SimReg: Computing pairwise similarity across long sequences scales quadratically ($O(n^2)$), which breaks down during sequence-parallel training across multiple GPUs. The authors mitigate this by dividing sequences into smaller chunks and computing SimReg internally within each chunk, reducing complexity to $O(n^2/b)$ and eliminating redundant inter-node communication.

Mathematically, the authors prove that SimReg expands the multi-classification margin, effectively making the final linear layer's (the LM Head) job much easier. Crucially, they find that applying SimReg only at the final layer right before the LM head yields the best results, as intermediate layers contain highly entangled contextual features.

Figure 1: (left) Workflow of the SIMREG loss. (Right) We compare the cosine similarity of token embeddings in a sample on the LLaMA-7B model trained via “CrossEntropy only" and “CrossEn- tropy+SIMREG". Using “CrossEntropy only" fails to enforce sufficient separability among token features, whose cosine values of all token pairs exceed 0.5. With the introduction of SIMREG, feature separability is generally enhanced (averaged cosine value is reduced by at least 0.1), thereby providing stronger support for classification training. More results are stated in Appendix A.4.

Datasets

  • Pretraining: The models were pretrained using the standard C4 (Colossal Clean Crawled Corpus) dataset, utilizing token allocations ranging from 13 billion (for smaller models) up to 52 billion tokens.
  • Evaluation: Downstream zero-shot evaluation was conducted using the EleutherAI/lm-evaluation benchmark, covering standard tasks such as ARC (Easy/Challenge), BoolQ, HellaSwag, OpenBookQA, Piqa, MMLU, WinoGrande, and SciQ.

Key Insights and Ideas

  • The Geometry of Language: When trained solely with cross-entropy, the average angle between embeddings of different token classes stabilizes around 61.3 degrees. Introducing SimReg widens this average angle to approximately 74 degrees, creating a much cleaner separation in high-dimensional space.
  • The Scaling Relationship: The optimal regularization weight ($\lambda$) is intrinsically tied to the embedding dimension ($d$). As the hidden size grows, embeddings naturally drift further apart in high-dimensional space. The authors provide a practical scaling heuristic: $\lambda \approx 10 \times \sqrt{d/1024}$.
  • Resource Neutrality: While contrastive losses are notoriously compute-heavy, applying SimReg chunk-wise at only the final layer results in less than a 2% increase in runtime and under 1% increase in GPU memory, making it practically free.

Key Results

  • 30%+ Training Speedup: Across LLaMA dense models ranging from 1.3B to 7B parameters, SimReg consistently accelerated training convergence, achieving speedups between 1.33× and 1.38×.
  • Downstream Performance Gains: SimReg outperformed standard cross-entropy and alternative consistency baselines (like SimCSE and CReg), improving average zero-shot downstream accuracy by +1.04% on LLaMA-350M and +1.14% on LLaMA-1.3B.
  • Architecture Agnostic: The method scales seamlessly to Mixture-of-Experts (MoE) architectures, netting a +1.28% average performance boost on Mixtral-8×1B.
Figure 3: Cross-entropy loss acceleration (upper) and contrastive similarity improvements (lower) in the pretraining. “CE" denotes the cross-entropy loss and “SR" denotes the similarity regularization loss. SIMREG loss helps to further reduce the contrastive similarity.

Limitations and Future Work

While SimReg demonstrates robust performance, the authors note a few areas for further exploration:

  • Hyperparameter Sensitivity: Although the authors provide a scaling formula for the coefficient $\lambda$, it still requires baseline calibration when transitioning to entirely new model architectures or hidden dimension scales.
  • Extreme Scale Validation: The experiments in this paper top out at 7B/8B parameter models trained on 52B tokens. Validating SimReg on frontier-scale models (hundreds of billions of parameters) and trillion-token datasets remains an open and necessary next step.

Summary updated

BibTeX
@inproceedings{sun2026simreg,
  author = {Yan Sun and Guoxia Wang and Jinle Zeng and JiaBin Yang and Shuai Li and Li Shen and Dacheng Tao and DianHai Yu and Haifeng Wang},
  title = {{SimReg: Achieving Higher Performance in the Pretraining via Embedding Similarity Regularization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=1BwcSDQLHJ},
}
Figure