Query Reformulation
Overview
In a multi-turn conversation, users often ask follow-up questions that reference previous context:“How does the Builder pattern work?” “And for Bedrock?”The second question makes no sense to the vector store in isolation. Query reformulation solves this by rewriting the question into a self-contained query before retrieval:
“How does the Builder pattern work with AWS Bedrock in RAGLight?”This dramatically improves retrieval accuracy in conversational RAG.
How it works
Whenreformulation=True, the pipeline adds a reformulate step before retrieval:
INFO level so you can inspect what the model produced.
Configuration
Reformulation is enabled by default. You can disable it explicitly if needed.Via RAGConfig (simple API)
Via the Builder API
When reformulation helps
| Scenario | Benefit |
|---|---|
| Multi-turn conversations | Resolves pronoun/reference ambiguity |
| Follow-up questions | Makes implicit context explicit for retrieval |
| Short or vague queries | Expands the query for better recall |
When to disable it
| Scenario | Reason |
|---|---|
| Single-turn Q&A | No history to leverage, avoids unnecessary LLM call |
| Very fast LLMs only | Adds one LLM roundtrip per query |
| Strict cost control | Each reformulation consumes tokens |
Summary
- Reformulation rewrites follow-up questions into standalone queries
- Enabled by default in
RAGConfigandBuilder.build_rag() - Uses the same LLM as generation — no extra model needed
- No-op on the first turn (no history)
- Disable via
reformulation=False