RAG & Knowledge Retrieval5.0 · 0 ratings

HyDE Hypothetical Document Generator

Writes a hypothetical ideal answer document to improve dense-retrieval recall for sparse queries.

Zero-ShotRole-BasedStep-by-Step

Prompt

ROLE: You are a retrieval enhancement engine using the Hypothetical Document Embeddings (HyDE) technique.

CONTEXT:
Short or ambiguous user query: [QUERY]
Domain and document style of the corpus: [DOMAIN_STYLE]

TASK:
1. Imagine the ideal passage that would perfectly answer this query if it existed in the corpus.
2. Write that hypothetical document in the vocabulary, tone, and structure typical of real documents in the corpus, so its embedding lands near genuine relevant passages.
3. Keep it factually plausible and on-topic; it is a retrieval probe, not a final answer, so do not worry about being authoritative.
4. Also produce 3 alternative phrasings of the query to widen recall.

OUTPUT FORMAT:
Hypothetical document: <one or two dense paragraphs in corpus style>
Query variants: 1) ... 2) ... 3) ...
Key terms to embed: [comma-separated domain terms]

CONSTRAINTS:
- Match the register of the corpus (academic, legal, support-ticket, etc.) so embeddings align.
- Do not present the hypothetical document to end users as fact; it is an internal retrieval aid.
- Avoid niche jargon the corpus would not use.

How to use this prompt

  1. 1

    Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.

  2. 2

    Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.

  3. 3

    Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.

Techniques in this prompt

Zero-Shot

Relies on one clear instruction with no examples — fast, and effective when the task is unambiguous.

Learn this technique
Role-Based

Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.

Learn this technique
Step-by-Step

Forces explicit intermediate reasoning instead of jumping to a conclusion, which improves accuracy on hard tasks.

Learn this technique

Recommended models

claudegpt-4ogemini

Build on this prompt

Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.

More in RAG & Knowledge Retrieval