liveBook · Manning

Semantic similarity

As explained in Effective Conversational AI

Semantic similarity is the degree of shared meaning between two pieces of text, typically estimated from their representations.

Semantic similarity estimates how closely two texts match in meaning. In retrieval-augmented generation (RAG), it helps find relevant passages even when a question and passage do not use the same words. section 6.3.2

From question to relevant passage

A chatbot question is converted into a vector using the same embedding model as the indexed document chunks. The vector database searches for passages with similar meaning, which are passed to the language model to generate a response. section 6.3.2

Figure 6.9 RAG uses a vector database during build time and run time.
figure

See how vector-database retrieval supports RAG during preparation and at runtime. section 6.3.2

How Effective Conversational AI covers it

How deep it goes
Explains vector-space matching and runtime retrieval, but does not specify a similarity formula or threshold.
Examples
Uses indexed document chunks and user questions, then compares generated answers with expected responses.
What you can do after
Evaluate response relevance by scoring semantic similarity and informativeness, comparing generated and expected answers, and reviewing precision, recall, and F1.
How it connects
Connects embeddings and vector databases to retrieval-augmented generation (RAG).

Also explained in

Compare how 5 books explain semantic similarity →

Related concepts

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