sentence-transformers
Embeddings, Retrieval, and Reranking
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and provides a well-established interface to state-of-the-art embedding and reranking models. It's the standard choice for semantic search and text similarity tasks in Python. Install it if you need embeddings or reranking; the only gotcha is ensuring your environment has torch and the required Python version (3.10+).AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10+, PyTorch 1.11.0+, and transformers v4.41.0+; models are downloaded from Hugging Face Hub on first use.
- Low friction install with a pure-Python wheel.
- Active maintenance with a recent release and strong community backing.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most production and research contexts.
last release 2026-08-06 (8 days) · last repo commit 2026-08-13 · 19,000 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 30,596,728 downloads/mo, #798 on PyPI
Alternatives
Verify before relying
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
embeddings = model.encode(["Hello world", "Hi there"])
similarities = model.similarity(embeddings, embeddings)- Whether pre-trained models are automatically cached locally or require explicit download management
- GPU memory requirements for different model sizes and batch processing
- Performance characteristics when encoding large document collections
What it is and what it does
Sentence Transformers is a framework for computing dense embeddings and reranking scores from text using transformer-based models. It wraps the transformers library to provide three main workflows: encoding text into fixed-size embeddings via SentenceTransformer models, scoring query-passage pairs via CrossEncoder reranker models, and generating sparse embeddings via SparseEncoder models. The framework ships with access to pre-trained models hosted on Hugging Face, covering many languages and specialized use cases.
The package is built on top of transformers, tokenizers, torch, and scikit-learn, handling model loading, batching, and similarity computation. It's designed for tasks like semantic search (finding similar documents), semantic textual similarity (measuring how alike two texts are), and paraphrase mining. You can also fine-tune models on your own data for task-specific embeddings. The framework abstracts away much of the boilerplate around tokenization and tensor operations, making it accessible for developers who need embeddings but don't want to write low-level transformer code.
Use it for
- Build a semantic search engine to find documents similar to a query by encoding a corpus and comparing embeddings
- Rank search results or passages by relevance using a CrossEncoder reranker model to refine initial retrieval
- Compute semantic similarity scores between pairs of texts for deduplication, clustering, or matching tasks
- Fine-tune a model on labeled text pairs to create domain-specific embeddings for specialized use cases
- Mine paraphrases or near-duplicate texts by encoding a large corpus and finding high-similarity pairs
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, installs with low friction, and provides a well-established interface to state-of-the-art embedding and reranking models. It's the standard choice for semantic search and text similarity tasks in Python. Install it if you need embeddings or reranking; the only gotcha is ensuring your environment has torch and the required Python version (3.10+).
Install
sentence-transformers on PyPI
Before you install
Low friction install with a pure-Python wheel. Active maintenance with a recent release and strong community backing. Requires torch and transformers as runtime dependencies, which are substantial but standard for deep learning work.
Requires Python 3.10+, PyTorch 1.11.0+, and transformers v4.41.0+; models are downloaded from Hugging Face Hub on first use.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most production and research contexts.
Quickstart
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
embeddings = model.encode(["Hello world", "Hi there"])
similarities = model.similarity(embeddings, embeddings)
Verify before relying
- Whether pre-trained models are automatically cached locally or require explicit download management
- GPU memory requirements for different model sizes and batch processing
- Performance characteristics when encoding large document collections
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 9 packagestransformerstokenizershuggingface-hubtorchnumpyscikit-learnscipytyping_extensionstqdm |
| Maintenance | Actively maintained 8 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 30,596,728 / month, #798 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: sentence_transformers-5.7.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “semantic search embeddings”
- sentence-transformersComputes embeddings and reranking scores for text using pre-trained…
- FlagEmbeddingFlagEmbedding provides embedding and reranking models for semantic…
- llama-index-embeddings-azure-openaiIntegrates Azure OpenAI's embedding models with LlamaIndex, enabling…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also bert-score · flair · InstructorEmbedding · model2vec · pinecone-text · spacy-transformers · voyageai · mteb · transformer-smaller-training-vocab · fair-esm