Query Expansion
Expand search queries with synonyms, related terms, and reformulations using LLM
Why do anything?
Users search with limited vocabulary. Exact query matching misses relevant documents with different terminology.
Why now?
LLMs can generate semantically equivalent query variations to improve recall.
Why this feature?
LLM expands queries with synonyms, related concepts, and alternative phrasings. Supports multiple expansion strategies.
How It Works
Query expansion uses LLM to generate semantically related query variations.
1
Query Analysis
Analyze original query intent
2
Expansion Generation
LLM generates synonyms and variations
3
Query Combination
Combine expanded queries for search
Why This Approach
LLM understands semantic relationships. Expansion improves recall without sacrificing precision.
Where This Is Used
Integration
retriever = client.retrievers.create(stages=[{"type": "query_expand", "max_expansions": 5}])