liveBook · Manning

Embedding

As explained in Agent Design Patterns

A numerical vector representation of data, often designed to encode semantic features for computational comparison.

An embedding is a vector representation used to search by meaning rather than only by matching words. In an agent retrieval pipeline, a new query is converted to an embedding and compared with embeddings stored for existing records. This gives the agent a low-cost way to find candidates without asking a large language model to read every record. section 7.0 section 7.2

The embedding has a specific job in the retrieval pipeline:

  • Preparation: represent the incoming query as a vector; stored records have already been represented when they enter the database. section 7.0 section 7.2
  • Search: compare the query vector with stored vectors to produce a broad candidate set. Approximate nearest neighbor search is a common choice for dense retrieval. section 7.0 section 7.2
  • Judgment: filter or re-rank candidates with a more expensive method. Vector similarity is useful for recall, but does not settle precise relevance. section 7.0 section 7.2

Searching historical insurance claims

For a new claim describing basement water damage from a pipe that burst during a freeze, an agent can search embeddings of historical claims and pull roughly 50 potentially related cases. A specialized evaluator then checks which cases are genuinely relevant in a legal or technical sense, rather than merely similar in vocabulary. section 7.0

A dense embedding is not the only search representation: sparse retrieval uses weighted keyword vectors, while a late-interaction model such as ColBERT uses a matrix of token vectors. The choice affects how the inexpensive first pass finds candidates; result processing remains a separate step. section 7.2

Figure 7.1 The AFD of the Retriever pattern. The input (a query) is first processed into a representation suitable for search. This representation is used to query a data storage, producing a set of candidate results. These candidates are optionally passed through a result-processing step (e.g., a re-ranker or filter) to improve the selection before being returned as the final output.

The retrieval flow shows where an embedding fits: represent the query, search stored data, then optionally filter or re-rank the candidates. section 7.2

How Agent Design Patterns covers it

How deep it goes
Defines embeddings operationally as semantic search representations and follows them through retrieval, but does not specify how vectors are constructed.
Examples
Illustrates a burst-pipe insurance claim shortlisted against historical cases before more precise relevance evaluation.
What you can do after
Evaluate/understand it as a first-pass semantic search representation whose candidates still need relevance checking.
How it connects
Connects embeddings to dense neural retrieval, vector databases, approximate nearest neighbor search, and re-ranking.

Also explained in

Compare how 72 books explain embedding →

Related concepts

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