SBERT.net Embedding, Search & Retrieval Models Last Updated: July 2026

Sentence Transformers: Complete Guide — Architecture, MTEB Benchmarks, Fine-Tuning, Models & RAG 2026

Sentence Transformers reviewall-MiniLM-L6-v2SBERT embedding modelsentence-transformers libraryall-mpnet-base-v2

Model Overview

Sentence Transformers (SBERT) is an open-source framework and family of text embedding models developed by the SBERT.net team (Nils Reimers and Iryna Gurevych), first released in 2019. The framework provides hundreds of pre-trained models including the popular all-MiniLM-L6-v2 (384 dimensions, 61.0 MTEB) and all-mpnet-base-v2 (768 dimensions, 63.0 MTEB). Sentence Transformers belongs to the text embedding model category and solves the problem of measuring semantic similarity between text with a framework that is the gold standard for fine-tuning and custom embedding training. It is designed for developers building custom semantic search systems, domain-specific RAG pipelines, and research applications requiring full control over the embedding training process. Its key differentiators are the sentence-transformers Python library (the most popular embedding framework with 10M+ downloads), highly fine-tunable BERT-based architectures, and the largest collection of pre-trained embedding models (400+ models on Hugging Face). In 2026, Sentence Transformers remains the foundational framework for custom embedding development, with models like BGE and E5 themselves built on and distributed through the sentence-transformers ecosystem.

Need help choosing the right LLM for your project?

Our AI experts will help you select, integrate, and deploy the best model for your use case.

Book a Free Consultation →

Architecture & Technical Deep Dive

Sentence Transformers uses a BERT-based encoder architecture with a pooling layer added on top to produce fixed-dimensional sentence embeddings. The framework supports hundreds of backbone architectures including BERT, RoBERTa, MiniLM, MPNet, and DistilBERT, making it the most flexible embedding framework available.

Core Architecture

Sentence Transformers adds a pooling layer on top of standard transformer encoders. The backbone (e.g., BERT, MPNet, MiniLM) processes input tokens and produces contextualized token embeddings. The pooling layer then combines these token embeddings into a single sentence embedding via mean pooling (average of all token embeddings), max pooling (element-wise maximum), or CLS pooling (the [CLS] token embedding). Mean pooling is the default and most common. For example, all-MiniLM-L6-v2 uses MiniLM with 6 layers, 384 hidden dimensions, and 22M parameters; all-mpnet-base-v2 uses MPNet with 12 layers, 768 hidden dimensions, and 110M parameters.

Training Methodology

Sentence Transformers models are trained using contrastive learning objectives. The framework supports multiple loss functions: CosineSimilarityLoss for semantic similarity, MultipleNegativesRankingLoss for retrieval (InformationNCE), ContrastiveLoss for pair classification, and TripletLoss for ranking. Training data can be labeled pairs (sentence A, sentence B, similarity score), triplets (anchor, positive, negative), or unlabeled in-batch negatives. The framework's flexibility in loss functions and data formats makes it the most customizable embedding training toolkit.

Model Ecosystem

The Sentence Transformers ecosystem includes 400+ pre-trained models on Hugging Face, categorized as: general-purpose (all-* prefix, trained on 1B+ pairs), semantic search (msmarco-*, trained on MS MARCO), multilingual (paraphrase-multilingual-*, 50+ languages), domain-specific (legal, scientific, financial), and small/edge (MiniLM, DistilBERT). Popular models include all-MiniLM-L6-v2 (384 dims, fast, 61.0 MTEB), all-mpnet-base-v2 (768 dims, best general-purpose, 63.0 MTEB), and paraphrase-multilingual-MiniLM-L12-v2 (384 dims, 50+ languages). The framework also hosts BGE, E5, and Jina models — all compatible with the sentence-transformers API.

Fine-Tuning Flexibility

Sentence Transformers is the gold standard for embedding fine-tuning. The framework supports: (1) full fine-tuning — update all model parameters, (2) LoRA/PEFT — parameter-efficient fine-tuning with 8GB VRAM, (3) custom loss functions — implement your own contrastive loss, (4) custom architectures — swap backbones, pooling layers, or add projection heads, (5) multi-task training — train on multiple datasets with different losses simultaneously. The sentence-transformers library provides extensive documentation, tutorials, and examples for all fine-tuning scenarios, making it the most accessible framework for custom embedding development.

Inference Requirements

Sentence Transformers models can be self-hosted on modest hardware. all-MiniLM-L6-v2 requires 90MB VRAM and runs on any device with 1GB RAM, including smartphones and Raspberry Pi. all-mpnet-base-v2 requires 440MB VRAM and runs on any GPU with 2GB+ VRAM or CPU with 4GB RAM. Inference latency: 5-20ms per request on GPU, 10-50ms on CPU for MiniLM. Throughput: 5,000+ embeddings/second on a single A100 for MiniLM. For production, use Hugging Face Text Embeddings Inference (TEI) server or the sentence-transformers library with batch encoding.

MTEB Benchmark Performance & Scores

Scores based on publicly available data as of July 2026. Independent verification recommended.

MTEB Benchmark Comparison

Scroll horizontally →
Benchmarkall-mpnet-base-v2all-MiniLM-L6-v2paraphrase-multilingual-MiniLMbge-large-en-v1.5
MTEB Average63.061.060.563.5
Retrieval (NFC)49.847.246.553.0
STS (Semantic Similarity)68.266.565.867.8
Classification72.570.869.273.1
Clustering48.546.845.549.7
Pair Classification85.583.282.086.0
Reranking56.854.553.258.3
Summarization64.562.861.565.8
Bitext Mining67.064.570.268.2

Speed & Throughput

Latency: 5-20ms per request on GPU (MiniLM), 10-50ms on CPU. all-MiniLM-L6-v2 runs at 5,000+ embeddings/second on A100 and 500+ embeddings/second on CPU. Throughput: 5,000+ embeddings/second on a single A100 for MiniLM, 2,000+ for mpnet. For production, use Hugging Face Text Embeddings Inference (TEI) server for optimized batch processing. MiniLM models are ideal for edge and on-device deployment.

Speed & Latency

Latency: 5-20ms per request on GPU (MiniLM), 10-50ms on CPU. all-MiniLM-L6-v2 runs at 5,000+ embeddings/second on A100 and 500+ embeddings/second on CPU. Throughput: 5,000+ embeddings/second on a single A100 for MiniLM, 2,000+ for mpnet. For production, use Hugging Face Text Embeddings Inference (TEI) server for optimized batch processing. MiniLM models are ideal for edge and on-device deployment.

API Access, Pricing & Integration Guide

Looking for all-MiniLM-L6-v2 API pricing in 2026? Below is the complete pricing table, code examples, and integration guide.

API Pricing Table (as of July 2026)

ModelPrice (per 1M tokens)DimensionsBest For
all-MiniLM-L6-v2 (self-hosted)Free384Fast, edge deployment
all-mpnet-base-v2 (self-hosted)Free768Best general-purpose
paraphrase-multilingual-MiniLM (self-hosted)Free384Multilingual
all-mpnet (Hugging Face API)$0.19768Managed inference

Free Tier & Trial Access

Sentence Transformers models are completely free when self-hosted under the Apache 2.0 license — no API calls, no token limits, no rate limits. Hugging Face Inference API offers a free tier for testing. The only cost is compute hardware for self-hosting. MiniLM models are so small they can run on any device, including smartphones and Raspberry Pi.

API Quick Start

# Install sentence-transformers
pip install sentence-transformers

from sentence_transformers import SentenceTransformer, InputExample, losses
from torch.utils.data import DataLoader

# Load pre-trained model
model = SentenceTransformer('all-MiniLM-L6-v2')

# Generate embeddings
documents = [
    "Machine learning is fascinating",
    "AI transforms industries",
    "I love pizza"
]
doc_embeddings = model.encode(documents, normalize_embeddings=True)

query = "What is AI?"
query_embedding = model.encode([query], normalize_embeddings=True)[0]

# Compute similarity
import numpy as np
sims = np.dot(doc_embeddings, query_embedding)
print(f"Similarities: {sims}")

# Fine-tune on custom data
train_examples = [
    InputExample(texts=["What is AI?", "Artificial intelligence is ..."], label=0.9),
    InputExample(texts=["I love pizza", "Machine learning is ..."], label=0.1),
]
train_dataloader = DataLoader(train_examples, shuffle=True, batch_size=16)
train_loss = losses.CosineSimilarityLoss(model)
model.fit(train_objectives=[(train_dataloader, train_loss)], epochs=1)

Supported API Features

Self-hosted (free) Yes
Fine-tuning (full) Yes
Fine-tuning (LoRA/PEFT) Yes
Custom loss functions Yes
Custom architectures Yes
400+ pre-trained models Yes
Multilingual models Yes (50+ languages)
Edge deployment (MiniLM) Yes (90MB VRAM)

Compatible Platforms & Integrations

Hugging Facesentence-transformersLangChainLlamaIndexPineconeWeaviateQdrantChromapgvectorMilvusAnyscaleVercel AI SDK

Want to integrate all-MiniLM-L6-v2 into your product?

Our engineers help you architect, build, and deploy AI-powered features with production-grade reliability.

Talk to Our Engineers →

Fine-Tuning, RAG & Advanced Use

Fine-Tuning Availability

Sentence Transformers is the gold standard for embedding fine-tuning. The framework supports full fine-tuning, LoRA/PEFT fine-tuning, custom loss functions, custom architectures, and multi-task training. Full fine-tuning requires 8GB+ VRAM and 500+ labeled pairs. LoRA fine-tuning requires 4GB+ VRAM and 200+ pairs. The sentence-transformers library provides extensive documentation, tutorials, and examples for all fine-tuning scenarios. Fine-tuned SBERT models can outperform commercial APIs on domain-specific tasks by 10-20%.

Fine-Tuning Requirements

Full fine-tuning: 8GB+ VRAM (RTX 3060 or better), 500+ labeled text pairs, sentence-transformers library, 1-4 hours training time. LoRA fine-tuning: 4GB+ VRAM, 200+ pairs, 30 minutes training time. Recommended loss: MultipleNegativesRankingLoss for retrieval (needs query-positive pairs), CosineSimilarityLoss for similarity (needs text pairs with scores), TripletLoss for ranking (needs anchor-positive-negative triples). The framework supports in-batch negatives, hard-negative mining, and contrastive learning curricula.

Fine-Tuning Use Cases

  • Custom embedding training — train domain-specific embeddings from scratch or fine-tune pre-trained models on your data
  • Semantic search — use pre-trained all-mpnet-base-v2 or fine-tune on domain query-document pairs
  • RAG pipeline embedding layer — embed documents and queries with fine-tuned SBERT for domain-specific retrieval
  • Edge deployment — use all-MiniLM-L6-v2 (90MB) for on-device embedding on smartphones, IoT, or Raspberry Pi
  • Research and experimentation — full control over architecture, loss, and training enables novel embedding research

RAG Integration Guide

Sentence Transformers is excellent for custom RAG. Recommended architecture: Documents → Chunker (256-512 tokens) → all-mpnet-base-v2 or fine-tuned SBERT (self-hosted via TEI) → Vector DB (Qdrant, Milvus, Chroma, pgvector) → Query embedder → Retriever → LLM. For domain-specific RAG, fine-tune SBERT on domain query-document pairs with MultipleNegativesRankingLoss before indexing. For edge RAG, use all-MiniLM-L6-v2 for on-device embedding. The sentence-transformers framework is the most flexible foundation for custom RAG embedding layers.

Prompt Engineering Tips

  • Use all-mpnet-base-v2 for best general-purpose quality (63.0 MTEB); all-MiniLM-L6-v2 for speed (61.0 MTEB)
  • Fine-tune with MultipleNegativesRankingLoss on 500+ domain query-document pairs for 10-20% retrieval improvement
  • Use normalize_embeddings=True for cosine similarity via dot product
  • Chunk documents at 256-512 tokens with 50-100 token overlap
  • Use all-MiniLM-L6-v2 for edge deployment — 90MB, runs on smartphones and Raspberry Pi
  • Use Hugging Face TEI server for production deployment — optimized for batch embedding inference
  • Experiment with different backbone architectures (BERT, MPNet, MiniLM, DistilBERT) for quality/speed trade-offs

Use Cases, Strengths & Limitations

Top 10 Real-World Use Cases

1

Custom Embedding Training

Train domain-specific embeddings from scratch or fine-tune pre-trained models. The gold standard framework for custom embedding development with full control over architecture and training.

2

Semantic Search Engine

Use pre-trained all-mpnet-base-v2 or fine-tune on domain query-document pairs for semantic search. The most flexible foundation for custom search systems.

3

Domain-Specific RAG Pipeline

Fine-tune SBERT on domain query-document pairs for 10-20% retrieval improvement over generic models. Critical for legal, medical, and financial RAG.

4

Edge & On-Device Embedding

Use all-MiniLM-L6-v2 (90MB) for on-device embedding on smartphones, IoT devices, or Raspberry Pi. Enables offline semantic search.

5

Research & Experimentation

Full control over architecture, loss functions, and training enables novel embedding research. The most popular framework in academic embedding papers.

6

Multilingual Semantic Search

Use paraphrase-multilingual-MiniLM-L12-v2 for cross-lingual retrieval across 50+ languages with a small, fast model.

7

Document Clustering & Classification

Cluster and classify documents using SBERT embeddings. The framework's flexibility enables custom clustering and classification pipelines.

8

Duplicate Detection

Identify near-duplicate documents at scale using SBERT embeddings. Common for content moderation and data cleaning.

9

Question Answering Systems

Embed question-document pairs to find relevant answer passages. Fine-tune on domain QA data for best results.

10

Recommendation Systems

Recommend content based on SBERT embedding similarity to user history. Fine-tune on user-item interaction data.

11

Educational Use

The sentence-transformers framework is the most popular teaching tool for embedding concepts, with extensive documentation and tutorials.

12

Custom Architecture Research

Swap backbones, pooling layers, or add projection heads for specialized embedding architectures. The framework supports full architectural customization.

Strengths

  • Most Customizable Framework — full control over architecture, loss functions, and training methodology
  • 400+ Pre-trained Models — largest collection of embedding models on Hugging Face
  • Highly Fine-Tunable — full, LoRA, custom loss, and multi-task fine-tuning all supported
  • Edge Deployment — MiniLM models run on smartphones and Raspberry Pi (90MB)
  • Apache 2.0 License — free commercial use, modification, and distribution
  • Local Deployment — self-host with zero external API calls
  • Extensive Documentation — the most well-documented embedding framework with tutorials and examples
  • Community Ecosystem — 10M+ downloads, hosts BGE, E5, and Jina models

Limitations & Weaknesses

  • Lower MTEB Than Specialized Models — 63.0 (mpnet) vs 63.5 (BGE) and 64.6 (OpenAI); general-purpose models are not optimized for retrieval
  • 128-512 Token Input Limit — shorter than OpenAI (8,191) and Jina (8,192), requiring chunking
  • Self-Hosting Overhead — requires GPU/CPU infrastructure and DevOps for production deployment
  • Framework Complexity — 400+ models and many options can be overwhelming; requires expertise to choose the right model
  • Retrieval Not Optimized — all-* models are general-purpose; for retrieval, fine-tune or use BGE/E5
  • No Managed API (Free) — Hugging Face API costs $0.19/1M; self-hosting requires hardware
  • No Multimodal — text-only; for multimodal, use CLIP-based models (available in sentence-transformers)

Who Should Use This Model

Best For

  • Teams that need custom fine-tuned embeddings for domain-specific retrieval with full control over training
  • Edge and on-device applications requiring small, fast embeddings (MiniLM, 90MB)
  • Researchers and educators who need a flexible, well-documented framework for embedding experimentation

Not Ideal For

  • Applications needing maximum out-of-the-box retrieval quality — consider BGE or OpenAI
  • Teams wanting managed API without infrastructure overhead — consider OpenAI or Cohere
  • Applications needing long document embedding (>512 tokens) — consider OpenAI or Jina

Alternatives, Comparisons & Verdict

Top Alternatives

ModelMTEB AvgOpen SourceDimensionsPrice/1M tokBest For
all-mpnet-base-v263.0Yes (Apache 2.0)768FreeGeneral-purpose
all-MiniLM-L6-v261.0Yes (Apache 2.0)384FreeEdge, fast
bge-large-en-v1.563.5Yes (Apache 2.0)1,024FreeRetrieval-optimized
text-embedding-3-large64.6No3,072$0.13Production quality
E5-large-v262.0Yes (MIT)1,024FreeResearch, fine-tuning
Jina Embeddings v364.8Yes (Apache 2.0)1,024Free8K context

Detailed Comparison

Sentence Transformers (all-mpnet-base-v2) vs BGE-large: BGE scores higher (63.5 vs 63.0 MTEB) and is optimized for retrieval with instruction tuning. SBERT all-mpnet is general-purpose and not retrieval-optimized. However, SBERT is the framework BGE is built on — you can use BGE via sentence-transformers. Choose BGE for retrieval, SBERT all-mpnet for general-purpose similarity. Sentence Transformers vs OpenAI: SBERT is free/open-source, fine-tunable, and runs locally. OpenAI scores higher (64.6 vs 63.0 MTEB) and has flexible dimensions and 8K context. SBERT is fine-tunable; OpenAI is not. SBERT is free; OpenAI costs $0.13/1M. Choose SBERT for custom fine-tuning and privacy, OpenAI for convenience and maximum quality.

Our Verdict

Sentence Transformers is the foundational framework for custom embedding development in 2026. Its unmatched flexibility, 400+ pre-trained models, and fine-tuning capabilities make it the gold standard for domain-specific and research applications. Choose Sentence Transformers for custom fine-tuning and edge deployment, BGE for retrieval-optimized open-source, or OpenAI for maximum out-of-the-box quality.

Overall Rating 8.5 / 10
MTEB Performance 7.8 / 10
Multilingual Quality 7.5 / 10
API & Integration 9.0 / 10
Value for Money 10 / 10
Fine-Tuning 10 / 10
Local Deployment 10 / 10

Internal Links

Frequently Asked Questions

What is the best Sentence Transformers model?

For general-purpose semantic similarity, all-mpnet-base-v2 (768 dims, 63.0 MTEB) is the best. For speed and edge deployment, all-MiniLM-L6-v2 (384 dims, 61.0 MTEB, 90MB) is the best. For retrieval, use BGE-large (also available via sentence-transformers) or fine-tune all-mpnet on query-document pairs. For multilingual, use paraphrase-multilingual-MiniLM-L12-v2 (50+ languages).

What is the MTEB score of Sentence Transformers models?

all-mpnet-base-v2 achieves a 63.0 MTEB average. all-MiniLM-L6-v2 achieves 61.0. paraphrase-multilingual-MiniLM-L12-v2 achieves 60.5. These are general-purpose models; for retrieval-optimized embeddings, use BGE (63.5) or E5 (62.0), both available via the sentence-transformers library.

How do I fine-tune Sentence Transformers on my own data?

Use the sentence-transformers library with MultipleNegativesRankingLoss for retrieval (query-positive pairs), CosineSimilarityLoss for similarity (text pairs with scores), or TripletLoss for ranking (anchor-positive-negative triples). Full fine-tuning requires 8GB+ VRAM and 500+ pairs. LoRA fine-tuning requires 4GB+ VRAM and 200+ pairs. The library provides extensive documentation and examples.

Can Sentence Transformers run on CPU or edge devices?

Yes. all-MiniLM-L6-v2 is only 90MB and runs on any device with 1GB RAM, including smartphones and Raspberry Pi, at 500+ embeddings/second on CPU. all-mpnet-base-v2 requires 440MB and runs on CPU with 4GB RAM. Use FP16 or INT8 quantization for further size reduction. MiniLM models are ideal for offline, on-device semantic search.

What is the difference between Sentence Transformers and BGE/E5?

Sentence Transformers is a framework that hosts 400+ models including BGE and E5. BGE and E5 are specific models built on the sentence-transformers framework. all-mpnet and all-MiniLM are general-purpose SBERT models. BGE is retrieval-optimized with instruction tuning; E5 is trained with weakly-supervised contrastive learning. You can use all of them via the sentence-transformers library.

How many models are available in Sentence Transformers?

Over 400 pre-trained models are available on Hugging Face, including general-purpose (all-*), semantic search (msmarco-*), multilingual (paraphrase-multilingual-*), domain-specific (legal, scientific, financial), small/edge (MiniLM, DistilBERT), and models from BGE, E5, and Jina. The sentence-transformers library is compatible with all of them.

How does Sentence Transformers compare to OpenAI embeddings?

SBERT is free/open-source, fine-tunable, and runs locally. OpenAI scores higher (64.6 vs 63.0 MTEB for all-mpnet) and has flexible dimensions and 8K context. SBERT is fine-tunable; OpenAI is not. SBERT is free; OpenAI costs $0.13/1M tokens. Choose SBERT for custom fine-tuning, privacy, and edge deployment; OpenAI for convenience and maximum quality.

What loss function should I use for fine-tuning?

Use MultipleNegativesRankingLoss for retrieval (needs query-positive pairs, uses in-batch negatives), CosineSimilarityLoss for semantic similarity (needs text pairs with similarity scores 0-1), TripletLoss for ranking (needs anchor-positive-negative triples), or ContrastiveLoss for pair classification. The sentence-transformers library supports custom loss functions for specialized use cases.

How do I deploy Sentence Transformers in production?

Use Hugging Face Text Embeddings Inference (TEI) server for optimized production deployment. TEI supports batch processing, FP16 inference, and optimized tokenization. Deploy on a GPU instance or CPU for MiniLM models. Pair with a self-hosted vector DB (Qdrant, Milvus, Chroma) and any LLM for a fully open-source RAG pipeline. For edge deployment, use MiniLM models directly on-device.

Compliance, Ethics & Responsible Use

Data Privacy & Compliance

Sentence Transformers models are self-hosted — no data leaves your infrastructure. This provides full data sovereignty, air-gapped deployment capability, and zero external API calls. Suitable for HIPAA, FedRAMP, SOC 2, and GDPR compliance when deployed in compliant infrastructure. No data retention by third parties. MiniLM models are small enough to run entirely on-device, enabling offline privacy-preserving semantic search. For managed inference, Hugging Face has its own data policies — review before use.

Ethical Use Guidelines

As an open-source framework, Sentence Transformers' ethical considerations include: (1) bias in embeddings — models are trained on web data that may reflect societal biases, affecting search fairness, (2) dual-use — embedding-based search could enable surveillance, but self-hosting gives organizations full control, (3) transparency — all model weights, training code, and documentation are published, enabling bias auditing. The SBERT.net team publishes model cards and training documentation for all models. Organizations should audit embeddings for bias in domain-specific applications, especially when fine-tuning on custom data.

Commercial Licensing Summary

Use CaseFree TierPaid PlanEnterprise
Personal useYes (free)YesYes
Commercial contentYes (free)YesYes
Product integrationYes (free)YesYes
White-labellingYes (free)YesYes
Reselling API serviceYes (free)YesYes
Training other modelsYes (free)YesYes

Enterprise Compliance Checklist

GDPR compliant data processing (yes — self-hosted, no external data transfer)
HIPAA compliance (yes — self-hosted in compliant infrastructure)
On-premise or VPC deployment option (yes — self-hosted is the default)
Data residency control (yes — full control via self-hosting)
SOC 2 Type II certified (yes — when deployed in SOC 2 infrastructure)
SLA guaranteed uptime (self-managed — depends on your infrastructure)
Role-based access control (self-managed — depends on your deployment)
Audit logs available (self-managed — depends on your deployment)
Content moderation & safety filters (no built-in — add your own input filtering)
Terms permit commercial use at required scale (yes — Apache 2.0, no restrictions)

Want to master all-MiniLM-L6-v2?

Explore our LLM training programs and become an expert in deploying and fine-tuning AI models.

Explore Training Programs →

Changelog

July 2026Initial comprehensive guide published. Benchmark scores, API pricing, and feature comparisons updated.
Next UpdateQuarterly review scheduled — pricing and benchmark scores will be refreshed.