finds.dev

huggingface/sentence-transformers

State-of-the-Art Embeddings, Retrieval, and Reranking

View on GitHubHomepage ↗

★ 18,827PythonApache-2.0updated Jun 2026

// the take

sentence-transformers is the de facto Python library for producing text embeddings using transformer models. It wraps HuggingFace transformers into a clean encode/similarity API and covers the full retrieval pipeline: dense bi-encoders, cross-encoder rerankers, and sparse SPLADE-style models. If you need embeddings in Python and aren't already using a vendor API, this is where you start.

The three-model-class design (SentenceTransformer, CrossEncoder, SparseEncoder) maps cleanly onto how real retrieval systems are actually built — fast bi-encoder for recall, slower cross-encoder for precision, sparse for keyword overlap. The 15,000+ pretrained models on HuggingFace hub means you rarely need to train from scratch. The loss function library is genuinely deep — 20+ options for embedding models — so you have real choices when fine-tuning on domain data rather than just using cosine with whatever pairs you have. ONNX and OpenVINO export paths exist and are documented, which matters a lot for production inference cost.

The library has grown by accretion and it shows — three parallel class hierarchies (SentenceTransformer, CrossEncoder, SparseEncoder) each with their own Trainer, TrainingArguments, and Evaluator classes means a lot of duplicated concepts and surface area to learn. Sparse encoder support is newer and visibly less polished than the dense path; the pretrained model selection is thin compared to the dense catalog. Batch size and pooling strategy interact in non-obvious ways with quality, and there's no guidance on this in the main docs — you find out by reading the loss-specific pages. The library pulls in a large dependency graph (PyTorch, transformers, tokenizers) with no lightweight CPU-only install path that avoids the full CUDA stack.

We read the README, the directory tree and a key source file in June 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
18,827
Forks
2,810
Language
Python
License
Apache-2.0
Last commit
18 Jun 2026

// nearby

If sentence-transformers isn't quite it.

All repos →