Home Knowledge Base Sentence Transformers (SBERT)

Sentence Transformers (SBERT) is a Python library and framework for generating dense vector embeddings from sentences, paragraphs, and images — producing fixed-size numerical representations where semantically similar texts have similar vectors ("I love cats" and "I adore felines" produce vectors with high cosine similarity), making it the standard tool for semantic search, text clustering, duplicate detection, and RAG retrieval pipelines, with hundreds of pre-trained models available on HuggingFace Hub.

What Is Sentence Transformers?

Usage

from sentence_transformers import SentenceTransformer

model = SentenceTransformer('all-MiniLM-L6-v2')
embeddings = model.encode([
    "I love machine learning",
    "AI and deep learning are fascinating",
    "The weather is nice today"
])

# embeddings[0] and embeddings[1] will have high cosine similarity
# embeddings[0] and embeddings[2] will have low cosine similarity

Popular Models

ModelDimensionsSpeedQualityBest For
all-MiniLM-L6-v2384Very fastGoodGeneral purpose, production
all-mpnet-base-v2768ModerateBest (general)High-quality retrieval
multi-qa-MiniLM-L6-cos-v1384Very fastGood for QAQuestion-answering retrieval
paraphrase-multilingual-MiniLM-L12-v2384FastGoodMultilingual (50+ languages)
BAAI/bge-large-en-v1.51024SlowState-of-artWhen quality matters most

Key Applications

Sentence Transformers is the foundational library for text embeddings in production AI systems — providing the semantic understanding layer that powers search engines, RAG pipelines, recommendation systems, and text clustering, with pre-trained models that produce high-quality embeddings in a single line of Python code.

sentence transformerssbertpython

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.