liveBook · Manning

Embedding

As explained in The Art of AI Product Development

A numeric vector representation that encodes the semantic or structural properties of an item for computational comparison.

A search box can miss a useful document when the user’s words differ from the document’s. An embedding gives words or text a numerical vector representation that supports comparison by meaning, not only by exact wording. For semantic search, documents are transformed into embeddings and saved to a database so relevant documents can be retrieved for a query. section 7.2 section 7.2.2

Why context matters

In “The customer finally signed the cotnratc,” the surrounding words make “contract” understandable despite the misspelling. Embeddings draw on this principle of contextual similarity: apple and banana occur in more similar contexts than apple and car, so their embeddings are closer. section 7.2.2

Figure 7.3 Semantically similar words are closer to each other in embedding space.
A screenshot of a computer game

AI-generated content may be incorrect.

The figure shows the central comparison: semantically similar words sit closer together in embedding space. section 7.2.2

Embeddings are useful, but they compress text and lose some original information. Embedding-only retrieval can therefore miss the most relevant documents. For a product search experience, combine semantic retrieval with lexical search when exact terms matter; use metadata filters for attributes such as publication date, and consider reranking when initial results are weak. section 7.2.4

In retrieval-augmented generation (RAG), retrieved documents provide context for a language model’s answer. Better retrieval can help make answers more domain-specific and grounded, but embedding quality alone does not establish reliability: check context relevance, groundedness, and answer relevance. Embeddings can also store raw agent interactions for later semantic search. section 7.4 section 9.2.3

How The Art of AI Product Development covers it

How deep it goes
Explains contextual similarity and document-vector storage conceptually, without a mathematical derivation.
Examples
Uses a misspelled contract, apple–banana–car comparisons, and date-filtered cloud-computing reports.
What you can do after
Evaluate/understand it by recognizing when semantic retrieval needs exact-term matching, metadata filters, or reranking.
How it connects
Links embeddings to semantic search, vector databases, lexical search, metadata filtering, reranking, and retrieval-augmented generation.

Also explained in

Compare how 47 books explain embedding →

Related concepts

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