liveBook · Manning

Semantic gap

As explained in Retrieval Augmented Generation, The Foundational Ideas

A semantic gap is a discrepancy between the meaning or representation of an input and the meaning or representation of a relevant target.

A semantic gap occurs when an input and a relevant target express related ideas in different ways. In retrieval, a short, underspecified query may lack the vocabulary and detail of the document that answers it. section 7.1

Because the query and document can occupy distant regions of embedding space, direct vector search may miss a relevant document even when it is in the corpus. The problem is especially acute without labeled query-document pairs to adapt retrieval to a domain’s vocabulary. section 7.1

A short query, a detailed document

A search for “COVID-19 anxiety rates” may miss a paper titled “A Longitudinal Study on the Mental Health Impacts of the COVID-19 Pandemic, Focusing on Increased Incidence of Generalized Anxiety Disorder.” section 7.1

HyDE addresses this mismatch by having an LLM generate a semantically plausible hypothetical document, then retrieving by document-to-document similarity. The generated passage guides retrieval; retrieved documents provide factual grounding. section 7.0

Figure 7.1 With query–document mismatch, the query embedding lies far from the cluster of relevant documents, which is why direct embedding retrieval underperforms.

The figure shows the query embedding separated from the cluster of relevant documents, illustrating why direct embedding retrieval can underperform. section 7.1

How Retrieval Augmented Generation, The Foundational Ideas covers it

How deep it goes
Explains sparse-query and dense-document mismatch, vector separation, and zero-shot exacerbation, then motivates document-to-document matching.
Examples
Contrasts a search for “COVID-19 anxiety rates” with a detailed paper title about pandemic-related generalized anxiety disorder.
What you can do after
Diagnose why direct vector search can miss relevant documents when query and corpus language differ.
How it connects
Links semantic gaps to embeddings, dense retrieval, zero-shot retrieval, and HyDE.

Also explained in

Compare how 2 books explain semantic gap →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Retrieval Augmented Generation, The Foundational Ideas. The section links point to the parts of the book it draws on.