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.
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














































