liveBook · Manning

Query expansion

As explained in LLM Evaluation and Alignment, The Foundational Ideas

Query expansion is a retrieval technique that augments a search query with additional terms or related expressions to improve matching.

Query expansion adds synonym terms or related expressions to a search query when relevant documents use different vocabulary. It addresses lexical gaps without changing the retrieval system itself. section 6.4.1 section 6.2.1

Use it to address lexical mismatch in retrieval:

  • For BM25, add query terms when relevant documents use different terminology. section 6.4.1 section 6.2.1
  • For grep-based search, add synonyms or relax the regex pattern; “authentication failure” may otherwise miss a document about “login rejection.” section 6.2.1

How LLM Evaluation and Alignment, The Foundational Ideas covers it

How deep it goes
Adds synonym terms or relaxes regex matching at the application layer, without changing the retrieval system.
Examples
Contrasts “authentication failure” with “login rejection” and adds synonym terms or relaxes regex patterns.
What you can do after
Diagnose/debug with it by identifying lexical mismatch behind low context recall and augmenting queries with synonyms or relaxed regex patterns.
How it connects
Connects lexical search with BM25, pattern matching, synonym mapping, and retrieval recall.

Also explained in

Compare how 4 books explain query expansion →

Related concepts

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