LLM Application Development
Intermediate
4.5

Query Rewriting for Better Retrieval

Fix vague or conversational questions before you search.

0h 20m
1 lesson
1.2K students

What You'll Learn

Learning objectives will be added soon.

Tutorial Content

The problem

Users ask messy, context-dependent questions: "what about the second one?" Vector search on that retrieves nothing useful.

Rewrite first

Use an LLM to turn the raw question (plus chat history) into a clean, standalone search query:

Given the conversation, rewrite the user's last message as a
self-contained search query.

Variations

  • Multi-query — generate several phrasings and merge results.
  • HyDE — have the LLM draft a hypothetical answer and embed that to search.

These cheap pre-steps often lift retrieval more than swapping the embedding model.

Your Progress

Sign in to track your progress

Tags

RAG
LLM
Embeddings