Back to blog
Engineering11 min read

Grounding Techniques: Keeping AI Tied to Your Facts

Grounding AI prompts means restricting a model to text you provide, not its training data. Anthropic's own verified techniques for this, quoted directly, and where they still fail.

NH
Nafiul Hasan
Founder, Prompt Architects

TL;DR: Grounding AI prompts means restricting the model to text you actually hand it, not its training data. Anthropic's own hallucination-reduction guide names three concrete techniques: restrict the model to only your documents, make it quote sources before answering, and let it say "I don't know". None of this makes a citation proof by itself. It only narrows what the model is allowed to invent.

What Does Grounding Actually Mean for an AI Prompt?

A model answering from its training data is producing its best guess at what's probably true, shaped by whatever it happened to read most about a topic. Grounding is the opposite move. You hand the model a specific document, a transcript, a set of search results, a support ticket, and instruct it to answer from that text alone. That is what grounding AI prompts actually means in practice, and it's close to the entire reason retrieval-augmented systems (RAG) exist. See RAG vs Fine-Tuning vs Prompting for how an automated retrieval pipeline differs from doing this by hand in a single prompt.

The distinction matters because a model doesn't automatically know whether it's supposed to answer from what it already knows or from what you just handed it, unless you tell it which one you mean. Left to its defaults, it blends both, filling gaps in your source material with whatever its training data supplies, often without flagging which part came from where. Grounding, done properly, closes that gap. It tells the model which facts are in play and which are off-limits, and it gives you a way to check the answer against something that isn't the model's own memory.

Why Do Ungrounded Answers Go Wrong So Often?

The clearest public evidence of what happens without real grounding comes from a study that tested exactly this. Columbia Journalism Review's Tow Center for Digital Journalism published "AI Search Has a Citation Problem" (Klaudia Jaźwińska and Aisvarya Chandrasekar, March 6, 2025), which fed eight AI search tools, ChatGPT Search, Perplexity, Perplexity Pro, DeepSeek Search, Copilot, Grok 2, Grok 3, and Gemini, direct excerpts from real news articles and asked each one to identify the headline, publisher, date, and URL. The tools should have had everything they needed: the exact text was right there in the query.

They still got it wrong at scale. Across 1,600 queries, the study reports: "Collectively, they provided incorrect answers to more than 60 percent of queries." The rate wasn't uniform: "Perplexity answering 37 percent of the queries incorrectly, while Grok 3 had a much higher error rate, answering 94 percent of the queries incorrectly." ChatGPT Search did no better on volume: "ChatGPT, for instance, incorrectly identified 134 articles, but signaled a lack of confidence just fifteen times out of its two hundred responses, and never declined to provide an answer." That's 134 wrong out of 200, a 67 percent error rate, with almost no hedging.

One finding needs a narrower scope than it usually gets: the fabricated-URL problem, where a chatbot links to a page that returns an error, was concentrated in two tools. More than half of Gemini and Grok 3's citation links led to dead pages; other tools mostly didn't share that specific failure, since "it happened far less frequently with other chatbots." Don't extend that particular claim to every tool in the study. The 60-percent-plus overall wrong-answer rate is the one that generalizes.

The Core Technique: Tell the Model to Use Only What You Give It

The most direct grounding technique has nothing to do with the model's confidence or its training. It's an instruction. Anthropic's own guide to reducing hallucinations lists it as a strategy in its own right, calling it "External knowledge restriction": "Explicitly instruct Claude to only use information from provided documents and not its general knowledge." That single sentence, added to a prompt that already contains your source text, is doing more work than most people expect from one line.

Pair it with the same guide's simplest recommendation, letting the model admit it doesn't know: "Explicitly give Claude permission to admit uncertainty." A prompt that grounds the model in a document but never gives it permission to come up empty will often produce a confident answer anyway, stitched together from whatever the source material gestures toward. A template that does both:

You are a [role]. Answer the question below using ONLY the
text inside the <context> tags below. Do not use any outside
knowledge, even if you are confident it is correct.

<context>
[paste your source document, transcript, or search results here]
</context>

Question: [your question]

If the answer is not contained in the context above, say
"Not found in the provided text" instead of answering from
memory.

Where Should the Source Document Go in Your Prompt?

Placement is not a stylistic choice; it changes measured output quality. Anthropic's current prompt-engineering guidance is specific about this for anything over roughly 20,000 tokens: "Place your long documents and inputs near the top of your prompt, above your query, instructions, and examples." The same page adds a number worth knowing: "Queries at the end can improve response quality by up to 30 percent in tests, especially with complex, multidocument inputs." The source goes first, the question goes last, and the two should not trade places out of habit.

This is one of several documented cases where instruction order changes what a model actually does with a prompt, not just how it feels to write. If you want the fuller picture, including what happens when instructions conflict rather than just when they're reordered, see Does Instruction Order Change the Output? (Yes). For multiple documents, wrap each one in its own tag with a source label, rather than pasting them all into one undifferentiated block; a model asked to ground an answer in three documents needs to be able to tell which claim came from which one.

Should You Make the Model Quote Its Sources First?

The second Anthropic technique goes further than instructing the model to stay in scope. It asks the model to prove it, before it answers. The guide's phrasing: for long documents, "ask Claude to quote relevant parts of the documents first before carrying out its task." The mechanism is straightforward. A model that has to locate and copy out an actual sentence has a much narrower path to inventing one, compared with a model that jumps straight to a paraphrased summary a reader has no way to check against the source.

Before answering, find the exact sentences in the document
below that are relevant to the question. Place them inside
<quotes> tags, unedited. Then answer the question using only
those quotes as support.

<document>
[paste source text here]
</document>

Question: [your question]

If you cannot find a supporting quote for part of your
answer, remove that part rather than stating it anyway.

Does Requiring Citations Actually Stop Fabrication?

Not on its own, and this is the part of grounding that gets oversold. A citation requirement forces the model to attach a claimed source to each statement. It does not force that source to actually say what the model claims it says, and it does not stop the model from believing its own citation is accurate when it isn't. That gap is exactly what the CJR study measured: the search tools it tested were, in effect, citation-required by design, since producing a source is the entire point of an AI search product, and they were still wrong on the majority of queries.

The narrower, well-documented failure mode is a model checking its own claim inside the same conversation that produced it, which defeats the purpose of the check. If you want the full mechanics of that, including the federal court case where a lawyer's own attempt to verify fabricated citations failed twice in the same chat, see Verification Prompting: Make the Model Check Its Own Work. Grounding and verification are complementary, not the same technique: grounding restricts what the model can draw from going in, verification checks what it produced coming out. Anthropic's own guide is honest about the ceiling on both: "while these techniques significantly reduce hallucinations, they don't eliminate them entirely." Its very next line states the practical takeaway directly: "Always validate critical information, especially for high-stakes decisions."

A Product Built Entirely Around Grounding: Gemini Notebook

Gemini Notebook (the tool most people still know by its former name, NotebookLM) is a useful concrete case, because grounding isn't a feature bolted onto it; it's the entire premise. You upload sources, and the tool is designed to answer only from what you've given it rather than from open-ended model knowledge. Google's own support documentation states a file-size limit of 500,000 words per source (or up to 200MB for local uploads), which sets a hard ceiling on how much you can hand it per source at once.

That's the same restrict-to-context idea from earlier in this post, just implemented as a product default instead of a line you write into a prompt yourself. If you want the fuller walkthrough, including how it handles citations back to your uploaded sources, see How to Prompt NotebookLM (Source-Grounded Only).

Grounded vs. Ungrounded: What Actually Changes

What changes when you restrict a prompt to provided context, and what doesn't
FeatureUngrounded promptGrounded prompt
Draws on training data by default
Requires you to supply source text
Can say "not in the provided text" instead of guessing
Citations point to text you can actually check
Still capable of misreading or paraphrasing a source wrong
Removes the need for outside verification

Can a Source Document Hijack Your Own Prompt?

There's a real cost to treating every pasted document as pure, inert content, and it runs in the opposite direction from fabrication. If the text you're grounding the model in comes from an untrusted source, a scraped web page, a user-submitted file, a public form response, instructions hidden inside that text can be read by the model as commands rather than as information to summarize. That's prompt injection, and grounding a model in outside content is exactly the workflow that creates the exposure. See Prompt Injection Attacks: How to Protect Your AI App for the fuller defense.

What Can't Grounding Fix?

Grounding narrows a specific failure mode: a model reaching for training-data guesswork when real source text was available. It does not fix everything adjacent to that problem. A grounded model can still summarize a source inaccurately, misjudge which of several conflicting documents to trust, or answer confidently from a document that was itself wrong. See Why Does ChatGPT Make Things Up? for the broader diagnostic picture beyond the document-grounding case covered here.

None of this is an argument against the technique. It's an argument for using it precisely: restrict the model to real text, ask it to quote before it claims, place that text where the documentation says it performs best, and treat the result as a well-sourced draft rather than a verified fact. That's a meaningfully better starting point than an ungrounded answer, and a meaningfully worse one than a checked one. Both halves of that sentence are true at once, and a prompt that only handles the first half is only half done.

Free Chrome Extension

Stop rewriting prompts. Start shipping.

Works with ChatGPT, Claude, Gemini, Grok, Midjourney, Ideogram, Veo3 & Kling. 4.8★ on the Chrome Web Store.

Create An Account

Frequently asked questions

Free Chrome Extension

Stop rewriting prompts. Start shipping.

Works with ChatGPT, Claude, Gemini, Grok, Midjourney, Ideogram, Veo3 & Kling. 4.8★ on the Chrome Web Store.

Create An Account