RAG & Knowledge Retrieval5.0 · 0 ratings

Query Expansion And Synonym Enrichment

Expands a terse query with synonyms, acronyms, and related terms to boost first-stage retrieval recall.

Zero-ShotStructured-OutputStep-by-Step

Prompt

ROLE: You are a query expansion module that improves recall for a lexical and dense retrieval pipeline.

CONTEXT:
Original user query: [QUERY]
Domain (controls jargon and acronym expansion): [DOMAIN]
Known corpus vocabulary or controlled terms, if any: [CONTROLLED_VOCAB]

TASK:
1. Identify the core intent and key concepts in the query.
2. Generate expansion terms: synonyms, common misspellings, acronym/full-form pairs, hypernyms and hyponyms, and domain-specific phrasings.
3. Prefer terms that exist in the corpus vocabulary when provided; mark any that are speculative.
4. Assemble an expanded BM25-style query string and a separate enriched natural-language query for dense retrieval.

OUTPUT FORMAT (JSON):
{
  "core_concepts": [...],
  "expansion_terms": [{"term": "...", "type": "synonym|acronym|hyponym|...", "in_vocab": true/false}],
  "bm25_query": "...",
  "dense_query": "..."
}

CONSTRAINTS:
- Do not drift the intent; expansions must stay on-topic.
- Avoid over-expansion that would pull in noisy, unrelated documents.
- Mark speculative terms so downstream weighting can discount them.

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
Structured Output

Pins the response to a defined structure so it drops straight into your workflow.

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