liveBook · Manning

All-mpnet-base-v2

As explained in AI-Powered Search

all-mpnet-base-v2 is a pretrained sentence-embedding model that maps sentences and short passages to 768-dimensional vectors.

all-mpnet-base-v2 is a general-purpose sentence-embedding model for semantic search and clustering. It maps sentences and short passages to 768-dimensional vectors whose dimensions encode learned latent features. section 9.4.1

A search pipeline uses the model to:

  • Encode product names or other text into embeddings. section 9.4.1
  • Compare vectors to estimate semantic similarity. section 9.4.1
  • Cache generated embeddings when processing a larger product collection. section 9.4.1
Listing 9.12 Generating product embeddings
from sentence_transformers import SentenceTransformer  #1
transformer = SentenceTransformer("all-mpnet-base-v2")  #1
...  #2

def get_embeddings(texts, model, cache_name, ignore_cache=False):
  ...  #2
    embeddings = model.encode(texts)  #3
  ... #2
  return embeddings

product_embeddings = get_embeddings(product_names,
 transformer, cache_name="all_product_embeddings")

The implementation shows how SentenceTransformers loads the model and encodes product names into reusable embedding vectors. section 9.4.1

How AI-Powered Search covers it

How deep it goes
Explains latent dimensions and embedding generation, but does not detail the neural architecture or training procedure.
Examples
Uses product names from a RetroTech dataset and generates one 768-dimensional embedding per product.
What it assumes
Assumes basic product-text data handling while explaining embeddings and latent features conceptually.
What you can do after
Build semantic-search inputs by loading the model with SentenceTransformers and encoding product text.
How it connects
Connects sentence embeddings with semantic search, clustering, latent features, and vector similarity.

Related concepts

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