This prompt is designed for a specific, high-precision job: evaluating every sentence in a generated answer against a provided source context to determine if it is grounded in evidence. The primary user is a QA engineer or an eval pipeline builder who needs to move beyond a holistic 'does this look right?' review and into a fine-grained, auditable verification process. The ideal scenario is a post-generation guardrail in a RAG system, where an LLM has produced an answer and you need to programmatically identify exactly which sentences are safe to show a user and which contain unsupported fabrications. It is also highly effective as a debugging tool during prompt engineering, allowing you to see precisely where your generation prompt is causing the model to hallucinate, and as part of an automated regression test suite to catch factual regressions before they ship.
Prompt
Sentence-Level Grounding Check Prompt

When to Use This Prompt
Understand the ideal use cases, required inputs, and critical limitations of the Sentence-Level Grounding Check prompt before integrating it into your QA pipeline.
For this prompt to be effective, the generated answer must contain discrete, verifiable factual claims. It works best on expository or analytical text, such as summaries, reports, or direct answers to questions. The source context must be sufficiently rich to make a grounding judgment; if the provided context is sparse or only tangentially related to the answer, the prompt will correctly flag most sentences as ungrounded, which is a true signal about your retrieval pipeline, not a failure of the grounding check itself. You must provide the full generated answer and the complete source context as inputs. The output is a structured, sentence-by-sentence grounding map, typically a JSON array where each element contains the original sentence and a verdict like GROUNDED or UNGROUNDED, often with a brief rationale pointing to the specific source span. This structure allows for surgical removal or highlighting of fabricated details in a user interface.
Do not use this prompt when the generated answer is purely stylistic, conversational, or subjective, such as an open-ended creative story, a greeting, or an empathetic response where there is no factual claim to verify. It is also the wrong tool for evaluating the overall quality, tone, or helpfulness of an answer; its sole focus is factual grounding. If your goal is to check if a citation points to a real source that actually supports the claim, use the Citation-to-Evidence Cross-Reference Prompt instead. If you need to classify the type of hallucination (e.g., fabrication vs. unsupported inference), use the Faithful Synthesis vs. Fabrication Classification Prompt. This prompt is your scalpel for isolating unsupported sentences; use it when you need a precise, claim-level grounding map before an answer reaches a user or as a high-signal metric in your evaluation suite.
Use Case Fit
Where the Sentence-Level Grounding Check Prompt works well and where it introduces risk. Use these cards to decide if this prompt fits your pipeline before you integrate it.
Good Fit: Fine-Grained Hallucination Detection
Use when: You need to identify exactly which sentences in a generated answer are fabricated, not just whether the answer is 'mostly correct.' Guardrail: This prompt is ideal for surgical removal of unsupported claims in high-stakes domains like legal, medical, or financial Q&A where partial correctness is still a failure.
Bad Fit: Open-Domain Creative Generation
Avoid when: The task is creative writing, brainstorming, or summarization of subjective material where 'grounding' is not a binary concept. Guardrail: Applying sentence-level grounding checks to creative outputs will produce false positives, flagging legitimate stylistic choices as hallucinations. Use a different evaluation rubric for creative tasks.
Required Inputs: Atomic Context Chunks
Risk: The prompt fails silently if the provided context is too long, poorly chunked, or contains irrelevant passages. The model may mark sentences as ungrounded simply because it cannot locate the evidence in a wall of text. Guardrail: Pre-chunk your context into discrete, retrievable passages with clear IDs. Provide no more than 5-10 relevant chunks per check to keep the model's attention focused.
Required Inputs: Complete Generated Answer
Risk: If you pass only a fragment of the answer, the model loses discourse context and may misclassify sentences that rely on previous sentences for their meaning. Guardrail: Always pass the full generated answer, not a truncated version. If the answer is very long, batch the check by paragraph while preserving surrounding sentences for context.
Operational Risk: Latency and Cost at Scale
Risk: Running a separate LLM call for every generated answer doubles your latency and inference cost. This can make real-time applications unresponsive. Guardrail: Use this prompt as an offline eval step or an async guardrail, not a synchronous blocker in a user-facing chat loop. For real-time needs, consider a smaller, fine-tuned classifier model.
Operational Risk: Model Over-Refusal
Risk: The checker model may become overly strict, flagging legitimate paraphrasing or common-sense inferences as 'ungrounded' because the exact phrasing is absent from the source. Guardrail: Calibrate the prompt with a few-shot examples that distinguish between faithful synthesis (allowed) and fabrication (flagged). Run a calibration set with known ground-truth labels before deploying.
Copy-Ready Prompt Template
A reusable prompt template for performing sentence-level grounding checks, ready to be copied and adapted with your application's data.
This prompt template is the core engine of your sentence-level hallucination detection pipeline. It instructs the model to evaluate each sentence in a generated answer against the provided source context, producing a structured grounding map. The template uses square-bracket placeholders for all dynamic inputs—replace these with your application's data before sending the request to the model. The output is a JSON object that maps each sentence to a grounding verdict, enabling precise, automated removal or flagging of fabricated details.
textYou are a precise factual auditor. Your task is to evaluate each sentence in the provided [ANSWER] against the [CONTEXT] to determine if it is factually grounded. ## INPUT **Context:** [CONTEXT] **Answer to Audit:** [ANSWER] ## INSTRUCTIONS 1. Split the answer into individual sentences. Use the sentence boundaries exactly as they appear in the answer. 2. For each sentence, determine if all its factual claims are directly supported by the provided context. 3. Classify each sentence into one of three categories: - **GROUNDED**: Every factual claim in the sentence is explicitly stated in or directly inferable from the context. - **UNSUPPORTED**: The sentence contains at least one factual claim that is not present in the context. This includes invented names, numbers, dates, events, or causal relationships. - **CONTRADICTED**: The sentence makes a claim that directly conflicts with information in the context. 4. For UNSUPPORTED or CONTRADICTED sentences, provide a brief reason explaining what is wrong and, if applicable, quote the conflicting context. ## CONSTRAINTS - Do not judge the quality, style, or fluency of the answer. Only assess factual grounding. - If the context is empty or contains no relevant information, classify all sentences as UNSUPPORTED. - If a sentence is a subjective opinion, a question, or purely conversational, classify it as GROUNDED only if the context supports the conversational act itself. - Do not use outside knowledge. Base your judgment solely on the provided context. ## OUTPUT SCHEMA Return a valid JSON object with the following structure. Do not include any text outside the JSON object. { "sentences": [ { "index": 0, "text": "The exact sentence from the answer.", "verdict": "GROUNDED", "reason": null }, { "index": 1, "text": "Another sentence.", "verdict": "UNSUPPORTED", "reason": "Claims the release date is June 2024, but the context only mentions a Q3 2024 release window." } ], "summary": { "total_sentences": 5, "grounded_count": 3, "unsupported_count": 1, "contradicted_count": 1 } }
To adapt this template for your application, replace the placeholders as follows: [CONTEXT] with the retrieved passages, formatted with their identifiers (e.g., [Doc-1] ...). [ANSWER] with the full generated response you need to audit. [OUTPUT_SCHEMA] can be left as-is or replaced with a custom schema if your downstream pipeline requires different field names. For high-risk deployments, add a [RISK_LEVEL] placeholder that adjusts the strictness of the grounding criteria—for example, in a clinical setting, you might require verbatim support rather than reasonable inference. After replacing the placeholders, validate that the output JSON conforms to your expected schema before processing the grounding map. A single malformed output should trigger a retry with a repair prompt, not a silent failure.
Prompt Variables
Required and optional inputs for the Sentence-Level Grounding Check Prompt. Each variable must be populated before the prompt is assembled and sent to the model. Missing or malformed inputs are the most common cause of false negatives in grounding checks.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[ANSWER_TEXT] | The generated answer to evaluate sentence-by-sentence. Must be the full answer string, not a truncated preview. | The Paris Agreement was signed in 2015 by 196 parties. It aims to limit warming to 1.5 degrees Celsius above pre-industrial levels. | Check: non-empty string. Null or empty string must abort evaluation. Multi-sentence input is expected; single-sentence input is valid but reduces the value of sentence-level decomposition. |
[CONTEXT_PASSAGES] | The retrieved source passages that the answer claims to be grounded in. One or more passages, each with a unique identifier. | Passage 1 (ID: doc_42_para_3): The Paris Agreement is a legally binding international treaty on climate change. It was adopted by 196 Parties at COP21 in Paris on 12 December 2015 and entered into force on 4 November 2016. | Check: array or concatenated string with non-empty passage IDs. Each passage must have a stable identifier for citation mapping. Null or empty array must abort evaluation. Passages without IDs must be rejected before prompt assembly. |
[SENTENCE_LIST] | Pre-extracted list of sentences from the answer text, each with a positional index. Used to anchor the grounding map and prevent the model from re-tokenizing the answer. | Sentence 1: The Paris Agreement was signed in 2015 by 196 parties. Sentence 2: It aims to limit warming to 1.5 degrees Celsius above pre-industrial levels. | Check: array of objects with index (integer, zero-based) and text (string). Sentence count must match the actual sentence count of [ANSWER_TEXT]. Mismatch triggers a retry of sentence extraction before grounding evaluation. Null allowed only if the model is instructed to perform its own sentence splitting. |
[GROUNDING_THRESHOLD] | The minimum confidence or evidence-match standard required to label a sentence as grounded. Controls the strictness of the grounding decision. | strict | Check: enum value from [strict, moderate, lenient]. strict requires explicit source-text match for every factual claim. moderate allows reasonable paraphrase. lenient accepts thematic alignment. Default is strict for hallucination detection use cases. Invalid enum values must fall back to strict. |
[OUTPUT_FORMAT] | The schema definition for the grounding map output. Ensures the model returns a parseable, structured result rather than free-text commentary. | JSON array of objects with fields: sentence_index (int), sentence_text (string), grounding_status (enum: grounded, partially_grounded, ungrounded), supporting_passage_ids (array of strings), rationale (string) | Check: valid JSON Schema or a natural-language description of the expected fields. Must include grounding_status as a controlled enum. If null, the prompt must include explicit format instructions inline. Schema mismatch between prompt and parser is a common integration failure. |
[CITATION_STYLE] | The expected format for linking sentences back to source passages. Controls how supporting_passage_ids are populated. | passage_id_only | Check: enum value from [passage_id_only, passage_id_with_span, passage_id_with_quote]. passage_id_only returns only the passage identifier. passage_id_with_span requires character offsets. passage_id_with_quote requires the exact source text. Default is passage_id_only. passage_id_with_span requires [CONTEXT_PASSAGES] to include character offset metadata. |
[ABSTENTION_POLICY] | Instructions for how the model should handle sentences it cannot evaluate due to ambiguous evidence or insufficient context. | flag_as_uncertain | Check: enum value from [flag_as_ungrounded, flag_as_uncertain, skip_sentence]. flag_as_ungrounded treats insufficient evidence as a grounding failure. flag_as_uncertain adds an explicit uncertainty label distinct from ungrounded. skip_sentence omits the sentence from the output map. Default is flag_as_ungrounded for high-recall hallucination detection. flag_as_uncertain is preferred when downstream reviewers need to distinguish fabrication from evidence gaps. |
Implementation Harness Notes
How to wire the Sentence-Level Grounding Check into an application for automated hallucination detection.
The Sentence-Level Grounding Check prompt is designed to operate as a post-generation validation step within a RAG pipeline, sitting between answer synthesis and user delivery. Its primary job is to accept a generated answer and the retrieved context that was used to produce it, then return a structured map indicating whether each sentence is grounded in that context. This harness is not a standalone chatbot; it is a programmatic guardrail that should be called synchronously after every answer generation, with its output dictating whether the answer is released, flagged for review, or automatically repaired.
To wire this prompt into an application, first split the generated answer into sentences using a deterministic sentence tokenizer (e.g., NLTK's sent_tokenize or spaCy's sentence boundary detection) before calling the model. Pass the tokenized sentence list alongside the full retrieved context into the prompt template. The model should return a JSON object mapping each sentence index to a grounding verdict (GROUNDED, PARTIALLY_GROUNDED, or UNSUPPORTED) and the specific source span that supports it. Implement a strict JSON schema validator on the model's response; if the output fails to parse or is missing sentence indices, retry once with a stronger format constraint. Log every validation failure and the final verdict map for observability. For high-stakes domains, route any answer containing one or more UNSUPPORTED sentences to a human review queue rather than blocking silently.
Choose a model with strong instruction-following and JSON mode support for this task, as structured output reliability is critical. GPT-4o and Claude 3.5 Sonnet are good defaults. Set temperature to 0 to minimize variability in verdicts. If your application has strict latency requirements, consider batching multiple answers in a single call, but ensure the prompt clearly separates each answer-context pair to avoid cross-contamination. Avoid using this check on answers shorter than two sentences, as single-sentence outputs often produce ambiguous grounding signals. The next step after implementing this harness is to build a dashboard that tracks grounding pass rates over time, alerting you when hallucination rates drift upward—often a sign that your retrieval pipeline needs attention.
Expected Output Contract
Defines the structure, types, and validation rules for the Sentence-Level Grounding Check output. Use this contract to parse and validate the model's response before downstream consumption.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
sentences | Array of objects | Must be a JSON array. Parse check: valid JSON. Schema check: each element must be an object. Length must equal the number of sentences in [ANSWER]. | |
sentences[].sentence_index | Integer | Zero-based index. Must be sequential starting from 0. Schema check: integer type, no gaps, no duplicates. | |
sentences[].sentence_text | String | Must exactly match the original sentence text from [ANSWER], including punctuation and whitespace. Validation: string equality check against the source answer. | |
sentences[].grounding_status | String (enum) | Must be one of: 'GROUNDED', 'PARTIALLY_GROUNDED', 'UNGROUNDED'. Schema check: enum membership. No other values allowed. | |
sentences[].source_evidence | Array of strings or null | If grounding_status is 'GROUNDED' or 'PARTIALLY_GROUNDED', must contain at least one verbatim quote from [CONTEXT]. If 'UNGROUNDED', must be null. Validation: substring check against provided context. | |
sentences[].rationale | String | Must be a non-empty string explaining the grounding decision. Must reference specific evidence spans or explicitly state no evidence was found. Validation: length > 0, must mention evidence or absence. | |
sentences[].fabrication_risk | String (enum) | Must be one of: 'NONE', 'LOW', 'MEDIUM', 'HIGH'. Schema check: enum membership. 'HIGH' requires grounding_status to be 'UNGROUNDED'. Validation: cross-field consistency check. | |
overall_grounding_score | Number (0.0 to 1.0) | Must be a float between 0.0 and 1.0 inclusive. Represents the proportion of sentences with grounding_status 'GROUNDED'. Validation: range check, must equal (count of GROUNDED / total sentences) within a 0.01 tolerance. |
Common Failure Modes
Sentence-level grounding checks are precise but brittle. Here are the most common failure modes and how to build guardrails that catch them before they reach users.
False Negatives from Implicit Context
What to watch: The checker flags a sentence as ungrounded because the supporting evidence is spread across multiple passages or requires commonsense inference. The sentence is factually correct but the model cannot locate a single contiguous span. Guardrail: Include a 'multi-hop reasoning' pass before grounding checks. Allow the model to synthesize evidence from up to three passages and cite the combination, not just a single chunk.
False Positives from Near-Duplicate Text
What to watch: The checker marks a sentence as grounded because it contains keywords that appear in the source, but the semantic meaning is inverted or fabricated. The model confuses lexical overlap with genuine support. Guardrail: Add a semantic entailment step after keyword matching. Require the checker to restate the source passage in its own words and compare that restatement to the claim, not just scan for shared tokens.
Boundary Errors on Sentence Splitting
What to watch: The sentence splitter breaks a complex sentence into fragments that lose context, or merges two independent claims into one sentence. The grounding verdict applies to the wrong unit of text. Guardrail: Run a pre-check that validates sentence boundaries against claim boundaries. If a sentence contains multiple verifiable claims, split it before grounding. If a claim spans two sentences, merge them into a single check unit.
Context Window Truncation
What to watch: The checker receives only a subset of the retrieved context because the full evidence set exceeds the model's context window. Sentences are flagged as ungrounded when the supporting passage was simply not provided to the checker. Guardrail: Implement a two-pass architecture. First, run a lightweight retrieval step specifically for the checker using the sentence as a query. If new evidence is found, re-run the grounding check with the expanded context.
Checker Drift on Ambiguous Sentences
What to watch: The checker produces inconsistent verdicts for the same sentence across multiple runs, especially on vague or hedged claims. The grounding decision becomes a coin flip. Guardrail: Add a confidence score to each verdict. If the checker's confidence is below a threshold (e.g., 0.8), escalate the sentence to human review or a more expensive verification prompt. Log all low-confidence decisions for prompt improvement.
Citation Fabrication in the Check Itself
What to watch: The grounding checker hallucinates a supporting quote or invents a passage reference that does not exist in the provided context. The checker becomes the source of fabrication. Guardrail: Run a secondary verification that confirms every quoted span from the checker's output exists verbatim in the original context. Use exact string matching or a deterministic span validator before trusting the grounding verdict.
Evaluation Rubric
Use this rubric to evaluate the quality of the Sentence-Level Grounding Check prompt's output before integrating it into a production pipeline. Each criterion targets a specific failure mode.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Output Structure | Valid JSON array with one object per sentence, each containing 'sentence_index', 'sentence_text', and 'grounding_status' fields. | Malformed JSON, missing required fields, or output is a string instead of an array. | Schema validation against a defined JSON Schema. Parse check in test harness. |
Sentence Coverage | The number of output objects exactly matches the number of sentences in [ANSWER]. No sentences are skipped or merged. | Output object count differs from sentence count. A sentence from [ANSWER] is missing from the output. | Sentence tokenizer comparison. Assert len(output) == len(tokenized_sentences). |
Grounding Status Values | Every 'grounding_status' field is exactly one of the allowed values: 'GROUNDED', 'UNSUPPORTED', or 'CONTRADICTED'. | A status value is misspelled, null, or an unlisted string like 'PARTIALLY_GROUNDED'. | Enum check. Assert all statuses are in the allowed set. |
Grounding Accuracy | A sentence is 'GROUNDED' only if its meaning is directly supported by [CONTEXT]. 'UNSUPPORTED' if no evidence exists. 'CONTRADICTED' if evidence refutes it. | A sentence with fabricated details is marked 'GROUNDED'. A directly supported sentence is marked 'UNSUPPORTED'. | Golden dataset evaluation. Compare model output against human-annotated ground truth labels for precision and recall. |
Citation Presence | For sentences marked 'GROUNDED', the 'source_spans' field contains at least one non-empty string quoting the relevant part of [CONTEXT]. | A 'GROUNDED' sentence has an empty 'source_spans' array or a null value. | Assert len(obj['source_spans']) > 0 for all objects where status is 'GROUNDED'. |
Contradiction Evidence | For sentences marked 'CONTRADICTED', the 'source_spans' field contains the specific text from [CONTEXT] that contradicts the sentence. | A 'CONTRADICTED' sentence lacks a source span, or the provided span does not logically contradict the sentence. | Manual review of a sample set. Automated check for non-empty 'source_spans' on 'CONTRADICTED' items. |
Abstention Handling | If [ANSWER] is empty or a refusal to answer, the output is an empty JSON array | An empty answer produces a non-empty array or a processing error. | Unit test with an empty string and a refusal string as [ANSWER] input. |
Context Relevance | The 'rationale' field for 'UNSUPPORTED' sentences correctly states that no relevant information was found, without hallucinating a reason. | The 'rationale' for an 'UNSUPPORTED' sentence invents a topic or fact not present in the sentence or context. | Spot-check 'rationale' fields for unsupported sentences against the original sentence and context for fabricated justifications. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Wrap the prompt in a validation harness. Send the [ANSWER] and [CONTEXT] with a strict [OUTPUT_SCHEMA] requiring sentences[] with index, text, grounded (boolean), evidence_spans[], and confidence (0-1). Add a retry layer: if JSON parsing fails or required fields are missing, retry once with the error message appended to the prompt.
Prompt modification
Add to the system prompt: If a sentence is partially grounded, mark it as ungrounded and note which parts are missing. Prefer false positives on hallucination over false negatives. Include a grounding_threshold parameter set to 0.7 for confidence filtering.
Watch for
- Silent format drift where the model omits
evidence_spanson borderline cases - Confidence scores that don't correlate with actual grounding quality
- Performance degradation on long answers (>15 sentences) requiring chunking
- Token limits when context is large; consider pre-filtering relevant passages

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us