Retrieval-Augmented Generation

embedding-based retrieval

Instead of matching exact words, embedding-based retrieval matches meaning. Every chunk is turned into an embedding — a list of numbers that places the text at a point in a space where passages about similar things sit close together. Your question is converted into a vector the same way, and the system simply grabs the chunks whose vectors are nearest to it. Synonyms and paraphrases stop being a problem, because closeness is about meaning, not spelling.

Nearness is measured by cosine similarity or a dot product, and finding the closest vectors among millions is done with approximate nearest-neighbour search so the lookup stays fast. The payoff is concrete: a question like "how do I reset my password?" can pull back a passage titled "account recovery steps" even though the two share no keywords, because their meanings — and therefore their vectors — line up. This is the retrieval engine inside most RAG systems.

\mathrm{sim}(q,d)=\frac{q\cdot d}{\lVert q\rVert\,\lVert d\rVert}

Cosine similarity ranks each document vector d by its angle to the query vector q.

Also called
dense retrievalvector retrieval