Apply to my task
arXiv:2507.06956 ★ 75 Jul 9, 2025

RAG Systems: How to Write Prompts When There Are Two Engines Inside, Not One

Key result

The paradox: a corporate chatbot hooked up to your documents stubbornly "doesn't know" the answer, even though it's definitely in there. That's not the language model's weakness. It's a failure of the internal retriever, which sees your query before the smart LLM does and works like a primitive keyword engine. The "Retriever First" method lets you write prompts so that the retrieval stage actually finds the right chunks of text instead of missing them. Split your prompt explicitly into search queries and generation instructions, and the system stops pretending it's "out of the loop" on the obvious. The information is there. It just wasn't found.

Investigating the Robustness of Retrieval-Augmented Generation at the Query Level

Key Aspects of the Research:

The study examines how much the answer quality of retrieval-augmented generation (RAG) systems depends on small changes to the user's query. The authors deliberately "broke" prompts by adding typos, ambiguity, stiff formal phrasing and verbal "junk," then measured how this affected the two parts of the system: the internal search engine (the retriever) and the language model itself (the generator).

Key Result: A RAG system's success hinges on the quality of the initial retrieval, which is highly sensitive to the slightest imprecision in the prompt; if the retriever fails to find the right information, the language model can no longer "rescue" the answer.


The Core of the Method, Explained:

The method you can take away from this study is this: when writing a prompt for a RAG system (any chatbot that pulls information from an external source, whether the web, PDF files or a corporate knowledge base), think of your request as a two-stage process:

  1. Stage 1: The search query. The first and most important job of your prompt is to serve as the perfect query for an internal, fairly "dumb" search engine. This retriever doesn't have the full power of the LLM; it just looks for semantically similar chunks of text. The study shows this stage is the weakest link.
  2. Stage 2: Instructions for the generator. Only after the retriever has found relevant fragments are they passed, together with your original prompt, to the large language model, which synthesizes them into the final answer.

The practical method that follows is "Retriever First." Your prompt should be optimized first and foremost for successful retrieval.

What this means in practice:

  • Ruthlessly cut the "junk": Phrases like "I was just wondering, could you please tell me about..." only get in the retriever's way. They add informational noise and can "throw off" the search for relevant documents. Be as blunt as possible.
  • Use precise keywords: Instead of "tell me about that painter", use "key periods of Vincent van Gogh's work". The retriever runs on keywords and semantic similarity.
  • Avoid ambiguity: The query "When might the festival take place?" is worse than "Cannes Film Festival 2024 dates". The word "might" introduces uncertainty that hurts retrieval.
  • Check carefully for typos: A human will understand "festivle," but to the retriever it can be a completely different word, and the search fails.

In short, you have to help the machine find the right needles in the haystack first, and only then ask it to explain what those needles are.


Practical Applicability:

  • Direct applicability: Maximum. Anyone can start applying these principles right now. Instead of writing long, polite, chatty prompts for your custom GPT (the one that analyzes your documents), write short, precise instructions that look like search queries. For example, instead of "Could you please analyze last quarter's reports and tell me what the main sales problems were", write "Key sales problems per Q3 2024 reports. List the top 3."

  • Conceptual value: Huge. The study gives you a crucial mental model: RAG = Retrieval + Synthesis. It explains why the system sometimes fails to answer a seemingly simple question whose answer is definitely in the documents. Most likely it wasn't the LLM's "intelligence" that failed but the primitive retrieval step, thanks to a fuzzy query. That knowledge moves you from "magical thinking" to deliberately controlling the tool.

  • Adaptation potential: The principles hold for any system where an LLM uses external information. That covers not just chatbots but document-analysis tools, business Q&A systems and even some search-engine features. Adapting it is simple: if you know the model will search for something before answering, phrase your request to help it search.


A Practical Example:

Say you've uploaded several articles on healthy eating to a custom GPT and want a concrete plan out of them.

**Role:** You are an experienced nutrition consultant.

**Context:** Your knowledge base consists exclusively of the articles I've provided on healthy eating principles, diets and recipes. Ignore any other information.

**Task:** Based on the information in the articles, create a weekly meal plan for an office worker (male, 30) aiming to maintain weight and boost energy.

**Key criteria for finding information (help me find these in the articles):**
1.  High-protein breakfast recipes.
2.  Lunch ideas that are easy to bring to the office.
3.  Light dinner options that don't overload digestion.
4.  A list of healthy snacks to fight afternoon fatigue.

**Output format:**
Present the result as a table with the columns: "Day of the week", "Breakfast", "Lunch", "Dinner", "Snack".

Why It Works:

This prompt is built on the principles uncovered in the study and maximizes the odds of the RAG system working well:

  1. A direct, precise request: Instead of a vague "make me a meal plan," the prompt clearly defines the goal ("maintain weight," "boost energy") and the target person ("office worker, male, 30").
  2. Optimized for the retriever: The "Key criteria for finding information" section is a direct application of the study's findings. We don't just ask a question; we hand the retriever clear, specific search queries ("high-protein breakfast recipes", "healthy snacks"). That greatly raises the chance the retriever finds the most relevant text fragments in the uploaded articles.
  3. No ambiguity or "junk": The prompt is free of chatty filler and fuzzy wording. Every line carries a specific instruction.
  4. Separation of tasks: The prompt implicitly splits the job into "search" (via the key criteria) and "generation" (via the role, task and output format), which matches the two-stage nature of RAG.

Another Practical Example

Picture a product manager who has loaded dozens of customer reviews of a new app into a corporate chatbot and wants to analyze them.

**Role:** You are an impartial user experience analyst.

**Context:** Your knowledge base is 500 user reviews of the "FinanceFlow" mobile app collected over the past month.

**Task:** Analyze the reviews and identify the main themes users care about.

**Information extraction instructions (look for the following in the reviews):**
-   **Positives:** Find mentions of a convenient interface, fast syncing and useful notifications.
-   **Negatives:** Find complaints about login errors, slow report loading and the lack of integration with "GlobalBank".
-   **Improvement suggestions:** Find requests to add dark mode and CSV export.

**Output format:**
Write a short report as a bulleted list:
*   **What users like:** (top 3 points)
*   **What users complain about:** (top 3 points)
*   **What users want added:** (top 2 points)

Why This Example Works, Mechanically.

This prompt is effective because it, too, follows the "Retriever First" methodology:

  1. Turning the task into search: Instead of the general question "What do users think of the app?", which is far too vague for a retriever, we give it concrete, almost verbatim phrases to look for: "login errors", "dark mode", "GlobalBank integration".
  2. Lower cognitive load on the LLM: By providing clear search queries, we help the RAG system filter the relevant reviews first. That sharply narrows the amount of information the generator has to deal with in the second stage. It doesn't need to reread all 500 reviews, only the ones the retriever found with our keywords.
  3. Structure and precision: The prompt avoids ambiguity and verbal junk. It cleanly separates positives, negatives and suggestions, which translates directly into search subtasks and makes the final result more structured and relevant. It's a perfect example of how to help the machine find first and summarize second.

Usefulness Score: 92

02

Core Evaluation Criteria

  • Pre-filter: The study focuses entirely on text prompts and their effect on RAG systems. Evaluation continues.
  • A. Relevance to prompting techniques: Very high. The study directly analyzes how specific types of wording (redundancy, formality, ambiguity, typos) affect the result.
  • B. Better conversational answers: High. Understanding the study's findings directly leads to fewer "failed" answers, especially in systems working with knowledge bases (RAG).
  • C. Direct practical applicability: Very high. The recommendations boil down to changing how you write prompts, which takes no technical skills, code or special tools.
  • D. Conceptual value: Exceptionally high. The study gives the user a key "mental model" of how RAG systems work: the split into the Retriever and the Generator. That explains why even a logical request sometimes fails.
  • E. A useful new practice: The work hits several clusters at once:
    • Cluster 2 (LLM behavioral patterns): Shows how critically sensitive the system is to query quality, especially at the retrieval stage.
    • Cluster 6 (Context and memory): A foundational study for understanding RAG, the main method for working with external context.
    • Cluster 7 (Reliability and stability): Gives direct recommendations for making answers more reliable by avoiding "perturbations" in the prompt.
  • Practicality checklist (+15 points):
    • Reveals non-obvious LLM behavior? YES. (The retriever's critical vulnerability compared with the generator.)
    • Offers ways to improve answer consistency/accuracy? YES. (Avoid ambiguity, redundancy and typos.)
03

Numeric Usefulness Score

Arguments for a high score (92/100):

The study has enormous practical and conceptual value for anyone working with an LLM on top of a knowledge base (custom GPTs, Perplexity AI, corporate chatbots). It gives not just tips but a fundamental understanding of why they work.

The key insight is splitting RAG into two stages: Retrieval (the Retriever) and Synthesis (the Generator). The study shows that retrieval is usually the "weak link." If a fuzzy prompt keeps the retriever from finding the relevant documents, even the most powerful generator LLM can't give the right answer. This "mental model" instantly improves your prompts, because you stop thinking "how do I ask the smart AI?" and start thinking "how do I write the perfect search query?"

Counterarguments (why the score could be lower/higher):

  • Why it could be lower: Some findings may seem obvious ("write without typos," "be more precise"). A user without a technical background may miss the main value, the breakdown of RAG mechanics, and dismiss the paper as academic. It's also full of specialized terms (BM25, Contriever, Pearson correlation) that may scare people off.
  • Why it could be higher: This is one of the most important studies for understanding the limits of today's LLM agents. The concept of retriever robustness is foundational knowledge that turns a regular user into an advanced one. It explains 90% of failures when working with custom GPTs and other RAG systems. Understanding this principle matters more than knowing a dozen small tricks.

Research digest

Key result

The paradox: a corporate chatbot hooked up to your documents stubbornly "doesn't know" the answer, even though it's definitely in there. That's not the language model's weakness. It's a failure of the internal retriever, which sees your query before the smart LLM does and works like a primitive keyword engine. The "Retriever First" method lets you write prompts so that the retrieval stage actually finds the right chunks of text instead of missing them. Split your prompt explicitly into search queries and generation instructions, and the system stops pretending it's "out of the loop" on the obvious. The information is there. It just wasn't found.

Principle

RAG isn't one engine, it's two in sequence. First comes the retriever, a primitive search engine that looks for chunks of text close in meaning to your query. Then the generator, the smart LLM that builds the answer from what was found. If the retriever returns junk, the smart LLM writes a smart summary of junk. A typo, a polite "could you tell me about...", or a vague "somewhere in there" — and the retriever heads the wrong way. Fix the first stage instead of blaming the second.

Why it works

The retriever works through semantic similarity: it looks for chunks of text that are mathematically "similar" to your query. Add extra words and they dilute the meaning signal. The retriever goes off course. And the LLM has no way out: it builds the answer from whatever it's handed. No right chunks, no right answer. The study deliberately "broke" prompts — introduced typos, ambiguity, verbal ballast — and tracked where quality dropped. It dropped at the retrieval stage, not the generation stage. The LLM isn't to blame. It just never got the source material.

When to apply

Any RAG tool — corporate chatbots on documents, custom GPTs with uploaded files, company knowledge bases, support Q&A systems — especially when the system "can't find" an answer that should definitely be in the sources. NOT a fit for regular GPT prompts without uploaded documents: there's no retrieval stage there, nothing to fix.

Mini recipe

1. Check the architecture: Does the chatbot work with documents or an external base? If so, you're dealing with a two-stage RAG. That means the rules below are mandatory. 2. Cut the polite ballast: "Could you tell me...", "I was wondering..." — all of it dilutes the meaning signal for the retriever. Cut ruthlessly. 3. Add a search-query block: List explicitly what the retriever should find. For example: `Search the documents for: (1) complaints about login errors, (2) requests for dark mode, (3) mentions of slow loading.` 4. Use precise keywords: Instead of "that painter," write "key periods of Vincent van Gogh's work." Instead of "sales problems," write "revenue decline in the Q3 2024 report." 5. Check for typos: To a human, "festivle" = "festival." To a retriever, they're two different words. And it'll find the wrong thing.

Examples

[BAD]: `I was just wondering, could you tell me in a bit more detail what the sales problems were in last quarter's reports?` [GOOD]: `Role: sales analyst. Knowledge base: Q3 2024 reports. Task: identify the reasons for the revenue decline. Search the documents for: (1) conversion decline by region, (2) churn of repeat customers, (3) rising customer acquisition cost. Format: three points with numbers.` Why it works: the retriever gets three concrete queries instead of one fuzzy one. It finds the right chunks. The LLM builds the answer from them — not from random pages of the report.

In plain words

The gist: RAG systems aren't a magic oracle, they're an ordinary librarian who can get lost in a closet. When you give a model a knowledge base and ask a question, it goes looking for chunks of text to build an answer from. The catch is that answer quality hinges critically on how the query is worded. Ask sloppily and the system drags a pile of junk out of the base, and the model starts hallucinating or just serves up useless mush. The study shows that query-level RAG robustness is thin ice that cracks at the slightest change in context.

It's like sending an intern to the archive for information on "the benefits of apples" and getting back iPhone sales reports. Technically the word matched, but it's useless. If you don't specify you mean fruit and nutrition, the intern (or RAG) just freezes up in front of all the options. Retrieval mechanics run on semantic similarity, but that similarity is often false if the query isn't calibrated to the structure of your data.

To keep this combo from screwing up, use explicit context and structural constraints. In your healthy-eating prompt it works like this: you don't just ask "how should I eat," you make the model use source citations and strict adherence to the uploaded articles. That cuts out the noise and forces the system to focus on specific facts rather than general knowledge from the internet. Retrieval precision jumps several-fold when you set the boundaries of acceptable content.

The test used articles on nutrition, but the principle is universal for any document work. Legal contracts, technical manuals, corporate policies: RAG behaves the same everywhere. If the query is fuzzy, the system hauls everything into the answer, creating the illusion of work. But add filtering by meaning blocks, and even a weak model starts delivering expert-level results. This isn't just a GPT trick, it's the foundation for any AI tool that works with external data.

Bottom line: don't expect the model to sort out your file dump on its own. RAG quality is 80% the quality of your prompt, which should work like a surgical scalpel, not a shovel. If you don't spell out clear search rules and an answer format, the system will keep missing the target. Want a sane result? Control your inputs and the structure of your query, or you'll get confident nonsense instead of analysis.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on RAG Systems: How to Write Prompts When There Are Two Engines Inside, Not One arXiv:2507.06956

Sign in to apply this study New accounts get 50 free credits.

Get the week’s best papers by email

One email on Sundays with the highest-rated new techniques. Unsubscribe with one click.