liveBook · Manning

Sentence-transformers

As explained in AI Recommender Systems

Sentence Transformers is a software library for computing semantically meaningful embeddings of sentences, texts, and other inputs with transformer models.

Sentence Transformers is a library for generating semantically meaningful embeddings with transformer models. Unlike base BERT, which was not designed specifically for similarity search, its models are fine-tuned to place similar items near one another in vector space. section 3.4.1

A practical embedding workflow includes:

  • Install the package and load a model such as all-MiniLM-L6-v2. section 3.4.1
  • Encode item text, such as movie descriptions, into vectors for similarity-based retrieval or scoring. section 3.4.1 section 3.0
  • Compare candidate models with domain-specific pairs of similar and dissimilar items rather than assuming the default model is optimal. section 3.4.1

Movie similarity retrieval

Encode movie descriptions, then use their embeddings to find similar titles. Sentence Transformers supports new items immediately because it uses content metadata rather than requiring prior user interactions, helping address collaborative-filtering cold starts. section 3.7 section 3.0

Listing 3.10 Installing the sentence-transformers
pip install sentence-transformers #A

Use the installation listing as the minimal setup step before creating embeddings. section 3.4.1

How AI Recommender Systems covers it

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 it assumes
Assumes familiarity with embeddings and recommendation stages while grounding the implementation in a simple install-and-encode workflow.
What you can do after
Build content embeddings, evaluate candidate models, and apply them to similarity retrieval or recommender scoring.
How it connects
Connects BERT, embeddings, similarity search, content-based recommendation, collaborative filtering, cold start, and hybrid retrieval.

Also explained in

Compare how 4 books explain sentence-transformers →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Recommender Systems. The section links point to the parts of the book it draws on.