Triplet loss is an optimization objective for training sentence embeddings to represent semantic relationships. It improves a siamese network’s training rather than defining a separate network architecture. section 2.3.1
The objective organizes training around three inputs:
- Anchor: the reference sentence being represented. section 2.3.1
- Positive: a sentence similar to the anchor, whose embedding should move closer. section 2.3.1
- Negative: a dissimilar sentence, whose embedding should move farther from the anchor. section 2.3.1
Shared subnetworks independently encode the sentences, while training minimizes anchor–positive distance and maximizes anchor–negative distance. SBERT uses this arrangement to produce embeddings suited to semantic textual similarity. section 2.3.1
Figure 2.6 A distinction between Bert (on the left) and Sentence-Bert (on the right) lies in their approach to semantic textual similarity. In BERT, the two sentences are initially concatenated and then fed into the network. Subsequently, the similarity is computed using the activation function. Conversely, in Sentence-Bert, the two sentences are independently input into Bert, and their cosine similarity is then calculated.
Compare BERT’s concatenated sentence processing with Sentence-BERT’s independent encoding and cosine-similarity calculation. section 2.3.1

