This prompt is for RAG pipeline engineers who need a calibrated, per-passage confidence signal before answer generation. It instructs the model to act as an evidence annotator, producing a numerical relevance score and a structured justification for each retrieved passage against a user query. Use this when downstream answer generation, evidence ranking, or refusal logic depends on knowing which passages are strong enough to trust. This is not a prompt for generating the final answer. It is a pre-answer filtering and scoring step that makes evidence quality explicit and auditable.
Prompt
Confidence Score Annotation Prompt for Retrieved Passages

When to Use This Prompt
Learn when to deploy a confidence score annotator in your RAG pipeline and when simpler or alternative approaches are more appropriate.
Deploy this prompt when you need to implement a gating mechanism that prevents low-quality passages from reaching your answer generator. It is especially valuable in systems where retrieval returns noisy or mixed-quality results, where you must log evidence quality decisions for audit trails, or where you need to calibrate refusal thresholds based on passage-level scores. The prompt works best with capable instruction-following models (such as GPT-4, Claude 3.5 Sonnet, or Gemini 1.5 Pro) that can produce consistent numerical judgments when given clear scoring rubrics. For high-throughput pipelines, consider batching multiple passage-query pairs in a single request to reduce latency, but keep batches small enough that the model does not lose scoring consistency across passages.
Do not use this prompt when retrieval already returns highly filtered, top-k results from a dense embedding search with a tight similarity threshold. In those cases, a simpler relevance binary classifier or a threshold on the retrieval score may suffice. Avoid this prompt when latency budgets are extremely tight (sub-200ms) and you cannot afford an extra model inference step before answer generation. For regulated or high-stakes domains, always pair this prompt with human review of the scoring decisions, especially for passages near the accept/reject boundary. The next section provides the copy-ready prompt template you can adapt for your own retrieval pipeline.
Use Case Fit
Where this prompt works, where it fails, and what you must provide before using it in production.
Good Fit: Pre-Answer Evidence Gating
Use when: you need a calibrated relevance and sufficiency score for each retrieved passage before answer generation. Guardrail: Run this prompt as a dedicated step after retrieval but before synthesis. Do not combine scoring and answer generation in a single call.
Bad Fit: Real-Time Chat Without Retrieval
Avoid when: the system has no retrieval step or passages are streamed incrementally. Guardrail: This prompt requires a static set of passages. For streaming or conversational settings, use a lightweight relevance classifier instead.
Required Input: Retrieved Passages with Metadata
What to watch: The prompt fails silently if passages lack source identifiers or retrieval scores. Guardrail: Always include passage ID, source title, and retrieval rank. The model needs these to produce traceable justifications.
Operational Risk: Score Drift Across Model Versions
What to watch: Confidence score distributions shift when the underlying model changes, breaking downstream thresholds. Guardrail: Recalibrate score thresholds against a held-out human-judgment dataset after every model upgrade. Log score distributions in production.
Operational Risk: Latency Budget Overrun
What to watch: Per-passage scoring adds linear latency to your RAG pipeline, especially with many passages. Guardrail: Cap the number of passages scored. Use a fast pre-filter before this prompt. Set a timeout and fall back to retrieval-rank-only ordering.
Operational Risk: Overconfident Justifications
What to watch: The model may produce fluent justifications that sound convincing but misrepresent the passage content. Guardrail: Spot-check justifications against source text. Add an output validation step that verifies justification claims are grounded in the cited passage span.
Copy-Ready Prompt Template
A copy-ready prompt template that enforces a strict JSON output contract for annotating each retrieved passage with a confidence score and justification.
This prompt template is the core instruction set for a confidence score annotator. It is designed to be placed directly into your RAG pipeline, right after retrieval and before answer generation. The prompt instructs the model to evaluate each passage independently against the user's query, producing a structured JSON object that includes a numerical score, a justification, and a flag for sufficiency. The strict JSON output contract ensures that downstream systems—such as evidence gates, answer generators, or monitoring dashboards—can parse the results reliably without fragile regex or unstructured text parsing.
textYou are a strict evidence evaluator. Your task is to assess the relevance and sufficiency of each provided passage for answering the user's query. You must output a single, valid JSON object with no additional text, markdown fences, or commentary. ## User Query [USER_QUERY] ## Passages to Evaluate [PASSAGES_ARRAY] ## Output Schema Return a JSON object with the following structure: { "passages": [ { "passage_id": "string", "relevance_score": number (0.0 to 1.0), "sufficiency_flag": "sufficient" | "partial" | "insufficient", "justification": "string explaining the score, referencing specific content from the passage and the query." } ] } ## Scoring Rubric - **1.0 (Perfectly Relevant):** The passage directly answers the core question with specific, unambiguous facts. - **0.7-0.9 (Highly Relevant):** The passage contains key information but may require minor inference or combination with another passage. - **0.4-0.6 (Partially Relevant):** The passage touches on the topic but lacks the specific details needed to answer the query. - **0.1-0.3 (Tangentially Relevant):** Only a keyword or general domain overlaps; the passage does not address the user's intent. - **0.0 (Not Relevant):** The passage is completely unrelated to the query. ## Sufficiency Flag Rules - **sufficient:** The passage alone contains enough information to fully answer the query. - **partial:** The passage provides some useful information but is not enough on its own. - **insufficient:** The passage does not provide any actionable information to answer the query. ## Constraints - Do not fabricate information. The justification must be grounded in the passage text. - If a passage is empty or contains only garbled text, assign a relevance_score of 0.0 and a sufficiency_flag of "insufficient". - Output only the JSON object. No other text.
To adapt this template for your application, replace the [USER_QUERY] and [PASSAGES_ARRAY] placeholders at runtime. The [PASSAGES_ARRAY] should be a serialized JSON array of objects, each with at least an id and content field. For high-stakes domains, consider adding a [RISK_LEVEL] placeholder to adjust the strictness of the rubric, and always log the raw prompt and model output for auditability. Before deploying, run this prompt against a golden dataset of 50-100 passage-query pairs with human-annotated scores to calibrate the model's interpretation of the rubric and identify systematic biases, such as over-scoring long passages or under-scoring contradictory ones.
Prompt Variables
Required inputs for the Confidence Score Annotation Prompt. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[QUERY] | The user question or claim that retrieval was performed for | What is the capital of France? | Non-empty string. Must match the original query used for retrieval to prevent context mismatch. |
[PASSAGE_LIST] | Array of retrieved passages to score, each with an ID and text content | [{"id":"p1","text":"Paris is the capital of France..."}] | Valid JSON array. Each object must have id and text fields. Array length must be between 1 and the max passages per batch. |
[PASSAGE_COUNT] | Total number of passages in the batch being scored | 5 | Integer matching the length of [PASSAGE_LIST]. Used to validate completeness of scoring output. |
[SCORING_CRITERIA] | Definition of what constitutes a relevant and sufficient passage for this use case | Relevance: passage directly addresses the query. Sufficiency: passage contains enough information to partially or fully answer. | Non-empty string. Should be aligned with downstream answer-generation expectations to avoid score drift. |
[CONFIDENCE_SCALE] | The numerical range and labels for confidence scores | 0-100 where 0=irrelevant, 25=weakly related, 50=partially relevant, 75=mostly sufficient, 100=fully sufficient | Must define a clear numeric range with at least 3 labeled anchor points. Avoid ambiguous scales like 1-5 without descriptors. |
[OUTPUT_SCHEMA] | Expected JSON structure for each scored passage | {"passage_id":"string","confidence_score":0-100,"justification":"string","sufficiency_flag":"full|partial|insufficient"} | Valid JSON Schema or example object. Must include fields for score, justification, and a categorical sufficiency flag for downstream gating. |
[MAX_JUSTIFICATION_LENGTH] | Token or character limit for the justification text per passage | 150 characters | Integer with unit specified. Prevents verbose justifications that bloat downstream context windows. |
Implementation Harness Notes
How to wire the confidence score annotation prompt into a production RAG pipeline with validation, retries, and calibration checks.
The confidence score annotation prompt is not a standalone tool; it is a pre-generation gate that should sit between your retrieval step and your answer generation step. In a typical RAG pipeline, you retrieve N passages, then you must decide which passages are strong enough to use. This prompt acts as a scoring filter: it takes each passage, the user query, and your evidence standards, and returns a structured confidence score with justification. The output is consumed programmatically—your application reads the scores, applies a threshold (e.g., discard passages below 0.6), and passes only the surviving passages to the answer generation prompt. This means the prompt must return machine-parseable JSON, not free-text commentary, and your harness must validate that structure before the pipeline continues.
Wiring the prompt into your application requires a few concrete components. First, define a strict output schema in your prompt (e.g., {"passage_id": string, "confidence_score": float, "justification": string, "sufficiency_flag": "sufficient"|"insufficient"|"partial"}) and enforce it with a JSON validator after the model responds. If validation fails, implement a retry loop (maximum 2 retries) that feeds the validation error back to the model with a repair instruction. Second, log every score with the passage ID, query, timestamp, and model version—this is essential for calibration analysis later. Third, if your use case is high-stakes (healthcare, legal, finance), insert a human review step for passages that fall in a borderline range (e.g., 0.4–0.7) rather than auto-discarding them. Fourth, choose a model that follows structured output instructions reliably; smaller or older models may drift into narrative responses, so test with your actual retrieval outputs before deploying.
Calibration is the long-term maintenance task. After deployment, periodically sample scored passages and have human annotators assign their own confidence scores. Compare the model's scores to human judgments using metrics like Expected Calibration Error (ECE) or simple bucket accuracy. If the model consistently overestimates confidence (a common failure mode), adjust your threshold upward or add calibration instructions to the prompt (e.g., 'prefer lower scores when evidence is indirect'). Also monitor for score drift when you change retrieval sources, update the knowledge base, or switch model versions. A passage that scored 0.8 last month may score 0.5 today if the retrieval index has shifted. Build a dashboard that tracks score distributions over time and alerts you when the mean confidence shifts by more than a standard deviation. Finally, avoid the temptation to skip this annotation step and feed all retrieved passages directly to answer generation—that path leads to hallucination from irrelevant context, which is exactly what this prompt is designed to prevent.
Expected Output Contract
Defines the required JSON output structure for the confidence score annotation prompt. Use this contract to validate model responses before downstream consumption.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
passage_id | string | Must match an id from the input [PASSAGES] array. Non-empty. | |
relevance_score | number (0.0-1.0) | Must be a float between 0.0 and 1.0 inclusive. Parse check required. | |
sufficiency_score | number (0.0-1.0) | Must be a float between 0.0 and 1.0 inclusive. Parse check required. | |
confidence_tier | string (enum) | Must be one of: 'high', 'medium', 'low', 'insufficient'. Enum validation required. | |
justification | string | Must be 1-3 sentences. Non-empty. Must reference specific content from the passage. | |
key_supporting_quote | string | If provided, must be a verbatim substring of the passage text. Null allowed. | |
missing_information | array of strings | If confidence_tier is 'insufficient', this field is required. Otherwise null allowed. Each string must describe a specific gap. | |
query_alignment | string (enum) | Must be one of: 'directly_answers', 'partially_addresses', 'tangential', 'irrelevant'. Enum validation required. |
Common Failure Modes
Confidence score annotation fails silently in production. These are the most common failure modes when asking a model to score passage relevance and sufficiency, along with concrete guardrails to catch them before they affect downstream answer generation.
Score Inflation on Vague Passages
What to watch: The model assigns high confidence scores (0.8+) to passages that share keywords with the query but lack specific, answerable content. This happens because lexical overlap tricks the model into overestimating relevance. Guardrail: Include a negative example in the prompt showing a keyword-match passage that should receive a low score. Add a calibration check: require the justification to quote the specific claim the passage supports, not just restate the topic.
Justification-Contradiction Drift
What to watch: The numerical score and the text justification disagree. For example, a justification that says 'the passage lacks specific data' paired with a score of 0.85. This breaks downstream filtering logic that relies on the score alone. Guardrail: Add a post-processing validator that extracts contradiction signals from the justification text (e.g., 'lacks,' 'missing,' 'insufficient') and flags score-justification pairs where the language implies a lower score than the number indicates.
Context Window Truncation Blindness
What to watch: When many passages are packed into a single prompt, later passages receive systematically lower scores regardless of their actual relevance. The model's attention is diluted by long context. Guardrail: Limit the number of passages scored in a single call (3-5 maximum). If you must score more, use a sliding window with overlapping calibration passages of known relevance to detect score degradation across batches.
Sufficiency Confusion with Relevance
What to watch: The model conflates 'this passage is relevant to the topic' with 'this passage contains sufficient information to answer the question.' A passage about the right subject but too shallow to answer anything gets a high score. Guardrail: Split the scoring into two explicit dimensions in the output schema: relevance_score and sufficiency_score. Require separate justifications for each. This forces the model to distinguish topical match from answer-bearing content.
Hallucinated Passage Content in Justifications
What to watch: The justification claims the passage contains information that isn't actually present—fabricating details to justify a score. This is especially dangerous because the score looks grounded when it isn't. Guardrail: Add a strict instruction: 'Only reference content explicitly stated in the passage. If you cannot quote the relevant sentence, do not claim it exists.' Follow up with a span-level grounding check that verifies each factual claim in the justification appears in the source passage.
Calibration Collapse Under Distribution Shift
What to watch: Scores that were well-calibrated against human judgments during evaluation drift when the retrieval source changes (e.g., moving from Wikipedia to internal documentation, or from short articles to long technical specs). The model's internal scoring scale shifts without warning. Guardrail: Maintain a small golden set of 10-20 passage-query pairs with human-assigned confidence labels drawn from your actual production retrieval source. Run this calibration set weekly and trigger an alert if mean absolute error exceeds your threshold. Re-anchor the prompt with updated few-shot examples when drift is detected.
Evaluation Rubric
Use this rubric to test whether the confidence score annotation prompt produces calibrated, reliable outputs before integrating it into a production RAG pipeline. Each criterion targets a specific failure mode observed in passage-level confidence scoring.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Score Calibration | Mean confidence score for relevant passages is within 0.15 of human-assigned relevance scores across a 100-sample test set | Mean absolute error exceeds 0.3 between model and human scores on held-out calibration set | Compute MAE between model scores and 3-human-annotator mean on 100 passage-query pairs; flag if MAE > 0.3 |
Justification Grounding | Every justification sentence references a specific span or attribute from the passage text | Justification contains claims not traceable to the passage (hallucinated details about content or provenance) | Human review of 50 justifications; mark fail if any sentence cannot be highlighted in the source passage |
Score-Justification Consistency | High scores (>=0.8) always cite specific answer-bearing content; low scores (<=0.3) always cite missing information or irrelevance | A passage receives score >=0.8 but justification describes missing key facts, or score <=0.3 but justification describes strong answer match | Automated check: extract score, classify justification sentiment with judge model, flag contradictions; sample 20 flagged cases for human review |
Relevance Discrimination | Passages from the same retrieval set receive scores with a spread of at least 0.4 between the most and least relevant passage | All passages in a set receive scores within a 0.2 band when ground-truth relevance varies significantly | For each query with 5+ passages, compute score range; fail if range < 0.2 and human annotators assign relevance spread > 0.5 |
Null Handling | Empty or completely irrelevant passages receive score 0.0 with justification citing total lack of query-relevant content | Empty passage receives score > 0.1 or justification fabricates relevance | Inject 10 empty-string and 10 off-topic passages into test set; verify all scores are 0.0 with null-referencing justifications |
Boundary Adherence | All scores fall within [0.0, 1.0] and use the specified precision (e.g., one decimal place) | Scores outside [0.0, 1.0] or with inconsistent decimal precision appear in output | Schema validation on 200 outputs: reject any score < 0.0 or > 1.0; check precision matches [OUTPUT_SCHEMA] specification |
Latency Budget | Per-passage scoring completes within 500ms for passages under 500 tokens | Scoring exceeds 2 seconds per passage or times out on passages within token limits | Benchmark 100 passages at 500 tokens each; measure p95 latency; fail if p95 > 2000ms under target inference hardware |
Instruction Drift Under Load | Output format matches [OUTPUT_SCHEMA] for 100 consecutive passages without format degradation | After 50+ passages, output begins dropping fields, changing key names, or omitting justifications | Run prompt against 100-passage batch; validate JSON schema on every output; fail if any output after position 50 breaks schema |
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
Use the base prompt with a simple 1–5 scale and free-text justification. Skip strict schema enforcement—accept JSON or markdown output. Focus on getting directional confidence signals for a handful of test passages.
codeScore each passage from 1 (irrelevant) to 5 (fully sufficient). Return: {"score": [SCORE], "justification": "[BRIEF_REASON]"}
Watch for
- Scores clustering at 3 (model avoids extremes)
- Justifications that paraphrase the passage instead of assessing relevance
- No calibration against human judgments yet

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