# Prompt rewriter

**Source:** https://promtable.com/glossary/prompt-rewriter

> A prompt rewriter is a layer — often a small LLM — that takes the user's raw query and rewrites it into a form that downstream retrieval or generation handles better.

---
A prompt rewriter is a layer — often a small LLM — that takes the user's raw query and rewrites it into a form that downstream retrieval or generation handles better.

User queries are messy: typos, missing context, ambiguous wording, implicit references to earlier turns. A prompt rewriter normalises them: resolve coreferences from chat history, expand abbreviations, fill in implicit context, decompose multi-part questions. Used heavily in production RAG and search systems in 2026 because retrieval quality is highly sensitive to query phrasing. Implementations: a small LLM with a tight system prompt, a fine-tuned classifier, or a semantic rewriter (HyDE-style hypothetical document generation).

## When to use

- RAG over user queries that miss context.
- Multi-turn chat where queries reference earlier turns.
- Voice agents where ASR adds noise.

## Common mistakes

- Rewriter that's stronger than the answer model — adds cost without proportional quality.
- No eval on the rewriter — drift goes unnoticed.

## Related terms

- [rag](https://promtable.com/glossary/rag)
- [semantic-routing](https://promtable.com/glossary/semantic-routing)
- [router-llm](https://promtable.com/glossary/router-llm)
- [agent](https://promtable.com/glossary/agent)

*Last updated: 2026-06-01*
---

Original page: https://promtable.com/glossary/prompt-rewriter
Maintained by Promtable (https://promtable.com). Content: CC BY 4.0. Cite as "Promtable — https://promtable.com/glossary/prompt-rewriter".
Contact: info@vibecodingturkey.com.