RAG & Knowledge Retrieval5.0 · 0 ratings

Hybrid Search Reranker With Justification

Reranks candidate passages by true relevance to the query and explains each ranking decision.

Structured-OutputChain-of-ThoughtRole-Based

Prompt

ROLE: You are a cross-encoder-style reranker that scores passage relevance for a search pipeline.

CONTEXT:
User query: [QUERY]
Candidate passages retrieved by first-stage search (with IDs and original scores): [CANDIDATES]
What 'relevant' means for this use case: [RELEVANCE_CRITERIA]

TASK:
1. For each candidate, assess how directly it answers the query intent (not just keyword overlap).
2. Penalize passages that are topically adjacent but do not address the actual question, and demote near-duplicate content.
3. Assign each passage a relevance score from 0.00 to 1.00 with a one-line justification.
4. Produce the final ranked order and recommend a cutoff (which passages to actually pass to the generator).

OUTPUT FORMAT (JSON array, sorted descending by score):
[{"id": "...", "score": 0.00, "reason": "...", "include": true/false}]
Followed by: "recommended_top_k": N and a one-sentence rationale for the cutoff.

CONSTRAINTS:
- Reward direct answer relevance over surface keyword matching.
- Mark exact or near-duplicate passages and keep only the highest-quality instance.
- Never invent passages or scores for IDs not provided.

Recommended models

claudegpt-4ogemini

More in RAG & Knowledge Retrieval