Embedding-based retrieval
Embedding-based retrieval retrieves or ranks candidate items by comparing vector representations of a query and the candidates.
Retrieval Augmented Generation, The Foundational Ideas
A bi-encoder is a neural architecture that independently encodes two inputs into representations that can be compared afterward.
- How it is used
- Supplies fast semantic document candidates as context for question answering and retrieval-augmented generation.
- How deep it goes
- Explains independent encoding, offline indexing, similarity scores, training objectives, and reranking tradeoffs; walks REALM scoring code rather than training it from scratch.
- Examples
- Compares paraphrase search with open-domain question answering and computes candidate dot-product scores in a TensorFlow excerpt.
- What you can do after
- Evaluate/understand when to use shared or specialized encoders, precompute an index, and add keyword retrieval or reranking.
Read how Retrieval Augmented Generation, The Foundational Ideas explains embedding-based retrieval →
Build an Advanced RAG Application (From Scratch)
A bi-encoder independently maps a query and document to vector representations for efficient similarity comparison.
- How it is used
- Builds semantic-search retrieval for free-form hotel queries and broader vector-search pipelines.
- How deep it goes
- Explains independent encoding, similarity calculation, ranking, and FAISS scaling, but stops short of detailed model internals.
- Examples
- Uses Paris hotel reviews, a Louvre query, NumPy cosine search, ranked outputs, and the Travelle search engine.
- What you can do after
- Apply it via Sentence Transformers and FAISS to encode documents, rank query matches, and retrieve relevant results efficiently.
Read how Build an Advanced RAG Application (From Scratch) explains embedding-based retrieval →
AI-Powered Search
A bi-encoder is a model that independently encodes two inputs, such as a query and a document, into separate embeddings for comparison.
- How it is used
- Supports semantic search and other high-volume query-to-document matching tasks.
- How deep it goes
- Explains independent encoding, cosine scoring, ANN acceleration, and cross-encoder trade-offs without detailing encoder internals.
- Examples
- Uses “mountain hike” retrieval and “first time snow hiking” as a concrete relevance comparison.
- What you can do after
- Apply bi-encoder retrieval to support high-volume matching and combine it with reranking for more nuanced results.
Read how AI-Powered Search explains embedding-based retrieval →
Vibe Engineering
Embedding-based retrieval is retrieval that ranks indexed content by similarity between vector embeddings of the query and candidate content.
- How it is used
- Supports fast context selection for LLM prompts, especially across external documentation, libraries, and organizational wikis.
- How deep it goes
- Explains the embedding-and-index workflow and its latency, staleness, chunking, and relevance trade-offs without detailing indexing internals.
- Examples
- Uses indexed codebase assistance that retrieves a target function, library examples, and error-handling patterns.
- What you can do after
- Evaluate whether indexed retrieval suits a context pipeline by weighing speed against freshness, coverage, and contextual completeness.
Read how Vibe Engineering explains embedding-based retrieval →
What to know first
- lexical searchLexical search retrieves or ranks items by matching query terms or other surface-text features against indexed content, often using sparse representations and statistical weighting.
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- embeddingAn 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.
- approximate nearest neighbor searchApproximate nearest neighbor search efficiently finds items close to a query under a distance or similarity measure without guaranteeing the exact nearest items.
Related concepts
- cross-encodercontrasts with · A cross-encoder is a neural model that jointly processes paired inputs so they can interact during encoding and produce a score or prediction about their relationship.
- Retrieverincludes · A retriever is a software component that searches or queries an information source and returns items relevant to a query for use by downstream processes.
- DSPyused by · DSPy is a Python framework for declaratively programming, composing, evaluating, and optimizing language-model applications and pipelines.
- similarity searchimplemented by · Similarity search is a retrieval technique that finds or ranks items by their similarity to a query, often by comparing feature or vector representations under a similarity or distance measure.
- encoderkind of · An encoder is a component or process that transforms input into an encoded or internal representation for subsequent processing, transmission, or decoding.
- cosine similarityuses · Cosine similarity measures the directional alignment of two nonzero vectors as the cosine of the angle between them, equal to their dot product divided by the product of their magnitudes.
Questions about embedding-based retrieval
What is embedding-based retrieval?
Embedding-based retrieval retrieves or ranks candidate items by comparing vector representations of a query and the candidates.
Which Manning books explain embedding-based retrieval?
Retrieval Augmented Generation, The Foundational Ideas, Build an Advanced RAG Application (From Scratch), AI-Powered Search and Vibe Engineering.
What should I know before learning embedding-based retrieval?
Manning books that teach embedding-based retrieval usually introduce lexical search, language model, embedding and approximate nearest neighbor search first.
What is the difference between embedding-based retrieval and cross-encoder?
Embedding-based retrieval retrieves or ranks candidate items by comparing vector representations of a query and the candidates. A cross-encoder is a neural model that jointly processes paired inputs so they can interact during encoding and produce a score or prediction about their relationship.
What kinds of embedding-based retrieval are there?
Kinds of embedding-based retrieval include Retriever.
What is embedding-based retrieval a kind of?
Embedding-based retrieval is a kind of encoder. An encoder is a component or process that transforms input into an encoded or internal representation for subsequent processing, transmission, or decoding.
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.



