Technique · 19 studies
Grounded prompting and RAG: getting answers from your documents, not the model's memory
Grounded prompting makes the model answer from supplied material instead of memory: frame the source explicitly, anchor the output to quotes or line numbers, and check which required facts the evidence actually covers. Framing alone moved document-following by up to 94 points in one study, but repeated, cited or search-retrieved sources can also mislead the model.
Also called: retrieval-augmented generation, answer only from the document, source grounding, context-only answering
What grounded prompting is
Grounded prompting makes the model answer from material you supply (a document, retrieved passages, a data dictionary) rather than from what it remembers. The prompt says what the source is, how to use it and what to do when the answer is not in it. Retrieval-augmented generation (RAG) is the same idea with a search step in front.
The techniques fall into three groups:
- Framing the source: "based ONLY on the document below", plus an explicit line for when the answer is missing.
- Anchoring the output to the text: verbatim quotes, numbered lines, claim IDs, citations after every point.
- Checking coverage: what the evidence confirms, what is still missing, and which sources to trust.
Why it works: from recall to extraction
A pasted document does not switch off the model's memory. The three-regimes study shows the model silently weighs your text against what it learned, holds on harder for famous facts, and resists more if it has already answered the question earlier in the chat. One framing line changes the task itself from recall to extraction: with "Based ONLY on the following document", Claude followed the document 100% of the time; with "use your own knowledge, the document may contain errors", 7.6%. Across models the swing reached 29-94 percentage points.
The SafeLLM study pushes the idea further. Writing an answer from a document is generation, which blends source and memory; choosing lines is classification. Numbering the document's lines and asking only for line numbers means the answer is assembled from original text, and this LINES strategy reached up to 95% agreement on medical terms in NHS clinical guidelines. Meaning works the same way for data: in the semantic-layer study, a 1-2 page markdown file defining metrics and table conventions raised three frontier models from 45-50% to 68% on the same 100 SQL questions, and the gap between models was negligible next to the gap between "with context" and "without".
Variants that tested well
- Gap analysis before the answer. Structured Evidence Assessment makes the model list Required Findings, Confirmed Findings and Remaining Gaps, then search only for the gaps. In the FAIR-RAG pipeline it reached F1 0.453 on HotpotQA against 0.370 for the best baseline; 2-3 iterations was the sweet spot, and a fourth added noise.
- Read the documents clean, then reason. Reasoning models used retrieved documents worse the longer they had reasoned before the search, even when the documents held the answer. SAKE places the documents twice, once at the start of the prompt and again after each reasoning step, and reports up to +37.6% F1 on hard bridge-comparison questions.
- Claims with quotes, then the summary. CAMS extracts atomic claims with verbatim quotes from each source, then writes the summary only from those claim IDs, stating contradictions between sources instead of smoothing them over.
- Three commands for document analysis. The structured document-analysis prompt separates instructions from data with tags, asks for an analysis plan, a citation after every point, and a plain "the text has no information about X" instead of filling gaps.
- Check each source alone before synthesis. The epistemic blind-spot study found models trust academic-looking style over the numbers when sources compete; evaluating each source in isolation first caught implausible statistics such as a 0.97 correlation from n=12.
When it helps and when sources mislead
Grounding helps most when the model already "knows" the topic (law, medicine, well-known companies) and you need your version of it, and when exact wording carries risk: contracts, policies, protocols. It is weaker for synthesis questions that join distant parts of a document; the SafeLLM authors note that line selection picks lines but does not connect them.
Three papers show sources misleading the model. The GroupQA study found that one argument paraphrased five times changed answers more often than five independent arguments (76.5% vs 67.6%), that the first documents in the list carried more weight than the last, and that models asked which document mattered most were wrong 74% of the time; chain-of-thought shifted results by less than 0.5%. The AuthorityBench study found that attaching a citation to a claim raised error rates across all seven models, worst for a true claim with a fabricated source, with up to 77% wrong answers in some conditions; "According to X, ..." at the start of a sentence was among the riskiest formats and "(Author, year)" at the end the safest. And in the over-searching study, search access raised accuracy on answerable questions by 12% but lowered correct abstention by 7%, doubling tokens per correct answer from 382 to 765.
So grounding is more than adding documents: frame the source, interleave conflicting documents instead of grouping them by side, tell the model to weigh quality over repetition, and give it an explicit way to say the answer is not there (see abstention prompts and lost in the middle).
What the studies measured
| Study | Lab score | Finding | Effect |
|---|---|---|---|
| Three Regimes of Conflict: Why the Model Ignores Your Document — and How to Fix ItMay 12, 2026 | 90 | One framing line moved document-following by 29-94 percentage points; Claude followed the document 100% of the time under 'Based ONLY on the document' and 7.6% under 'use your own knowledge'. | Helps |
| SafeLLM (Extraction over Rewriting): Line Numbering as a Shield Against Hallucinations When Working with DocumentsJun 11, 2026 | 85 | Asking only for the numbers of the relevant document lines, then assembling the answer from the original text, reached up to 95% agreement on medical terms and beat sentence-level 'safety' selection. | Helps |
| Semantic Layer: A Business-Context Document Doubles LLM Accuracy in Data AnalysisApr 28, 2026 | 92 | A 1-2 page semantic layer of metric definitions raised three frontier models from 45-50% to 68% on 100 SQL questions; model choice made little difference. | Helps |
| SEA (Structured Evidence Assessment): Explicit Gap Analysis for Complex QuestionsOct 25, 2025 | 84 | Required-Confirmed-Gaps assessment reached F1 0.453 on HotpotQA against 0.370 for the best baseline, with 2-3 iterations as the sweet spot. | Helps |
| SAKE: Duplicating Information to Shield It from Distortion by ReasoningFeb 10, 2026 | 78 | Placing retrieved documents both at the start and after each reasoning step countered knowledge-integration decay, with up to +37.6% F1 on hard multi-hop questions. | Helps |
| CAMS: Two-Step Summarization — Extract Facts with Quotes First, Then WriteJun 22, 2026 | 72 | Extracting atomic claims with verbatim quotes before writing a multi-source summary makes every sentence traceable and surfaces contradictions between sources. | Helps |
| GroupQA: How LLMs Handle Conflicting EvidenceJan 8, 2026 | 76 | One argument repeated five times swayed models more than five independent ones (76.5% vs 67.6%); self-reported attribution was wrong 74% of the time and chain-of-thought changed results by under 0.5%. | Hurts |
| AuthorityBench: Adding a Source to Your Prompt Raises the Odds of a Wrong AnswerJun 11, 2026 | 82 | Adding a citation raised error rates in all seven models, up to 77% wrong for true claims with fabricated sources; a trailing '(Author, year)' was the safest format. | Hurts |
| Over-Searching: When a Search-Enabled Model Searches Way Too MuchJan 9, 2026 | 86 | Search access raised accuracy on answerable questions by 12% but cut correct abstention by 7% and doubled tokens per correct answer (382 to 765); explicit permission to decline recovered part of it. | Hurts |
| MedRGAG: Three-Stage Knowledge Gap-Filling via Summarization, Gap Analysis, and Context GenerationOct 21, 2025 | 73 | Summarizing sources, naming knowledge gaps and generating only targeted briefs for those gaps added +12.5% accuracy over plain retrieval. | Helps |
| Instruction Retrieval: External Memory for Small Models via Ready-Made InstructionsOct 15, 2025 | 70 | Retrieving the top-5 ready-made task instructions into a small model's prompt added +9% on medical and +8% on legal questions; long instructions cut accuracy by up to -18%. | Helps |
| Epistemic Blinding: How to Check Whether an LLM Is Analyzing Your Data — or Swapping It for Its Own MemoryApr 7, 2026 | 81 | Replacing brand names with codes changed 30-40% of a model's top-20 financial picks, measuring how much of an analysis came from memory rather than the data. | Mixed |
| File-Native Context Engineering: How to Structure Knowledge for LLMs in FilesFeb 5, 2026 | 91 | Frontier models were +2.7% more accurate reading structured files on demand than reading everything in the prompt, while some open models lost up to 22%. | Mixed |
| Epistemic Blind Spot: LLMs Trust Text That Looks Academic Instead of Checking the NumbersJun 3, 2026 | 85 | Evaluating each source in isolation before synthesis made models check the numbers, catching implausible statistics such as a 0.97 correlation with n=12. | Helps |
| A Structured Prompt for Document Analysis: Three Commands That Kill HallucinationsJul 22, 2025 | 73 | Separating instructions from data with tags and requiring a plan, a citation per point and an explicit 'not in the text' ties the analysis to specific paragraphs; the combination worked better than any single element. | Helps |
| Lost-in-the-Later: two phrases that cure the model's blindness to the end of a long textJul 7, 2025 | 72 | Two instructions, 'use ONLY this text' and 'cover ALL parts evenly', counter the model's tendency to process the end of a long context worse. | Helps |
| RAG Systems: How to Write Prompts When There Are Two Engines Inside, Not OneJul 9, 2025 | 75 | In RAG tools most failures came from the retrieval stage; explicit search terms without polite filler or typos fixed answers the documents did contain. | Helps |
| M-OS: specs + reviews in one prompt give you an expert-level reviewJul 7, 2025 | 72 | Putting manufacturer specs next to user reviews let the model tie opinions to concrete parameters instead of retelling reviews. | Helps |
| PRISM: A Three-Agent System for Precise Information RetrievalOct 16, 2025 | 90 | Splitting retrieval into a strict selector and a completeness-seeking adder, iterated 2-3 times, produced compact evidence sets for multi-hop questions. | Helps |
Prompts to copy
Answer only from the document
Based ONLY on the document below, answer the question.
Do not use prior knowledge. Use only what
the document says. If the answer isn't in the document,
say so directly.
Document:
{document_text}
Question: {question}
From: Three Regimes of Conflict: Why the Model Ignores Your Document — and How to Fix It
Line-number extraction (two requests)
TEMPLATE (two requests):
── REQUEST 1 ──
Number every line of the text below.
Numbering format: [N] line text
Number every line, including short ones.
{paste the document or section text}
── REQUEST 2 (after you get the numbered text) ──
Here is the numbered text.
Question: {your question}
Instructions:
- Return only the numbers of the lines needed to answer
- Pick the minimal sufficient set
- No text of your own — numbers only
- Format: comma-separated numbers
{paste the numbered text from request 1}
Evidence sufficiency check: required, confirmed, gaps
You are a Strategic Intelligence Analyst. Your mission is to determine if the provided evidence is sufficient to answer the user's query comprehensively and accurately. Follow this structured thinking process: 1. **Deconstruct the Query**: Break down the user's question into a checklist of discrete, required informational components or "findings." 2. **Audit the Evidence**: Systematically evaluate the collected evidence against your checklist. - **Confirmed Findings**: Which required components are explicitly supported by the evidence? - **Remaining Gaps**: Which required components are NOT addressed or only partially addressed? 3. **Sufficiency Decision**: - If ALL required findings are confirmed by the evidence → "Yes" - If ANY required finding remains a gap → "No" You MUST output your assessment in this EXACT format: **Required Findings:** [Numbered list of informational components needed] **Confirmed Findings:** [Numbered list of findings confirmed by evidence] **Remaining Gaps:** [Numbered list of findings NOT confirmed] **Is Sufficient:** [Yes/No] Be rigorous. Do not assume. If a finding is not explicitly supported, it is a gap.
From: SEA (Structured Evidence Assessment): Explicit Gap Analysis for Complex Questions
Related techniques
Problems it helps with:
Questions people ask
How do I make ChatGPT or Claude answer only from my document?
Put an explicit framing line before the document: 'Based ONLY on the document below, answer the question. Do not use any other knowledge. If the answer isn't in the document, say so.' In one study that single line moved document-following by up to 94 percentage points. Give the document before discussing the topic.
Why does the model ignore facts that are in my document?
It weighs your text against its training memory, and holds on harder for well-known facts or after it has already answered. Long reasoning before reading the documents also weakens their use. Frame the source explicitly, put documents early, and ask for quotes or line numbers.
Does adding sources or citations to a prompt make answers more accurate?
Not automatically. In AuthorityBench a citation attached to a claim raised error rates for every model tested, and repeated arguments swayed models more than independent ones in GroupQA. Ask the model to judge claims on content and to weigh quality, not frequency.
What is the most hallucination-resistant way to extract from a document?
Have the model select rather than write. In the SafeLLM study, numbering the lines and asking only for line numbers, then assembling the answer from the original text, worked best. It suits exact lookups, not questions that need synthesis across sections.