Inferensys

Prompt

Tiered Passage Relevance Labeling Prompt

A practical prompt playbook for assigning high, medium, and low relevance tiers to retrieved passages before context assembly in production RAG systems.
Developer building agentic RAG system, retrieval pipeline diagram on laptop, technical workspace with notes.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for the Tiered Passage Relevance Labeling Prompt.

This prompt is for RAG system builders who need to sort retrieved passages into high, medium, and low relevance tiers before context assembly. The job-to-be-done is reducing noise and hallucination by ensuring that only appropriately relevant passages influence the final answer. The ideal user is an engineering lead or AI pipeline developer who already has a retrieval step producing candidate passages and needs a structured, explainable filtering layer before generation. Required context includes the user query, the set of retrieved passages, and any domain-specific relevance criteria that define what 'high relevance' means for your application.

Do not use this prompt when you need a simple binary relevant/irrelevant decision—use the Binary Passage Relevance Filter Prompt instead. Do not use it when you need a fully ranked, ordered list of passages; a cross-encoder reranking prompt is more appropriate for that task. This prompt is also not a substitute for retrieval quality. If your retriever consistently returns irrelevant results, tiered labeling will only document the failure rather than fix it. The prompt works best when the retrieval set already contains a mix of highly relevant, partially relevant, and irrelevant passages, and you need to separate them with clear, auditable criteria before context window packing or answer generation.

Before deploying this prompt, define your tier definitions precisely. A passage that is 'high relevance' should directly answer the query with specific evidence. 'Medium relevance' passages should provide useful context or partial answers but lack the specificity to stand alone. 'Low relevance' passages should be tangentially related or contain only background information. Write these definitions into the [TIER_DEFINITIONS] placeholder and test them against a golden dataset of query-passage pairs with known relevance labels. If your application operates in a regulated domain such as healthcare, finance, or legal, add a human review step for any passage labeled 'high relevance' that will be used to generate user-facing claims. The next section provides the copy-ready template you can adapt.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Tiered Passage Relevance Labeling Prompt works well and where it introduces risk. Use these cards to decide if this prompt fits your pipeline stage before integrating it.

01

Good Fit: Pre-Generation Filtering

Use when: You need to filter a noisy retrieval set into high/medium/low tiers before passing context to an answer generation model. Guardrail: Always log the tier distribution per query to detect retrieval drift or sudden spikes in low-relevance passages.

02

Good Fit: Budget-Constrained Context Packing

Use when: Token limits force you to drop passages. The tier labels let you prioritize high-relevance passages and include medium only if budget allows. Guardrail: Set a minimum high-relevance count threshold; if too few passages score high, trigger a retrieval fallback or query rewrite instead of proceeding with weak evidence.

03

Bad Fit: Single-Passage or Trivial Retrieval Sets

Avoid when: Your retrieval step returns only 1-3 passages. Tiered labeling adds latency and cost without meaningful differentiation. Guardrail: Bypass the tiering prompt entirely when the passage count is below a configurable threshold and pass all passages directly to generation.

04

Bad Fit: Real-Time Streaming Applications

Avoid when: Users expect sub-second response times and your retrieval set is large. LLM-based tiering adds unacceptable latency. Guardrail: Use a lightweight cross-encoder reranker or heuristic score cutoff for latency-sensitive paths; reserve LLM tiering for async or batch processing pipelines.

05

Required Input: Calibrated Retrieval Set

Risk: The prompt cannot fix a broken retrieval step. If your vector or keyword search already returns irrelevant results, tier labels will be uniformly low and unactionable. Guardrail: Monitor the percentage of queries where zero passages score high; if it exceeds a threshold, investigate the upstream retriever before tuning the labeling prompt.

06

Operational Risk: Tier Boundary Instability

Risk: The boundary between medium and low relevance can drift across model versions or input distributions, causing inconsistent context selection in production. Guardrail: Maintain a golden set of query-passage pairs with expected tier labels and run regression tests on every prompt or model change before deployment.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for assigning high, medium, or low relevance tiers to retrieved passages with explicit criteria explanations.

The following prompt template is designed to be copied directly into your prompt library or orchestration code. It uses square-bracket placeholders for all dynamic inputs, allowing you to swap in your own query, passages, tier definitions, and output schema without rewriting the core instruction logic. The template enforces structured JSON output and requires the model to explain its tier assignment for each passage, which is critical for downstream debugging and auditability in production RAG pipelines.

text
You are a relevance labeling assistant for a retrieval-augmented generation (RAG) system. Your task is to evaluate each retrieved passage against the user query and assign a relevance tier: HIGH, MEDIUM, or LOW.

## TIER DEFINITIONS
- HIGH: The passage directly answers or substantially addresses the query. It contains specific facts, entities, or reasoning that are necessary to answer correctly.
- MEDIUM: The passage is topically related but does not directly answer the query. It provides useful context, background, or adjacent information that could support a broader answer.
- LOW: The passage is irrelevant, off-topic, or too vague to contribute meaningfully to answering the query.

## INPUT
**User Query:** [USER_QUERY]

**Retrieved Passages:**
[PASSAGES]

## OUTPUT SCHEMA
Return a valid JSON object with the following structure:
{
  "passages": [
    {
      "passage_id": "string",
      "tier": "HIGH | MEDIUM | LOW",
      "criteria_explanation": "string explaining why this tier was assigned, referencing specific content in the passage and its relationship to the query"
    }
  ]
}

## CONSTRAINTS
- Assign exactly one tier per passage.
- Every passage in the input must appear in the output.
- The criteria_explanation must be specific and evidence-based, not generic.
- Do not reorder passages; preserve the original input order.
- If a passage is ambiguous, default to MEDIUM and explain the ambiguity.
- Do not answer the user query. Only label relevance.

To adapt this template for your own system, replace [USER_QUERY] with the end user's question or search string, and [PASSAGES] with your retrieved passage set formatted as a list of objects containing at minimum a passage_id and text field. If your retrieval pipeline includes metadata such as source titles, publication dates, or authority scores, append those fields to each passage object in the input—the model can use them to improve tiering accuracy. For high-stakes domains such as legal or medical RAG, add a [RISK_LEVEL] placeholder and a constraint requiring the model to flag passages where tier assignment is uncertain and human review is recommended. Always validate the output JSON against the schema before passing tiered passages to your answer generation step; malformed outputs should trigger a retry or fallback to a default tier assignment.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Tiered Passage Relevance Labeling Prompt. Each placeholder must be populated before the prompt is assembled and sent to the model. Validation notes describe how to check input quality before execution.

PlaceholderPurposeExampleValidation Notes

[QUERY]

The user question or information need that passages are being evaluated against

What are the side effects of atorvastatin in elderly patients?

Check that query is non-empty, contains a complete question or statement, and is not a keyword dump. Truncate if over 500 characters.

[PASSAGES]

Array of retrieved passages to label, each with a unique identifier and full text content

[{"id":"p1","text":"Atorvastatin is generally well-tolerated..."}, {"id":"p2","text":"Common side effects include..."}]

Validate that each passage object has a non-empty id and text field. Minimum 1 passage, maximum 50 passages per call. Reject if any passage text exceeds 4000 tokens.

[TIER_DEFINITIONS]

Explicit criteria for what qualifies as high, medium, or low relevance for this domain and query type

HIGH: Directly answers the query with specific evidence. MEDIUM: Related context but does not directly answer. LOW: Off-topic or irrelevant.

Ensure definitions are non-empty and contain distinct, non-overlapping criteria for each tier. Definitions must be actionable enough for a human annotator to apply consistently.

[OUTPUT_SCHEMA]

Expected JSON structure for the labeling output, including required fields and their types

{"passage_id": "string", "tier": "HIGH"|"MEDIUM"|"LOW", "rationale": "string", "key_excerpt": "string"}

Validate that schema is valid JSON and includes all required fields: passage_id, tier, rationale. Confirm tier enum values match the tier definitions provided. Schema must be parseable by a JSON validator.

[DOMAIN_CONTEXT]

Optional domain-specific terminology, constraints, or relevance rules that override generic relevance assessment

Medical: prioritize passages from peer-reviewed sources. Exclude patient forum content. Consider recency within 5 years.

If provided, check that context is specific and actionable. If null, the prompt defaults to generic relevance assessment. Domain context must not contradict tier definitions.

[MAX_PASSAGES_PER_TIER]

Optional cap on how many passages can be assigned to each tier to prevent tier imbalance in large retrieval sets

{"HIGH": 5, "MEDIUM": 10, "LOW": null}

If provided, validate that values are positive integers or null. Null means no cap. If omitted, no tier limits are enforced. Caps must not sum to less than total passage count when all tiers are capped.

[CONFIDENCE_REQUIRED]

Boolean flag indicating whether the prompt should output confidence scores alongside tier labels

Must be true or false. When true, the output schema must include a confidence field. When false, confidence scoring is skipped to reduce output tokens.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the tiered passage relevance labeling prompt into a production RAG pipeline with validation, retries, and human review gates.

The tiered labeling prompt is designed to sit between retrieval and context assembly in a RAG pipeline. It accepts a batch of retrieved passages and a user query, then returns a structured relevance tier for each passage along with a criteria explanation. The output is not a final answer—it is a filtering and prioritization signal that downstream components consume. In a typical implementation, you will call this prompt once per query after initial retrieval, passing the top-k passages (often 20–50) and the original user query. The resulting tier labels feed into a context assembly step that selects passages by tier priority, respecting token budgets and diversity constraints.

Integration pattern. Wrap the prompt in a function that accepts query: str, passages: list[dict], and optional tier_thresholds: dict. The function should construct the prompt by injecting the query and passages into the template, call the model with response_format set to a JSON schema matching the expected output, and parse the result. Validate the output immediately: check that every passage ID in the input appears exactly once in the output, that each label is one of HIGH, MEDIUM, or LOW, and that every entry includes a non-empty criteria string. If validation fails, retry once with the validation errors appended to the prompt as feedback. If the retry also fails, log the failure and route the query to a fallback path—either using all passages unfiltered or escalating for human review if the use case is high-stakes.

Model choice and latency. For most production RAG systems, a fast instruction-tuned model like GPT-4o-mini, Claude Haiku, or Gemini Flash is sufficient for tiered labeling. The task is classification with explanation, not generation, so smaller models often perform well. If you are processing passages in parallel across multiple queries, consider batching requests or using asynchronous calls to keep end-to-end latency under 500ms. For high-throughput systems, implement a caching layer that stores tier labels keyed by (query_hash, passage_hash) to avoid re-labeling identical query-passage pairs. Monitor label distribution drift over time—if the ratio of HIGH to LOW passages shifts unexpectedly, it may indicate retrieval quality degradation or prompt drift.

Eval harness and human review gates. Before deploying, build an eval harness that compares model-assigned tiers against a golden dataset of 200–500 query-passage pairs labeled by domain experts. Measure tier agreement using Cohen's kappa or a weighted F1 that penalizes HIGH/LOW confusion more than HIGH/MEDIUM. Track boundary cases where the model disagrees with human labels by more than one tier—these are your highest-risk failures. In regulated or high-stakes domains (healthcare, legal, finance), route all LOW-tier passages that the model recommends for exclusion to a human review queue before they are dropped from context. Log every tiering decision with the query, passage ID, assigned tier, criteria, and model version for auditability. Avoid using tier labels as the sole gate for critical information without a human-in-the-loop fallback.

PRACTICAL GUARDRAILS

Common Failure Modes

Tiered labeling introduces ambiguity at the boundaries. These are the most common failure modes when deploying relevance tiers in production and how to prevent them.

01

Boundary Drift Between Tiers

What to watch: The model inconsistently assigns passages with similar relevance to different tiers (e.g., one borderline passage gets HIGH while an equivalent passage gets MEDIUM). This destroys downstream trust in tier-based filtering. Guardrail: Include explicit boundary examples in the prompt showing passages that fall exactly on the HIGH/MEDIUM and MEDIUM/LOW borders, with the correct label and reasoning.

02

Over-Generous HIGH Labeling

What to watch: The model labels too many passages as HIGH relevance to avoid missing anything, defeating the purpose of tiered filtering and bloating the context window with marginal content. Guardrail: Add a hard constraint in the prompt specifying the expected distribution or maximum HIGH count, and validate output against a calibration set with known relevance distributions.

03

Criteria Contamination Across Tiers

What to watch: The model applies HIGH-tier criteria (e.g., 'directly answers the query') when evaluating MEDIUM-tier passages, or uses MEDIUM-tier reasoning for LOW-tier decisions. This produces inconsistent labels that can't be reproduced. Guardrail: Structure the prompt so each tier's criteria are evaluated independently, and include a self-consistency check that asks the model to verify it applied the correct tier's criteria to each passage.

04

Query Intent Misalignment

What to watch: The model labels passages based on surface-level keyword overlap rather than semantic alignment with the query's actual intent, producing HIGH labels for tangentially related content. Guardrail: Require the model to restate the query intent before labeling, and include a justification field that explains how each HIGH passage addresses that specific intent rather than just matching terms.

05

Position Bias in Passage Ordering

What to watch: Passages appearing first or last in the input list receive systematically different tier assignments, regardless of actual relevance. This is a known LLM attention bias that corrupts tier distributions. Guardrail: Randomize passage order before sending to the model, or run the labeling pass twice with reversed order and flag passages where tier assignments change between runs for human review.

06

Silent Abstention on Ambiguous Passages

What to watch: The model skips or assigns a default tier to passages it finds genuinely ambiguous, without surfacing the uncertainty. Downstream systems treat these as confident labels. Guardrail: Add an explicit UNCERTAIN label option with a required explanation field, and route UNCERTAIN passages to a human review queue or a secondary, more expensive model for resolution.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Tiered Passage Relevance Labeling Prompt before shipping. Each criterion targets a known failure mode in tiered classification. Run these checks against a golden dataset of query-passage pairs with human-annotated tiers.

CriterionPass StandardFailure SignalTest Method

Tier Boundary Consistency

High/Medium/Low boundaries match human labels within one adjacent tier for 90% of samples

Model places clearly relevant passages in Low tier or clearly irrelevant passages in High tier

Run 50 labeled query-passage pairs through the prompt; compute confusion matrix and off-by-one accuracy

Criteria Explanation Quality

Every tier assignment includes a specific, non-generic justification referencing passage content

Justifications are boilerplate (e.g., 'relevant to query') or missing for more than 5% of outputs

Parse explanation field; check for query term overlap, passage entity mention, or specific claim reference

Low-Tier Recall for Noise

95% of known-irrelevant passages receive Low tier label

Irrelevant passages labeled Medium or High, causing noise injection into context assembly

Test with 30 passages from unrelated domains; verify Low tier rate exceeds 95%

High-Tier Precision for Key Evidence

85% of High-tier passages contain direct answer evidence as judged by human review

High tier includes passages that mention query terms but lack answer content

Sample 20 High-tier outputs; have reviewer confirm each passage contains answer-supporting information

Tier Distribution Stability

Tier distribution across a batch of 100 passages does not collapse to a single tier

All passages receive Medium tier (undifferentiated output) or extreme skew (>80% in one tier)

Run prompt on a mixed-relevance batch; verify each tier contains at least 10% of passages

Boundary Case Handling

Partially relevant passages receive Medium tier with explanation of what is missing

Partially relevant passages incorrectly labeled High (overclaiming) or Low (discarding useful context)

Curate 10 boundary-case passages with partial relevance; verify Medium tier rate exceeds 80%

Output Schema Compliance

Every response parses as valid JSON matching the defined tiered output schema

Missing tier field, unparseable JSON, or extra fields that break downstream parsers

Validate all outputs against JSON Schema; flag any parse failures or missing required fields

Confidence Indicator Calibration

When confidence is requested, low-confidence labels correlate with human disagreement cases

High confidence assigned to passages where human annotators disagree on tier

Compare model confidence scores against human annotator agreement rates on 20 ambiguous passages

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet). Start with 3 tiers (HIGH/MEDIUM/LOW) and simple criteria. Skip strict schema enforcement—accept natural language output and parse tier labels with regex.

code
Label each passage as HIGH, MEDIUM, or LOW relevance to [QUERY].

HIGH: Directly answers or provides key evidence.
MEDIUM: Provides context or partial support.
LOW: Off-topic or irrelevant.

Passages:
[PASSAGE_LIST]

Watch for

  • Tier boundary drift: MEDIUM becomes a catch-all when the model is uncertain
  • Missing criteria explanations—the model may output labels without reasoning
  • Inconsistent tiering when passages are semantically close
Prasad Kumkar

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.