What this prompt does
This prompt specifies an end-to-end RAG pipeline tightly enough to build, with named models and concrete numbers rather than a generic diagram. It casts the AI as a retrieval-focused ML engineer. You provide the [domain], the [corpus_size], the [avg_doc_size], and your [accuracy_priority]. It returns a chunking strategy and size, an embedding model choice with rationale, a managed-vs-self-hosted vector store decision, a hybrid BM25-plus-vector retrieval design with a reranker, an LLM prompt template that forces inline citations, and an evaluation set with faithfulness, answer-relevance, and context-recall metrics.
The design front-loads the decisions that actually break RAG systems. Chunking and retrieval, not the LLM, are where most failures live, so the prompt justifies chunk size against your [avg_doc_size] and pairs lexical BM25 with semantic vector search to catch both exact terms and meaning. The vector-store decision weighs managed against self-hosted for your [corpus_size], and a reranker reorders candidates before they reach the model. Forcing inline citations and tracking faithfulness early is what stops confident hallucinations from reaching users — critical when [accuracy_priority] demands citing a source or refusing outright.
When to use it
- Designing a RAG system over a specific
[domain]knowledge base - Justifying chunk size against real
[avg_doc_size]instead of guessing - Deciding managed versus self-hosted vector storage for your
[corpus_size] - Building a hybrid retrieval stack with a reranker, not pure vector search
- Enforcing citations when
[accuracy_priority]cannot tolerate fabrication - Standing up an eval set before tuning anything in the pipeline
Example output
You get an ASCII pipeline diagram first, then each numbered decision with its rationale: the chunking strategy and size, the named embedding model, the vector-store tradeoff, the hybrid retrieval plus reranker design, a citation-forcing prompt template, and an evaluation set with faithfulness, answer-relevance, and context-recall metrics. It reads as a build spec you can hand to an engineer.
Pro tips
- Make
[accuracy_priority]explicit — "cite source or refuse" produces a stricter citation prompt and refusal behavior than a softer goal - Give a real
[avg_doc_size]in tokens so the chunking rationale is grounded; chunk size is downstream of document length - State
[corpus_size]honestly, since it drives the managed-vs-self-hosted vector store tradeoff - Stand up the eval set before you tune retrieval or prompts — without faithfulness and context-recall numbers you are flying blind
- Keep the hybrid BM25-plus-vector design rather than dropping to pure vectors; lexical recall catches exact terms embeddings miss
- Treat the citation-forcing template as non-negotiable for high-stakes
[domain]content where a fabricated source is unacceptable - Add a reranker even on a modest corpus; reordering the top candidates before they reach the model often improves answer quality more cheaply than swapping the embedding model