[论文解读] A Sentence is Worth 128 Pseudo Tokens: A Semantic-Aware Contrastive Learning Framework for Sentence Embeddings
该论文提出PT-BERT,一种语义感知的对比学习框架,通过将句子映射到固定长度的伪标记空间,减轻对句长和句法等表面特征的依赖。通过使用可学习的伪标记嵌入和注意力机制对齐句子表征,PT-BERT在STS基准测试中实现了77.74%的Spearman相关系数,达到最先进性能,在对齐性、均匀性和难例泛化能力方面优于SimCSE及其他基线模型。
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.
研究动机与目标
- 解决现有对比学习方法在句子嵌入任务中对句长和句法等表面句子特征的过度依赖问题。
- 开发一种通过将句子投影到固定长度的伪标记空间来捕捉深层语义表征的框架。
- 通过动量和队列机制改进正样本对构建与负样本挖掘,提升对比学习性能。
- 评估模型在具有显著句长或句法差异的难例上的鲁棒性。
- 证明语义感知的表征学习可提升嵌入空间中的对齐性和均匀性。
提出的方法
- 引入一个与BERT编码器无关的可学习伪标记嵌入层,将每个句子映射为128个伪标记的固定长度序列。
- 使用注意力机制将BERT生成的句子表征投影到伪标记空间,实现语义感知的表征学习。
- 采用两个BERT编码器:一个用于梯度更新的编码器和一个用于动量更新的编码器,通过连续增强生成正样本对。
- 维护一个来自动量编码器的动态负样本嵌入队列,以提升对比学习的稳定性和多样性。
- 同时利用对齐损失和均匀性损失优化嵌入空间,最小化正样本对之间的距离,最大化负样本之间的分离度。
- 在100万条维基百科句子上进行训练,并在七个标准STS任务上进行评估,包括具有句长和句法差异的难例。
实验结果
研究问题
- RQ1固定长度的伪标记空间是否能降低模型在句子嵌入学习中对句长和句法结构的依赖?
- RQ2与SimCSE及离散增强方法相比,所提出的语义感知对比学习框架在标准STS基准测试中的性能提升程度如何?
- RQ3该模型在具有显著句长差异或极低句法相似性的难例上泛化能力如何?
- RQ4与现有对比学习基线相比,使用伪标记是否能带来更好的嵌入空间对齐性和均匀性?
- RQ5在性能与模型复杂度之间取得平衡时,伪标记序列和队列的最佳尺寸是多少?
主要发现
- PT-BERT在标准STS基准测试中实现了77.74%的新SOTA Spearman相关系数,优于SimCSE及其他基线模型。
- 与SimCSE相比,该模型表现出更低的对齐损失和均匀性损失,表明其对对比学习目标的优化更优。
- 在包含句长差异超过5个词且句法相似度低的子数据集上,PT-BERT相比SimCSE将Spearman相关系数提升了3.36%。
- 消融实验表明,128个伪标记可实现最优性能,在语义表达力与参数效率之间达到最佳平衡。
- 队列大小实验表明,当队列大小q≈4时性能趋于稳定,表明中等大小的队列即可实现充分的负样本采样。
- 该框架有效降低了句长和句法带来的虚假相关性,实现了更鲁棒的语义表征学习。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。