Skip to main content

Module 7: Grounding

An AI model can sound confident while being completely wrong. Grounding is the practice of tying every claim the agent makes to a verified data source.

The Problemโ€‹

You ask the agent: "What's the liability cap in this contract?"

Without grounding, the agent might generate a plausible number based on patterns it's seen in its training data. It sounds right. It might even be close. But it's not from the actual contract.

In contract review, a hallucinated number isn't a minor error. It's a business risk.

Grounding vs RAGโ€‹

RAG and grounding are related but different:

  • RAG answers the question: "Where does the agent get its information?"
  • Grounding answers the question: "Is the agent actually using that information instead of making things up?"

You can have RAG without grounding (retrieve documents but don't verify the agent cited them correctly). You should never have RAG without grounding in production.

Grounding Techniquesโ€‹

Source citation. Require the agent to cite the specific document and section for every claim. "The liability cap is $100,000 (Source: MSA Section 8.2, page 14)." If the agent can't cite a source, it should say so.

Quote extraction. Instead of letting the agent paraphrase, require it to include the exact quote from the source document. You can programmatically verify the quote exists in the original text.

Confidence scoring. Ask the agent to rate its confidence. "How confident are you that this answer comes from the provided documents? (1-5)." Answers below a threshold get flagged for human review.

Verification step. Add a separate prompt chain step that takes the agent's claims and checks each one against the source documents. This is a grounding validator that catches hallucinations before they reach the user.

In Our Contract Workflowโ€‹

Compliance Agent Output:
"The indemnification clause in Section 7.3 deviates
from our standard template. The contract caps
indemnification at $250,000 (Source: Contract, ยง7.3,
p.12). Our minimum requirement is $500,000
(Source: Policy CB-LEGAL-042, ยง3.1)."
โ†“
Grounding Validator:
โœ“ Contract ยง7.3 exists and mentions $250,000
โœ“ Policy CB-LEGAL-042 ยง3.1 states $500,000 minimum
โ†’ Output is grounded. Pass to next step.

If the validator can't find the cited source, the output gets flagged and the agent is asked to regenerate with correct citations.

Implementation Approachesโ€‹

ApproachComplexityReliability
Prompt-based ("always cite sources")LowMedium - model sometimes ignores
Structured output with source fieldsMediumHigh - enforced by schema
Separate validation chainHighHighest - independent verification

For production systems handling high-stakes decisions (contracts, medical, financial), use the separate validation chain. The cost of an extra inference call is trivial compared to the cost of acting on hallucinated information.

What's Nextโ€‹

Grounding prevents the agent from making things up. In Module 8: Guardrails, we cover how to prevent the agent from doing things it shouldn't.

Premium

Grounding Lab

Build a grounding validation pipeline with source citation extraction, quote verification, and automated hallucination detection.