Skip to main content
QUICK REVIEW

[Paper Review] Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks

Nils Reimers, Iryna Gurevych|TUbilio (Technical University of Darmstadt)|Aug 27, 2019
Topic ModelingComputer Science38 references88 citations
TL;DR

SBERT fine-tunes BERT with siamese/triplet architectures to produce fixed-size sentence embeddings, enabling fast cosine-based semantic similarity, clustering, and retrieval while preserving strong accuracy.

ABSTRACT

BERT (Devlin et al., 2018) and RoBERTa (Liu et al., 2019) has set a new state-of-the-art performance on sentence-pair regression tasks like semantic textual similarity (STS). However, it requires that both sentences are fed into the network, which causes a massive computational overhead: Finding the most similar pair in a collection of 10,000 sentences requires about 50 million inference computations (~65 hours) with BERT. The construction of BERT makes it unsuitable for semantic similarity search as well as for unsupervised tasks like clustering. In this publication, we present Sentence-BERT (SBERT), a modification of the pretrained BERT network that use siamese and triplet network structures to derive semantically meaningful sentence embeddings that can be compared using cosine-similarity. This reduces the effort for finding the most similar pair from 65 hours with BERT / RoBERTa to about 5 seconds with SBERT, while maintaining the accuracy from BERT. We evaluate SBERT and SRoBERTa on common STS tasks and transfer learning tasks, where it outperforms other state-of-the-art sentence embeddings methods.

Motivation & Objective

  • Motivate the need for efficient semantic similarity and retrieval over large sentence collections.
  • Propose a modification of BERT that yields fixed-size sentence embeddings suitable for fast similarity search.
  • Demonstrate that SBERT maintains or improves state-of-the-art performance on STS and related benchmarks.
  • Show computational advantages of SBERT over standard BERT in large-scale tasks.

Proposed method

  • Use siamese and triplet network structures to fine-tune pretrained BERT/RoBERTa for sentence embeddings.
  • Apply pooling over BERT outputs (MEAN, CLS, MAX) to obtain fixed-size sentence vectors (default MEAN).
  • Optimize with classification, regression, or triplet objectives to ensure semantically meaningful embeddings.
  • Compute cosine similarity between sentence embeddings for semantic relatedness tasks.
  • Train on SNLI and MultiNLI (NLI data) then fine-tune on STSb (or NLI + STSb) for improved performance.
  • Evaluate using STS tasks, AFS, and SentEval to assess generalization and transfer.

Experimental results

Research questions

  • RQ1Can SBERT produce semantically meaningful sentence embeddings suitable for cosine-based similarity measures?
  • RQ2Does fine-tuning BERT with siamese/triplet objectives improve performance on STS and related benchmarks compared to prior sentence-embedding methods?
  • RQ3How do pooling strategies and objective choices affect embedding quality and downstream tasks?
  • RQ4What is the computational advantage of SBERT over cross-encoder BERT for large-scale similarity search and clustering?

Key findings

  • SBERT substantially improves STS correlations versus raw BERT, InferSent, and Universal Sentence Encoder on several STS datasets.
  • On STSb, SBERT-NLI-base achieves 77.03 and SBERT-NLI-large achieves 79.23 with STSb training setups, approaching or matching state-of-the-art.
  • SBERT outperforms many baselines on SentEval transfer tasks, with notable gains on sentiment-related tasks.
  • In AFS cross-topic settings, SBERT approaches BERT in 10-fold CV but shows larger gaps in cross-topic generalization, highlighting domain challenges.
  • SBERT-WikiSec triplet results outperform previous BiLSTM triplet approaches on Wikipedia section data.
  • SBERT provides significant computational efficiency gains, enabling rapid similarity search and clustering at scale.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.