Reliability, Safety & Security / Hallucination & Grounding

Grounding

Intermediate [3/5]
Fact grounding Knowledge grounding Source anchoring

Definition

Grounding is the practice of anchoring LLM responses in verifiable source material rather than letting the model generate from its training data alone. It ensures outputs are based on specific, citable information rather than potentially hallucinated content.

RAG is the most common grounding technique, but grounding also includes citing sources, using structured data, and verifying claims.

Key Concepts

  • Source attribution: Citing where information comes from
  • Context injection: Providing source documents in the prompt
  • Verification: Checking claims against known facts
  • Constrained generation: Limiting output to information in sources

Examples

Grounded Response
With vs Without Grounding
❌ UNGROUNDED (from training data): "Our company's refund policy allows returns within 30 days of purchase." → May be hallucinated or outdated! ✅ GROUNDED (from provided context): "According to your refund-policy.pdf (page 2): 'Customers may return items within 45 days of purchase for a full refund, provided the item is in original condition.'" → Verifiable, citable, accurate
Grounded responses reference specific sources, making them verifiable.
Grounding Techniques
How to Ground Responses
1. RAG (Retrieval-Augmented Generation) Retrieve relevant documents → Include in prompt → Generate based on retrieved content 2. CITATION REQUIREMENTS "Only make claims you can cite from the provided documents. Include [Source: X] after each factual claim." 3. EXTRACTION-ONLY MODE "Extract and summarize information from the provided text. Do not add any information that isn't explicitly stated." 4. STRUCTURED OUTPUT Force responses to match a schema that includes source fields for each claim 5. FACT-CHECKING CHAIN Generate → Verify against sources → Revise
Multiple techniques can be combined for stronger grounding.
Grounding Prompt Pattern
Instructing Models to Stay Grounded
SYSTEM PROMPT: """ You are a helpful assistant that ONLY provides information found in the provided documents. Rules: 1. Only state facts from the provided context 2. Cite your source after each claim: [Source: doc_name] 3. If information isn't in the context, say: "I don't have information about that in the provided documents." 4. Never make up information or use general knowledge 5. If asked to speculate, clearly label it as such Context documents will be provided in each message. """
Clear instructions help models stay grounded in provided sources.

Interactive Exercise

📎
Write a Grounded Response

Given this context document, write a grounded response to the question:

Context: "TechCorp offers 24/7 customer support via phone (1-800-TECH) and email (support@techcorp.com). Response time for email is within 4 business hours."

Question: "How can I contact TechCorp support?"

Include proper citations!

Pro Tips
  • Always require citations in high-stakes applications
  • Use specific document references (page numbers, sections)
  • Train users to verify citations independently
  • Combine grounding with confidence indicators

Related Terms