Inferensys

Prompt

Recency-Boosted Reranking Prompt

A practical prompt playbook for using Recency-Boosted Reranking Prompt in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Identify the ideal conditions, required inputs, and failure boundaries for applying recency-boosted reranking in a production RAG pipeline.

This prompt is designed for search ranking engineers and RAG pipeline architects who need to rerank a set of retrieved passages by balancing semantic relevance with temporal freshness. The core job-to-be-done is producing a final ordered list where a document's value is a function of both how well it answers the query and how recently it was published. This is critical in domains where information decays rapidly, such as financial data, breaking news, regulatory filings, and competitive intelligence. The ideal user is someone who has already completed an initial retrieval step and has a list of candidate passages, each with a pre-computed relevance score and a reliable publication timestamp.

You should use this prompt when your application domain penalizes stale information and you have access to structured metadata, specifically a publication_date for each passage. The prompt is configurable: you can specify the decay function (e.g., exponential, linear), the half-life parameter, and the time reference point. This makes it adaptable to different rates of information churn. For example, a financial news application might use a half-life of 24 hours, while a regulatory filing system might use a half-life of 90 days. The prompt expects a structured input, typically a JSON array of objects, each containing a passage_id, content, relevance_score, and publication_date. The output is a reranked list with a new combined_score that explicitly shows the freshness penalty applied.

Do not use this prompt when all evidence is effectively timeless, such as historical facts, mathematical proofs, or foundational scientific principles. In these cases, applying a time-decay function would introduce noise and degrade ranking quality by penalizing authoritative older sources. This prompt is also unsuitable if publication dates are unavailable, unreliable, or not in a parseable format. It assumes you have already solved the upstream problem of date extraction and normalization. Finally, this prompt is a reranking step, not a retrieval step; it will not fix a fundamentally broken retrieval pipeline that fails to surface relevant documents in the first place. If your initial retrieval set is already stale or irrelevant, reranking with a recency boost will only amplify the problem by promoting recent but off-topic documents.

PRACTICAL GUARDRAILS

Use Case Fit

Where recency-boosted reranking adds measurable value and where it introduces risk. Use these cards to decide whether to apply time-decay weighting in your retrieval pipeline.

01

Good Fit: Time-Sensitive Domains

Use when: queries depend on current information such as financial earnings, breaking news, regulatory filings, or market intelligence. Why: stale evidence produces factually wrong answers. Guardrail: define domain-specific half-life parameters and validate against known-answer datasets with publication date ground truth.

02

Bad Fit: Time-Stable Knowledge

Avoid when: queries target stable facts such as mathematical proofs, historical events before a cutoff date, or physical constants. Risk: recency bias suppresses authoritative older sources. Guardrail: classify query temporal sensitivity before applying decay and skip reranking for time-agnostic queries.

03

Required Inputs

Must have: retrieved passages with publication or last-updated timestamps, relevance scores from upstream retrieval, and a configured decay function. Without timestamps: recency weighting is impossible. Guardrail: run a publication date extraction prompt on unstructured documents before they enter the reranking pipeline.

04

Operational Risk: Decay Function Drift

What to watch: a decay function tuned for one domain silently degrades when applied to another. Example: a half-life of 24 hours for news breaks quarterly financial reporting where quarters matter. Guardrail: parameterize decay functions per content type and monitor ranking quality with A/B tests against user satisfaction metrics.

05

Operational Risk: Timestamp Quality

What to watch: missing, ambiguous, or incorrect publication dates cause the reranker to make wrong freshness decisions. Example: a page with a crawl date but no publication date gets treated as fresh. Guardrail: validate timestamp completeness and confidence before reranking; flag passages with low-confidence dates for separate handling.

06

When to Skip Reranking

Skip when: the retrieval set is already time-filtered, the query is explicitly historical, or latency budgets cannot absorb an additional reranking pass. Risk: unnecessary computation and potential ranking distortion. Guardrail: add a lightweight temporal sensitivity classifier before the reranking step and bypass when temporal relevance is not required.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

Paste this prompt into your reranking step to combine semantic relevance with time-decay weighting.

This prompt template is designed to be inserted directly into your reranking pipeline, immediately after initial retrieval and before answer generation. It instructs the model to re-score a list of candidate passages by blending their original relevance score with a configurable recency penalty. The template uses square-bracket placeholders for all dynamic inputs—your retrieval results, your chosen decay function, and your domain-specific half-life parameter. Copy the block below, replace the placeholders with your data, and wire the output into your downstream evidence selector.

text
You are a precision reranking engine. Your task is to reorder a list of retrieved passages by combining their initial relevance score with a time-decay weighting that penalizes older information.

INPUT PASSAGES (JSON array):
[PASSAGES]

CURRENT REFERENCE TIMESTAMP: [REFERENCE_TIMESTAMP]

DECAY FUNCTION: [DECAY_FUNCTION]
HALF-LIFE: [HALF_LIFE]

INSTRUCTIONS:
1. For each passage, extract the publication or last-updated date. If a passage has no discernible date, assign it a default age of [DEFAULT_AGE] days.
2. Calculate the age of the passage in days relative to the reference timestamp.
3. Apply the specified decay function using the given half-life to compute a freshness weight between 0 and 1.
4. Compute a combined score: combined_score = [RELEVANCE_WEIGHT] * relevance_score + [FRESHNESS_WEIGHT] * freshness_weight.
5. Return the passages sorted by combined_score in descending order.

OUTPUT SCHEMA:
Return a JSON object with a single key "reranked_passages" containing an array of objects. Each object must have:
- "passage_id": string
- "original_relevance_score": number
- "passage_date": string (ISO 8601 or null)
- "age_days": number
- "freshness_weight": number
- "combined_score": number
- "passage_text": string (the original text, truncated to [MAX_PASSAGE_LENGTH] characters if necessary)

CONSTRAINTS:
- Do not alter the original passage text beyond truncation.
- If two passages have identical combined scores, preserve their original relative order.
- If a passage date is in the future relative to the reference timestamp, set age_days to 0.
- Output only the JSON object. No surrounding text.

To adapt this template, start by defining your decay function. Common choices are exponential (weight = e^(-age * lambda)), linear (weight = max(0, 1 - age / max_age)), or logarithmic (weight = 1 / (1 + log(1 + age))). The half-life parameter controls how quickly relevance decays; for financial news, a half-life of 1 day is common, while for legal documents, 365 days may be appropriate. The RELEVANCE_WEIGHT and FRESHNESS_WEIGHT parameters let you tune the trade-off—a 0.7/0.3 split favors semantic match, while 0.3/0.7 prioritizes recency. Always log the raw scores alongside the combined scores so you can audit the reranker's behavior in production.

Before deploying, validate the output against a golden dataset of query-passage pairs with known ideal rankings. Check for edge cases: passages with missing dates, passages dated in the future, and queries where all passages are equally stale. If your use case involves regulated content, route passages flagged with age_days exceeding a safety threshold to a human review queue before they reach end users. Do not treat this prompt as a black box—monitor the distribution of combined scores over time and set alerts for sudden shifts that may indicate a broken date extraction step upstream.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Recency-Boosted Reranking Prompt. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe checks to run in the application layer before assembly.

PlaceholderPurposeExampleValidation Notes

[QUERY]

The user's original question or search string that requires time-sensitive results.

What were the latest earnings for AAPL?

Must be non-empty string. Check length < 2000 chars. Log original query for trace.

[PASSAGES]

Array of retrieved passages, each with text, relevance score, and publication date.

[{"id":"p1","text":"...","score":0.87,"pub_date":"2025-01-15"}]

Must be valid JSON array with 1-100 objects. Each object requires id, text, score, pub_date fields. Reject if pub_date is missing or unparseable.

[DECAY_FUNCTION]

The time-decay formula to apply. Options: exponential, linear, logarithmic, or step.

exponential

Must match one of: exponential, linear, logarithmic, step. Default to exponential if null or unrecognized. Validate against allowed enum before prompt assembly.

[HALF_LIFE_DAYS]

Number of days after which a passage's recency weight is halved. Domain-specific.

30

Must be positive integer or float. Range: 1-3650. Use domain-specific defaults: 7 for news, 90 for financial reports, 365 for academic. Reject if negative or zero.

[MAX_PASSAGES]

Maximum number of passages to return after reranking.

10

Must be integer between 1 and 50. Default to 10 if null. Truncate output array to this count after reranking. Warn if input passages count is less than this value.

[TIME_REFERENCE_DATE]

The reference date for recency calculations, typically the current date or query time.

2025-03-15

Must be ISO 8601 date string (YYYY-MM-DD). Default to system current date if null. Validate format before passing. Reject future dates unless explicitly allowed for backtesting.

[OUTPUT_SCHEMA]

JSON schema describing the expected output structure for each reranked passage.

{"id":"string","combined_score":"float","rank":"int"}

Must be valid JSON Schema object. Validate with JSON Schema parser before prompt assembly. Reject if schema is malformed or missing required fields.

[MIN_RELEVANCE_THRESHOLD]

Minimum combined relevance-freshness score for a passage to be included in output.

0.3

Must be float between 0.0 and 1.0. Default to 0.0 if null. Filter passages below this threshold after reranking. Log count of filtered passages for observability.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Recency-Boosted Reranking Prompt into a production RAG pipeline with validation, A/B testing, and observability.

The Recency-Boosted Reranking Prompt is not a standalone module; it sits between your initial retrieval step and your final answer generation or evidence selection step. In a typical RAG pipeline, you first retrieve a candidate set of passages (e.g., top-50 from a vector store or hybrid search). You then call this prompt with the original query, the candidate passages with their publication dates, and your configured decay parameters. The prompt returns a reranked list with combined relevance-freshness scores. You then take the top-N reranked passages and pass them to your answer generation prompt. This architecture keeps the reranking logic isolated and testable without coupling it to retrieval or generation code.

For production wiring, implement a thin service wrapper around the LLM call that handles input validation, retries, and output parsing. Validate that every candidate passage includes a publication_date in ISO 8601 format before calling the prompt; if dates are missing, either exclude the passage or apply a configurable default penalty. Parse the model's output against a strict JSON schema that expects an ordered array of objects with passage_id, relevance_score, freshness_score, combined_score, and rerank_justification fields. If parsing fails, retry once with a repair prompt that includes the raw output and the expected schema. Log every reranking call with the query, decay function parameters, input passage count, output passage count, and latency for later analysis. For high-stakes domains like financial intelligence, add a human review step when the gap between the top-ranked passage's publication date and the query's required freshness window exceeds a threshold.

A/B testing decay functions against user satisfaction metrics is the primary way to tune this prompt for your domain. Instrument your application to track which decay function and half-life parameters were used for each user session. Define a user satisfaction metric—such as answer thumbs-up rate, task completion rate, or explicit freshness feedback—and compare performance across decay function variants. Start with an exponential decay function and a half-life of 7 days for news domains or 90 days for financial reporting. Run A/B tests with at least 1,000 queries per variant before drawing conclusions. Avoid over-optimizing on offline ranking metrics alone; what looks good in a spreadsheet may not match user perception of freshness. If you observe that users consistently prefer results with higher freshness scores even when relevance drops slightly, consider increasing the freshness weight parameter in your combined scoring formula.

Model choice matters for this prompt. Use a model with strong instruction-following and structured output capabilities, such as GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro. Avoid smaller or older models that may struggle with the numerical scoring and justification requirements. If latency is critical, consider using a faster model for the initial retrieval step and reserving the more capable model for reranking only the top-20 candidates. Cache reranking results when the same query and candidate set appear within a short time window, but invalidate the cache when any candidate's publication date changes or when the decay function parameters are updated. For cost control, set a maximum token budget per reranking call and truncate long passages to the first 500 tokens before sending them to the prompt.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when applying time-decay weighting to relevance scores and how to guard against it.

01

Decay Function Overpowers Relevance

What to watch: A slightly older but highly authoritative source gets buried by a recent, low-quality snippet because the decay curve is too steep. Guardrail: Implement a minimum relevance floor. Before applying the decay multiplier, check if the base relevance score exceeds a threshold (e.g., >0.85). If so, bypass or reduce the decay penalty to preserve critical evidence.

02

Missing or Null Publication Dates

What to watch: A passage with a null or unparseable publication date gets dropped entirely or assigned a default score of zero, silently removing valid evidence. Guardrail: Implement a configurable default date strategy. Assign a conservative default age (e.g., 90 days) or a neutral recency score (e.g., 0.5) to un-dated documents, and log a warning for manual review of the source inventory.

03

Incorrect Half-Life for the Domain

What to watch: Applying a 24-hour half-life to legal documents or a 5-year half-life to breaking news. The reranker systematically promotes stale or suppresses fresh information. Guardrail: Parameterize the half-life by query classification. Use a pre-classification step to tag the query domain (e.g., news, legal, financial) and map it to a tested half-life configuration before reranking.

04

Score Collapse in Dense Result Sets

What to watch: When the initial retrieval returns 50+ passages with very similar relevance scores, the time-decay multiplier creates a new ranking that is effectively random, dominated by minor timestamp differences. Guardrail: Apply a minimum difference threshold. If the standard deviation of the base relevance scores is below a set value, reduce the weight of the recency multiplier to prevent noise from dictating the final order.

05

Future-Dated Content Exploitation

What to watch: A document with a future or far-future publication date (due to a metadata error or a placeholder) receives a perfect recency boost, artificially rising to the top of the list. Guardrail: Clamp the maximum recency score. Treat any date greater than the current system time as "now" to prevent future dates from achieving a score multiplier greater than 1.0. Flag the source for metadata correction.

06

Ignoring Temporal Intent Mismatch

What to watch: The user asks for a

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Recency-Boosted Reranking Prompt before shipping. Each criterion targets a specific failure mode in production RAG pipelines where stale evidence degrades answer quality.

CriterionPass StandardFailure SignalTest Method

Temporal ordering correctness

Reranked list places more recent passages before older ones when relevance scores are within 0.1 of each other and query is time-sensitive

Older passage with identical relevance score appears above a newer passage for a [TIME_SENSITIVE_QUERY]

Run 50 time-sensitive queries against a retrieval set with known publication dates; measure Kendall tau distance between output order and ground-truth recency order

Decay function application

Time-decay weight is applied correctly per the configured [DECAY_FUNCTION] and [HALF_LIFE_DAYS] parameter

Combined score equals raw relevance score with no decay adjustment visible in output

Inject passages with known ages and relevance scores; verify combined_score = relevance_score * decay_weight for each passage using unit tests

Score calibration range

All combined relevance-freshness scores fall within 0.0 to 1.0 inclusive

Any combined score exceeds 1.0 or is negative

Assert min(combined_scores) >= 0.0 and max(combined_scores) <= 1.0 across 100 reranking runs with varied inputs

Stale passage demotion

Passages older than [MAX_AGE_DAYS] are demoted below all fresher passages regardless of raw relevance

A passage exceeding [MAX_AGE_DAYS] appears in the top 3 results

Construct retrieval set with one highly relevant but expired passage; confirm it ranks below position 3 in output

Domain-specific half-life respect

Passages in [DOMAIN] with [HALF_LIFE_DAYS] decay at the configured rate; financial data decays faster than encyclopedia content

Financial earnings passage from 6 months ago ranks above a 1-week-old news article for a quarterly-results query

A/B test with [DOMAIN] = 'financial' and [DOMAIN] = 'encyclopedic' using same-age passages; verify financial decay is steeper

Output schema compliance

Every reranked passage includes fields: passage_id, raw_relevance_score, publication_date, decay_weight, combined_score, rank_position

Missing publication_date or decay_weight field in any output row

Validate output against [OUTPUT_SCHEMA] using JSON Schema validator; fail if required fields are absent or types mismatch

Tie-breaking behavior

When two passages have identical combined scores, the more recent passage wins the higher rank

Older passage with same combined score as a newer passage receives a better rank position

Feed retrieval set with two passages calibrated to produce identical combined scores but different dates; assert newer passage has lower rank_position value

Edge case: missing publication dates

Passages with null or missing publication_date receive a default decay_weight of 0.5 and a warning flag in output

Missing publication_date causes a crash, null score, or passage exclusion without warning

Include a passage with publication_date = null in test set; confirm output contains the passage with decay_weight = 0.5 and a warning field set to true

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with a single decay function (exponential) and a fixed half-life. Use the base prompt without schema enforcement. Replace [DECAY_FUNCTION] with exponential and [HALF_LIFE] with a domain-appropriate value like 7d for news or 90d for technical docs. Skip the A/B test harness and run manual spot checks on 20-30 query-result pairs.

Watch for

  • Scores that don't visibly change between recent and old passages when the age gap is small
  • The model ignoring the decay formula and applying its own intuition about recency
  • No baseline comparison—you won't know if reranking improved anything
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.