sentence-transformers logo

sentence-transformers

Free

Contrastive / triplet / GISTEmbedLoss fine-tuning

FreeFree tier
Inputs: text
Type
Open Source
Company
Hugging Face

About sentence-transformers

Sentence Transformers is an open-source framework for computing state-of-the-art embeddings from sentences and texts, as well as for training and using embedding, reranker (Cross-Encoder), and sparse encoder models. It provides a simple Python API for accessing over 15,000 pre-trained models from Hugging Face, enabling applications such as semantic search, semantic textual similarity, and paraphrase mining. The framework also supports finetuning custom models for specific use cases.

Key Features

Compute dense embeddings using Sentence Transformer models
Calculate similarity scores with Cross-Encoder (reranker) models
Generate sparse embeddings using Sparse Encoder models
Train or finetune custom embedding, reranker, and sparse encoder models
Access over 15,000 pre-trained models available on Hugging Face
Supports semantic search, semantic textual similarity, and paraphrase mining

Pros & Cons

Pros
  • Open source and free to use
  • Easy-to-use Python API with quickstart examples
  • State-of-the-art performance on MTEB leaderboard
  • Supports multiple model types (dense, cross-encoder, sparse)
  • Large ecosystem of pre-trained models and active community
Cons
  • Requires Python and PyTorch installation
  • May require GPU for large-scale or real-time inference
  • Library complexity may be high for beginners new to embeddings

Best For

Semantic searchSemantic textual similarityParaphrase miningInformation retrieval and rerankingTraining custom embedding models for domain-specific tasks

FAQ

What is Sentence Transformers?
Sentence Transformers is an open-source framework for computing state-of-the-art embeddings for sentences and texts, and for training custom embedding, reranker, and sparse encoder models.
How do I install Sentence Transformers?
Install via pip: pip install -U sentence-transformers. Requires Python 3.10+, PyTorch 1.11.0+, and transformers v4.41.0+.
What types of models are available?
The framework supports Sentence Transformer (embedding) models, Cross-Encoder (reranker) models, and Sparse Encoder models. Over 15,000 pre-trained models are available on Hugging Face.