Sentence-transformers
Sentence Transformers is a Python library for computing dense embeddings of text and other inputs and training embedding models using transformer-based architectures.
Build an Advanced RAG Application (From Scratch)
Sentence Transformers is a software library and model framework for generating semantically meaningful vector representations of sentences and text.
- How it is used
- Builds semantic-search embeddings for documents, reviews, and free-form queries before similarity-based retrieval.
- How deep it goes
- Walks through installation, model loading, encoding, cosine ranking, CUDA placement, and scalable FAISS retrieval without detailing encoder internals.
- Examples
- Uses six toy sentences, a “Machine learning” query, and Paris hotel reviews for a Travelle hotel-search engine.
- What you can do after
- Apply it via SentenceTransformer to encode text, precompute review vectors, and rank query matches with similarity metrics.
Read how Build an Advanced RAG Application (From Scratch) explains sentence-transformers →
Domain-Specific Small Language Models
A library for producing dense text vectors with transformer encoders for embedding and similarity search.
- How it is used
- Produces document and query embeddings for similarity search in RAG pipelines.
- How deep it goes
- Works through model loading, chunk and query encoding, and similarity ranking without detailing encoder internals.
- Examples
- Uses PDF sentence chunks and a “blocked KV-cache” query, plus labeled superhero sentences searched through FAISS.
- What you can do after
- Apply it via SentenceTransformer to encode text and queries, then rank passages with cosine similarity or a FAISS index.
Read how Domain-Specific Small Language Models explains sentence-transformers →
AI-Powered Search
Sentence Transformers is a software library and collection of models for computing semantically meaningful vector representations of sentences and other text.
- How it is used
- Supports semantic search by representing sentences as dense vectors that can be compared and ranked by similarity.
- How deep it goes
- Explains pooling, training, embeddings, normalization, similarity calculation, and ranking, but defers detailed model architecture.
- Examples
- Uses weather and vehicle phrases, 768-dimensional embeddings, normalized vectors, pairwise scores, and a sorted similarity table.
- What you can do after
- Build it with Python by loading a pretrained model, encoding phrases, computing similarities, and ranking related text.
AI Recommender Systems
Sentence Transformers is a software library for computing semantically meaningful embeddings of sentences, texts, and other inputs with transformer models.
- How it is used
- Uses transformer-based content embeddings for similarity search, recommender retrieval, and scoring.
- How deep it goes
- Explains model purpose, installation, encoding, model comparison, cold-start value, and production cost trade-offs without detailing transformer internals.
- Examples
- Uses movie descriptions, the all-MiniLM-L6-v2 model, and labeled similar-versus-dissimilar item pairs.
- What you can do after
- Build content embeddings, evaluate candidate models, and apply them to similarity retrieval or recommender scoring.
Read how AI Recommender Systems explains sentence-transformers →
Also covered in
What to know first
- data frameA data frame is a two-dimensional tabular data structure organized into labeled rows and columns, often with columns that can contain different types of values.
Related concepts
- embeddingproduces · An embedding is a numerical vector representation of an item in a feature space, encoding selected properties or relationships for computational tasks such as comparison or retrieval.
- retrieval-augmented generationused by · Retrieval-augmented generation is a technique that retrieves relevant information from external sources and supplies it as context to a generative model when producing an output.
- all-mpnet-base-v2uses · all-mpnet-base-v2 is a pretrained sentence-embedding model that maps sentences and short passages to 768-dimensional vector representations.
- tokenizationuses · Tokenization is the process of dividing text into discrete units called tokens for computational processing.
Questions about sentence-transformers
What is sentence-transformers?
Sentence Transformers is a Python library for computing dense embeddings of text and other inputs and training embedding models using transformer-based architectures.
Which Manning books explain sentence-transformers?
Build an Advanced RAG Application (From Scratch), Domain-Specific Small Language Models, AI-Powered Search and AI Recommender Systems.
What should I know before learning sentence-transformers?
Manning books that teach sentence-transformers usually introduce data frame first.
What is the difference between sentence-transformers and world knowledge?
Sentence Transformers is a Python library for computing dense embeddings of text and other inputs and training embedding models using transformer-based architectures. World knowledge is general information about real-world entities, events, situations, concepts, and relationships.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



