This prompt is designed for product teams that need to surface calibrated uncertainty to end-users, not just detect hallucinations internally. The job-to-be-done is assigning a defensible confidence score to a generated answer based on how well the provided evidence covers and consistently supports its claims. The ideal user is an AI engineer or product manager integrating this as a post-generation step in a RAG pipeline, where the output—a score and a human-readable explanation—is rendered alongside the answer in a user interface. You need the original user question, the final generated answer, and the complete set of retrieved source passages that were available during generation. Without all three inputs, the prompt cannot assess coverage gaps or cross-reference claims against evidence.
Prompt
Answer Factuality Confidence Scoring Prompt

When to Use This Prompt
Define the job, the user, and the operational boundaries for the Answer Factuality Confidence Scoring Prompt.
Use this prompt when you want to display a confidence indicator (e.g., 'High confidence,' 'Partial support,' 'Low evidence') to help users calibrate their trust. It is appropriate for customer-facing Q&A, internal knowledge base search, and any product surface where a wrong answer carries a non-trivial cost. The prompt works best after you have already run a retrieval step and generated an answer; it is a verification layer, not a replacement for faithful synthesis prompts or citation checks. Do not use this prompt as your sole hallucination guardrail in high-stakes domains like healthcare or legal without additional human review. It estimates confidence from evidence coverage and consistency, but it cannot detect subtle fabrications that sound plausible and align with the source material's tone without actually being stated.
This prompt is not a fact-checker that validates claims against ground truth—it only compares the answer to the provided context. If your retrieval step returns incomplete or irrelevant passages, the confidence score will reflect that gap, but it cannot flag that the retrieval itself failed to find the right document. For that, pair this prompt with an evidence sufficiency gate that runs before answer generation. Also avoid using this prompt for real-time streaming answers where the full text is not yet available; it requires the complete answer to assess overall evidence coverage. If your product needs sentence-level grounding or claim-by-claim verification, use the Sentence-Level Grounding Check Prompt or the Claim-by-Claim Source Verification Prompt instead—this prompt operates at the whole-answer level and is optimized for user-facing confidence display, not granular debugging.
Before wiring this into production, define what score thresholds trigger different UI treatments (e.g., scores below 0.7 get a warning icon, below 0.4 get a 'could not verify' label). Run the prompt against a golden dataset of answers with known evidence relationships to calibrate your thresholds. Expect the model to occasionally produce scores that feel directionally correct but numerically inconsistent across similar cases—log the raw scores and explanations over time to tune your display logic rather than treating the number as a precise measurement. If the confidence explanation contains hedging language that would confuse users, add a post-processing step that maps the explanation to a predefined set of user-facing confidence labels.
Use Case Fit
Where the Answer Factuality Confidence Scoring Prompt works, where it fails, and what you must provide before deploying it.
Good Fit: User-Facing Uncertainty Disclosure
Use when: you need to surface a calibrated confidence indicator alongside an answer so end-users can gauge reliability. Guardrail: always pair the score with a plain-language explanation; never show a raw number without context.
Bad Fit: Binary Pass/Fail Gating
Avoid when: you need a hard yes/no decision on whether to block an answer. A confidence score is a signal, not a gate. Guardrail: combine the score with a threshold rule and a separate hallucination detection prompt for automated blocking.
Required Input: Retrieved Evidence Set
Risk: scoring without source passages produces meaningless confidence numbers. Guardrail: the prompt must receive the full set of retrieved chunks used to generate the answer; missing evidence must be flagged as an input error before scoring.
Required Input: The Generated Answer
Risk: scoring an empty or truncated answer inflates confidence or produces null outputs. Guardrail: validate answer length and completeness upstream; abort scoring if the answer is a refusal, error message, or under a minimum token threshold.
Operational Risk: Overconfident Scores on Fabrication
Risk: the model may assign high confidence to fluent but fabricated answers when evidence is sparse. Guardrail: cross-validate confidence scores against a separate hallucination detection prompt; if scores diverge, escalate for human review.
Operational Risk: Score Inconsistency Across Models
Risk: confidence score distributions shift when you change the underlying model, breaking any hard thresholds. Guardrail: recalibrate thresholds per model version using a golden evaluation set; log score distributions in production to detect drift.
Copy-Ready Prompt Template
A reusable prompt template for scoring the factuality confidence of a generated answer against provided evidence, ready to copy into your evaluation harness.
This template is the core instruction set for an LLM-based confidence scorer. It takes a user question, a generated answer, and the source evidence used to produce that answer, then outputs a calibrated confidence score and a human-readable explanation. The prompt is designed to be model-agnostic and can be dropped directly into an evaluation pipeline, a pre-release gate, or a user-facing uncertainty display system. All dynamic inputs are represented as square-bracket placeholders that your application must populate at runtime.
textYou are an expert factuality auditor. Your job is to assess how well a generated answer is supported by the provided source evidence and assign a calibrated confidence score. ## INPUTS **User Question:** [USER_QUESTION] **Generated Answer:** [GENERATED_ANSWER] **Source Evidence:** [SOURCE_EVIDENCE] ## TASK 1. Extract every factual claim from the Generated Answer. 2. For each claim, determine whether it is: - **Fully Supported**: The evidence directly confirms the claim. - **Partially Supported**: The evidence supports some aspects but not all, or the support is implicit. - **Unsupported**: The evidence does not contain information to confirm or deny the claim. - **Contradicted**: The evidence directly conflicts with the claim. 3. Assign an overall confidence score from 0.0 to 1.0 based on the following scale: - **0.9-1.0**: All claims fully supported; answer is a faithful synthesis of the evidence. - **0.7-0.89**: Most claims fully supported; minor details are partially supported or implicit. - **0.5-0.69**: Mixed support; some claims unsupported but none contradicted. - **0.3-0.49**: Significant unsupported claims; answer may be misleading. - **0.1-0.29**: Mostly unsupported or contains contradictions. - **0.0**: Completely fabricated or directly contradicted by evidence. 4. Write a confidence explanation that: - States the score. - Summarizes the evidence coverage (e.g., "3 of 5 claims fully supported"). - Flags any unsupported or contradicted claims with specific examples. - Is suitable for display to an end user. ## CONSTRAINTS - Do not introduce facts not present in the Source Evidence. - If the Source Evidence is empty or irrelevant, the score must be 0.0. - If the Generated Answer is empty or a refusal, the score is 1.0 with the explanation "No factual claims to verify." - Be strict: partial support is not full support. ## OUTPUT FORMAT Return a single JSON object with the following schema: { "confidence_score": <float between 0.0 and 1.0>, "confidence_explanation": "<string suitable for end-user display>", "claim_verdicts": [ { "claim": "<exact text of the claim>", "verdict": "fully_supported | partially_supported | unsupported | contradicted", "evidence_span": "<relevant excerpt from Source Evidence or null>" } ] } ## RISK LEVEL [RISK_LEVEL] ## EXAMPLES [EXAMPLES]
To adapt this template, start by populating the required inputs. [USER_QUESTION] and [GENERATED_ANSWER] come from your RAG pipeline. [SOURCE_EVIDENCE] should be the exact retrieved passages used during generation, concatenated with document identifiers or chunk IDs for traceability. The [RISK_LEVEL] placeholder lets you inject domain-specific instructions—for example, in a healthcare context you might add: "If any claim is unsupported or contradicted, the confidence score must not exceed 0.3 and the explanation must recommend human review." The [EXAMPLES] placeholder is where you insert few-shot demonstrations of correct scoring behavior, which is critical for calibrating the model's judgment. Without examples, models tend to be overly generous with partial-support scores. Include at least one example where the answer is fully supported, one where it is partially supported, and one where it is contradicted.
Before shipping this prompt, validate that the output JSON matches the schema exactly. A common failure mode is the model producing a confidence_score as a string instead of a float, or omitting the claim_verdicts array when the answer is short. Add a post-processing validator that parses the JSON, checks field types, and clamps the score to the 0.0–1.0 range. For high-stakes deployments, run this prompt against a golden dataset of scored answer-evidence pairs and measure agreement with human raters. If agreement drops below your threshold, adjust the scoring scale descriptions or add more few-shot examples. Never surface a confidence score to users without first verifying that the model's calibration holds on your specific data distribution.
Prompt Variables
Required and optional inputs for the Answer Factuality Confidence Scoring Prompt. Each placeholder must be populated before the prompt is sent. Validation notes describe how to check that the input is well-formed and safe.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[GENERATED_ANSWER] | The full text of the answer to be scored for factuality confidence | The cat sat on the mat. The mat is made of wool. | Must be a non-empty string. Check for null, empty, or whitespace-only input before calling the prompt. |
[RETRIEVED_CONTEXT] | The set of source passages used to generate the answer, with document identifiers | Doc1: The cat sat on a wool mat. Doc2: The mat is blue. | Must contain at least one passage. Validate that each passage has a non-null document ID. Reject if context is empty or all passages are whitespace. |
[USER_QUESTION] | The original question that prompted the answer generation | What did the cat sit on and what is it made of? | Must be a non-empty string. Used to assess whether the answer addresses the question. Null allowed only if scoring an answer without a specific question. |
[CONFIDENCE_SCALE] | The scale definition for the confidence score output | 0-100 where 0 is no evidence support and 100 is fully supported by multiple sources | Must be a string describing the scale range and meaning. Default to 0-100 if not provided. Validate that the scale description is parseable and unambiguous. |
[OUTPUT_SCHEMA] | The expected JSON structure for the confidence score and explanation | {"score": integer, "explanation": string, "evidence_coverage": float} | Must be a valid JSON Schema or example structure. Validate that the schema is parseable JSON before passing to the prompt. Reject if schema contains circular references. |
[CITATION_REQUIREMENT] | Policy for whether citations are required in the confidence explanation | Require inline citations to source document IDs for each evidence claim | Must be a string describing citation rules. Acceptable values include 'none', 'inline', 'footnote', or a custom policy description. Default to 'none' if omitted. |
[ABSTENTION_THRESHOLD] | The minimum confidence score below which the system should abstain from answering | 40 | Must be an integer or null. If provided, validate that it falls within the defined confidence scale range. Null means no automatic abstention is triggered by this prompt. |
[DOMAIN_TERMINOLOGY] | Optional domain-specific terms and definitions to improve scoring accuracy | In this context, 'mat' refers to a floor covering, not a mathematical term. | Optional string. If provided, check for injection attempts such as instructions to ignore previous rules. Sanitize or reject if suspicious patterns are detected. |
Implementation Harness Notes
How to wire the Answer Factuality Confidence Scoring Prompt into a production RAG pipeline with validation, retries, and human review gates.
This prompt is designed to sit as a post-generation quality gate in a RAG pipeline, after an answer has been synthesized but before it reaches the end user. The harness should call the model with the generated answer, the retrieved context passages, and the original user query. The primary output is a structured JSON object containing a confidence_score (typically a float between 0.0 and 1.0 or a categorical label like HIGH/MEDIUM/LOW) and a confidence_explanation string suitable for display. The implementation must treat this as a synchronous or asynchronous validation step whose latency adds directly to the user's perceived response time, so model choice and timeout handling are critical.
Wire the prompt into your application by first constructing the input payload: the [GENERATED_ANSWER], the [RETRIEVED_CONTEXT] (as a list of passage objects with id and text fields), and the [USER_QUERY]. Use a fast, instruction-tuned model for this scoring task—GPT-4o-mini, Claude 3.5 Haiku, or a fine-tuned small model—since the prompt is a classification and explanation task, not a generation task. Implement a strict JSON schema validator on the response. If the model fails to return valid JSON matching the expected {confidence_score, confidence_explanation} schema, retry once with a stronger format constraint appended to the prompt. If the retry also fails, log the raw output and default to a conservative low-confidence score with a generic explanation to avoid blocking the pipeline.
Build a decision rule around the returned confidence_score. For example, if the score is below a defined threshold (e.g., 0.7 or MEDIUM), route the answer to a human review queue instead of delivering it directly. If the score is critically low (e.g., below 0.4 or LOW), suppress the answer entirely and return a 'not enough evidence' message to the user. Log every scoring result—including the input answer, context, score, explanation, and final routing decision—to an observability platform for offline analysis. This log becomes your dataset for calibrating the threshold over time. Avoid using this prompt on answers that are purely conversational, chitchat, or procedural instructions where factuality scoring is meaningless; gate the scoring step behind a classifier that only triggers it for factual, evidence-backed responses.
Expected Output Contract
Defines the structured JSON object the model must return for the Answer Factuality Confidence Scoring Prompt. Use this contract to validate the model's output before surfacing the score to users or downstream systems.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
confidence_score | number (0.0 to 1.0) | Must be a float between 0.0 and 1.0 inclusive. Parse check: ensure value is not a string. If null or out of range, retry the prompt. | |
confidence_label | enum string | Must be one of: 'High', 'Medium', 'Low'. Schema check: reject any other string. Map to score ranges: High >= 0.8, Medium >= 0.5, Low < 0.5. | |
evidence_coverage_ratio | number (0.0 to 1.0) | Represents the proportion of answer claims directly supported by evidence. Must be a float. If greater than 1.0 or negative, flag for human review. | |
contradiction_flag | boolean | Must be true if any evidence passage directly contradicts a claim in the answer, otherwise false. If true, confidence_score should be capped at 0.4. | |
unsupported_claims | array of strings | List of exact text spans from the answer that have no supporting evidence. Empty array allowed. Each string must be a substring of the original answer; if not, log a mismatch error. | |
explanation | string | A human-readable justification for the score, referencing specific evidence gaps or confirmations. Must be non-empty. Max 300 characters. If empty, retry or escalate for manual review. | |
needs_human_review | boolean | Must be true if confidence_score < 0.5 or contradiction_flag is true. Used for automated routing. If true but score is high, flag as a logic error in the model output. |
Common Failure Modes
Confidence scoring prompts can silently fail by producing miscalibrated scores, ignoring evidence gaps, or rewarding fluent but unsupported answers. These cards cover the most common production failure modes and how to guard against them.
Overconfident on Fabricated Answers
What to watch: The model assigns high confidence to fluent, well-structured answers that are entirely fabricated. When evidence is missing or irrelevant, the scorer may still output 0.85+ because the prose reads authoritatively. Guardrail: Require the scorer to first enumerate which claims have explicit source support before computing the score. Add a pre-check that flags zero-evidence answers and forces a score ceiling of 0.3 when no claims are grounded.
Score Inflation from Partial Coverage
What to watch: The scorer treats partial evidence coverage as full support. An answer with five claims where only two are supported may still receive a 0.8 score because the model averages rather than penalizes gaps. Guardrail: Require claim-by-claim grounding before aggregation. Use a weighted scoring rubric where unsupported claims drag the score down proportionally. Set a minimum claim-coverage threshold below which the score is capped.
Ignoring Source Contradictions
What to watch: When multiple sources disagree, the scorer may pick the majority or the most fluent source and ignore the conflict entirely. The confidence score reflects consensus fiction rather than real uncertainty. Guardrail: Add an explicit contradiction-detection step before scoring. If sources conflict, require the confidence explanation to surface the disagreement and cap the score. Flag answers where the model silently resolved ambiguity.
Calibration Drift Across Answer Lengths
What to watch: Short, cautious answers receive lower confidence scores than long, detailed answers even when both are equally grounded. The scorer conflates verbosity with factuality, penalizing concise responses. Guardrail: Normalize scores by answer length or claim count. Test calibration across short, medium, and long answers with identical evidence support. Add a length-invariant scoring instruction that explicitly warns against equating detail with accuracy.
Evidence Blindness from Stale Retrieval
What to watch: The scorer trusts the provided context without checking whether it actually addresses the question. When retrieval returns irrelevant or outdated passages, the scorer may still assign high confidence because the answer faithfully synthesizes bad evidence. Guardrail: Add a pre-scoring relevance check that assesses whether the retrieved context is on-topic and sufficient before scoring begins. If context relevance is low, flag the score as unreliable and recommend re-retrieval.
Confidence Explanation Hallucination
What to watch: The human-readable confidence explanation invents reasoning not supported by the evidence. It may claim "multiple sources confirm" when only one source was used, or cite document sections that don't exist. Guardrail: Require the explanation to reference specific source spans or document IDs. Validate that every cited source in the explanation exists in the provided context. Add a post-hoc check that compares the explanation's claims against the actual evidence.
Evaluation Rubric
Use this rubric to test the Answer Factuality Confidence Scoring Prompt before shipping. Each criterion targets a specific failure mode observed in confidence scoring systems. Run these checks against a golden dataset of scored answer-evidence pairs.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Score Calibration | Confidence score correlates with actual evidence coverage ratio within ±0.15 for 90% of test cases | Score is consistently high (>0.8) for answers with <50% evidence coverage or low (<0.3) for fully-supported answers | Run 50 scored pairs through the prompt; compute Pearson correlation between output score and ground-truth coverage ratio |
Explanation Grounding | Confidence explanation references specific evidence gaps or conflicts, not generic statements | Explanation contains phrases like 'seems reasonable' or 'generally accurate' without citing missing or conflicting passages | Manual review of 20 explanations; check that each explanation mentions at least one concrete evidence relationship |
Abstention Threshold Consistency | Answers with <30% evidence coverage receive confidence ≤0.4 and explanation recommends caution or abstention | Low-coverage answer receives confidence ≥0.6 with no caveat in explanation | Select 10 test cases with known low coverage; verify all outputs fall below 0.4 threshold and include caution language |
Contradiction Penalty | Any detected source contradiction reduces confidence by at least 0.3 from the coverage-only baseline | Answer with documented source conflict receives same confidence as conflict-free answer with similar coverage | Create 5 pairs of test cases differing only in presence of contradiction; verify confidence delta ≥0.3 |
Overclaiming Detection | Explanation flags when answer makes claims absent from evidence, and score reflects this gap | Answer with 40% unsupported claims receives confidence >0.7 | Inject 5 answers with known unsupported claim percentages; verify score drops proportionally and explanation identifies unsupported claims |
Format Compliance | Output is valid JSON matching [OUTPUT_SCHEMA] with all required fields present and correctly typed | Missing confidence_score field, explanation is null or empty, or output is plain text instead of JSON | Schema validation check on 100 outputs; 100% must parse and contain non-null confidence_score and explanation fields |
Edge Case: Empty Evidence | Returns confidence 0.0 with explanation stating no evidence was provided | Returns confidence >0.0 or attempts to score answer quality without evidence grounding | Submit 5 cases with empty evidence array; verify all return confidence 0.0 and explanation mentions missing evidence |
Edge Case: Perfect Match | Returns confidence 0.95-1.0 when all answer claims are directly supported and no contradictions exist | Perfectly supported answer receives confidence <0.9 due to hedging or uncertainty about model's own judgment | Submit 5 cases with complete evidence coverage and zero contradictions; verify all score ≥0.95 |
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
Add strict JSON schema enforcement with field types and required fields. Include 3-5 calibration examples showing score boundaries. Add a retry prompt for malformed outputs. Log every confidence score alongside the answer for monitoring. Wire the score into a display threshold: answers below a minimum confidence get an uncertainty banner.
Prompt modification
Add to constraints: [OUTPUT_SCHEMA]: { "score": number (1-5), "evidence_coverage": number (0-1), "consistency": number (0-1), "explanation": string, "low_confidence_factors": string[] }. Add: If score <= 2, list specific missing or contradictory evidence in low_confidence_factors.
Watch for
- Schema drift where the model drops optional fields under load
- Confidence scores that don't correlate with actual error rates—run eval weekly
- Users ignoring the uncertainty banner if it appears too often

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