[Paper Review] A Sentence is Worth 128 Pseudo Tokens: A Semantic-Aware Contrastive Learning Framework for Sentence Embeddings
This paper proposes PT-BERT, a semantic-aware contrastive learning framework that maps sentences into a fixed-length pseudo-token space to mitigate reliance on superficial features like sentence length and syntax. By using learnable pseudo token embeddings and an attention mechanism to align sentence representations, PT-BERT achieves state-of-the-art performance with 77.74% Spearman correlation on STS benchmarks, outperforming SimCSE and other baselines in alignment, uniformity, and hard example generalization.
Contrastive learning has shown great potential in unsupervised sentence embedding tasks, e.g., SimCSE. However, We find that these existing solutions are heavily affected by superficial features like the length of sentences or syntactic structures. In this paper, we propose a semantics-aware contrastive learning framework for sentence embeddings, termed Pseudo-Token BERT (PT-BERT), which is able to exploit the pseudo-token space (i.e., latent semantic space) representation of a sentence while eliminating the impact of superficial features such as sentence length and syntax. Specifically, we introduce an additional pseudo token embedding layer independent of the BERT encoder to map each sentence into a sequence of pseudo tokens in a fixed length. Leveraging these pseudo sequences, we are able to construct same-length positive and negative pairs based on the attention mechanism to perform contrastive learning. In addition, we utilize both the gradient-updating and momentum-updating encoders to encode instances while dynamically maintaining an additional queue to store the representation of sentence embeddings, enhancing the encoder's learning performance for negative examples. Experiments show that our model outperforms the state-of-the-art baselines on six standard semantic textual similarity (STS) tasks. Furthermore, experiments on alignments and uniformity losses, as well as hard examples with different sentence lengths and syntax, consistently verify the effectiveness of our method.
Motivation & Objective
- To address the over-reliance of existing contrastive learning methods on superficial sentence features such as length and syntax in sentence embedding tasks.
- To develop a framework that captures deep semantic representations by projecting sentences into a fixed-length pseudo-token space.
- To improve contrastive learning performance by enhancing positive pair construction and negative sample mining through momentum and queue mechanisms.
- To evaluate the model’s robustness on hard examples with significant length or syntactic differences.
- To demonstrate that semantic-aware representation learning leads to better alignment and uniformity in embedding space.
Proposed method
- Introduces a learnable pseudo token embedding layer independent of the BERT encoder to map each sentence into a fixed-length sequence of 128 pseudo tokens.
- Uses an attention mechanism to project sentence embeddings from BERT into the pseudo token space, enabling semantic-aware representation learning.
- Employs two BERT encoders: a gradient-updating encoder and a momentum-updating encoder to generate positive pairs via continuous augmentation.
- Maintains a dynamic queue of negative embeddings from the momentum encoder to improve contrastive learning stability and diversity.
- Leverages both alignment and uniformity losses to optimize the embedding space, minimizing distance between positive pairs and maximizing separation between negatives.
- Trains on 1 million Wikipedia sentences and evaluates on seven standard STS tasks, including hard examples with length and syntactic variation.
Experimental results
Research questions
- RQ1Can a fixed-length pseudo-token space reduce the model’s dependence on sentence length and syntactic structure in sentence embedding learning?
- RQ2How does the proposed semantic-aware contrastive learning framework improve performance on standard STS benchmarks compared to SimCSE and discrete augmentation methods?
- RQ3To what extent does the model generalize to hard examples with large length differences or minimal syntactic variation?
- RQ4Does the use of pseudo tokens lead to better alignment and uniformity in the embedding space compared to existing contrastive learning baselines?
- RQ5What is the optimal size of pseudo token sequences and queue size for balancing performance and model complexity?
Key findings
- PT-BERT achieves a new state-of-the-art Spearman correlation of 77.74% on standard STS benchmarks, outperforming SimCSE and other baselines.
- The model exhibits lower alignment and uniformity losses than SimCSE, indicating better optimization of the contrastive learning objective.
- On a sub-dataset of hard examples with length differences >5 words and low syntactic similarity, PT-BERT improves Spearman correlation by 3.36% over SimCSE.
- Ablation studies show that 128 pseudo tokens yield optimal performance, balancing semantic expressiveness and parameter efficiency.
- Queue size experiments indicate that performance stabilizes around q=4, suggesting sufficient negative sampling can be achieved with moderate queue size.
- The framework effectively reduces spurious correlations from sentence length and syntax, enabling more robust semantic representation learning.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.