Inferensys

Prompt

Evidence Ranking with Temporal Decay Prompt Template

A practical prompt playbook for ranking evidence passages with configurable temporal decay weighting, designed for news summarization and financial intelligence systems where freshness is critical.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Determines if a temporal decay ranking prompt is the right tool for your RAG pipeline versus simpler or alternative approaches.

This prompt is designed for RAG pipelines where the recency of information is a first-class ranking signal, not an afterthought. Use it when your application serves time-sensitive domains—news summarization, financial intelligence, market analysis, competitive monitoring, or operational dashboards—where evidence older than a few days or hours can be misleading or factually wrong. The prompt assumes you already have a retrieval set with reliable publication timestamps and a clear reference date (typically 'now' in production). It does not perform retrieval itself; it expects pre-retrieved passages, their metadata, and a query as inputs. The core job-to-be-done is transforming a flat list of relevant-but-possibly-stale passages into a decay-adjusted ranking that a downstream answer generator or citation selector can trust.

The prompt applies a configurable decay function—you control the half-life, decay curve shape, and minimum weight floor—so older passages don't disappear entirely but are appropriately discounted. This is critical for queries like 'What is the current market sentiment on X?' where a highly relevant analysis from six months ago may still provide useful context but should not outrank a slightly less detailed report from yesterday. Do not use this prompt when your domain is largely time-invariant (e.g., code documentation, scientific fundamentals, historical research) or when your retrieval set lacks reliable timestamps. In those cases, a standard relevance-only ranking prompt from the Evidence Ranking and Prioritization group will be simpler and less prone to misconfiguration. Also avoid this prompt if your upstream retrieval already applies aggressive time-based filtering—double-decaying will distort rankings.

Before deploying, verify three prerequisites: (1) every passage in your retrieval set carries a parseable published_date or timestamp field in a consistent format; (2) you have defined a decay configuration (half-life duration, decay function type like exponential or gaussian, and a minimum weight threshold) that matches your domain's information velocity; and (3) your evaluation pipeline includes time-sensitive test queries where stale-but-relevant passages exist alongside fresh-but-less-relevant ones, so you can measure whether the decay-adjusted ranking improves downstream answer quality. If you cannot satisfy these prerequisites, start with a simpler ranking prompt and add temporal decay once your metadata pipeline and eval set are ready.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Evidence Ranking with Temporal Decay prompt template delivers value and where it introduces risk. This prompt is designed for time-sensitive domains where recency is a legitimate ranking signal, not a universal replacement for relevance.

01

Strong Fit: Time-Sensitive Summarization

Use when: ranking evidence for news briefs, earnings summaries, or market updates where information freshness directly impacts correctness. Guardrail: Configure the decay curve so relevance still dominates; a perfectly relevant week-old report should outrank a tangentially relevant minute-old tweet.

02

Poor Fit: Static Knowledge Retrieval

Avoid when: ranking evidence for historical analysis, legal precedent, or scientific literature where authority and accuracy are timeless. Risk: Temporal decay will incorrectly demote authoritative older sources in favor of recent but shallow content. Guardrail: Disable or invert the decay weight for queries classified as reference or historical.

03

Required Inputs

Use when: you have reliable publication timestamps for every candidate passage. Risk: Missing or malformed dates cause the decay function to either ignore passages or apply arbitrary penalties. Guardrail: Validate timestamp presence and format before ranking; route undated passages to a separate fallback ranking path with no decay applied.

04

Operational Risk: Decay Parameter Drift

What to watch: Hardcoded decay rates that made sense during a fast news cycle become destructive when the domain slows down. Guardrail: Expose the decay half-life as a configurable parameter keyed to query type or topic category, not a single global constant. Monitor ranking distributions for signs of over-decay.

05

Operational Risk: Recency Bias Amplification

What to watch: The decay function can amplify existing retrieval bias toward recent documents, producing rankings that are temporally clustered rather than evidence-diverse. Guardrail: Apply a diversity constraint alongside temporal decay to ensure the ranked set includes authoritative sources across multiple time windows, not just the most recent slice.

06

Eval Sensitivity: Boundary Cases

What to watch: Rankings become unstable near decay-curve inflection points where small timestamp differences cause large score swings. Guardrail: Include boundary-case eval checks with passages clustered near the decay threshold; verify that ranking order remains reasonable and doesn't flip on sub-second timestamp noise.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt that ranks evidence passages by relevance and recency using configurable temporal decay.

This template is designed to be pasted directly into your system prompt or user message template. It instructs the model to rank a list of evidence passages against a user query, applying a temporal decay function to prioritize recent information. The prompt uses square-bracket placeholders for all dynamic inputs, making it safe for programmatic substitution in your application code. Before using this in production, you must define your decay function and output schema in the [CONSTRAINTS] and [OUTPUT_SCHEMA] blocks.

text
You are an evidence ranking system. Your task is to rank the provided evidence passages by their relevance to the user's query, applying a temporal decay function to prioritize more recent information.

## USER QUERY
[QUERY]

## CURRENT REFERENCE DATE
[REFERENCE_DATE]

## EVIDENCE PASSAGES
[EVIDENCE_LIST]

## RANKING CONSTRAINTS
[CONSTRAINTS]

## OUTPUT FORMAT
[OUTPUT_SCHEMA]

## FEW-SHOT EXAMPLES
[EXAMPLES]

## INSTRUCTIONS
1. For each passage, calculate a base relevance score (0.0 to 1.0) indicating how well it answers the user query.
2. Apply the temporal decay function specified in the constraints to the base relevance score, using the passage's publication date and the reference date.
3. Rank all passages by their final decay-adjusted score in descending order.
4. If a passage's publication date is missing, treat it as the oldest possible date or apply a default penalty as specified in the constraints.
5. Output the ranked list strictly according to the provided output schema.
6. If the evidence set is empty, return an empty ranking.

To adapt this template, replace each placeholder with the appropriate values for your application. The [QUERY] is the user's time-sensitive question. [REFERENCE_DATE] should be the current date or the 'as of' date for the ranking, in ISO 8601 format. [EVIDENCE_LIST] must be a pre-retrieved set of passages, each with a unique ID, text content, and a publication date. The [CONSTRAINTS] block is where you define the exact temporal decay formula (e.g., exponential decay with a configurable half-life) and any domain-specific rules, such as absolute staleness cutoffs. The [OUTPUT_SCHEMA] must specify the exact JSON structure for the ranked list, including fields for passage ID, final score, and a brief rationale. Providing 2-3 diverse [EXAMPLES] in the few-shot block is critical for calibrating the model's scoring behavior and ensuring it correctly applies the decay function. Always validate the output against your schema before using the ranking in a downstream answer generation step.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the prompt needs to work reliably. Validate these before sending the model request.

PlaceholderPurposeExampleValidation Notes

[QUERY]

The user's time-sensitive question or topic for which evidence must be ranked.

What are the latest developments in the EU AI Act as of this week?

Must be a non-empty string. Check for temporal signals (dates, 'latest', 'recent'). If no temporal signal is detected, the temporal decay weighting may be irrelevant; consider routing to a standard evidence ranking prompt.

[EVIDENCE_LIST]

An array of evidence passages, each with content and a publication timestamp. This is the retrieval set to be ranked.

[{"id":"p1","content":"...","published_at":"2025-07-25T10:00:00Z"},{"id":"p2","content":"...","published_at":"2024-01-15T08:00:00Z"}]

Must be a valid JSON array. Each object must have 'id' (string), 'content' (non-empty string), and 'published_at' (ISO 8601 timestamp string). Reject the request if the array is empty or if any required field is missing or null.

[CURRENT_TIME]

The reference timestamp for calculating recency. All decay calculations are relative to this point.

2025-07-26T14:00:00Z

Must be a valid ISO 8601 timestamp string. This should be set by the application server at request time, not by the model. Validate that it is not in the past relative to the server clock.

[DECAY_FUNCTION]

A configurable instruction specifying how temporal decay should be applied (e.g., exponential, linear) and its half-life or decay rate.

Apply exponential decay with a half-life of 30 days. The recency score is calculated as 2^(-age_in_days / 30).

Must be a non-empty string describing a valid mathematical function. The application layer should parse this to confirm it can be executed. If the function is invalid or missing, default to a safe linear decay over 90 days.

[RELEVANCE_WEIGHT]

A float between 0.0 and 1.0 that balances the importance of content relevance against temporal recency in the final score.

0.6

Must be a float between 0.0 and 1.0. A value of 0.6 means the final score is 60% relevance and 40% recency. Validate the type and range. If null or out of range, default to 0.5.

[OUTPUT_SCHEMA]

The strict JSON schema definition for the ranked output, including fields for rank, id, scores, and rationale.

{"type":"object","properties":{"ranked_evidence":{"type":"array","items":{"type":"object","properties":{"rank":{"type":"integer"},"id":{"type":"string"},"relevance_score":{"type":"number"},"recency_score":{"type":"number"},"final_score":{"type":"number"},"rationale":{"type":"string"}},"required":["rank","id","final_score"]}}}}

Must be a valid JSON Schema object. The application must parse this schema before the model call and use it to validate the model's output. If the schema is invalid, abort the request.

[CONSTRAINTS]

Additional ranking rules, such as a minimum recency threshold, a hard cutoff for very old documents, or a requirement to always include at least one recent source.

Exclude any passage older than 2 years. Ensure the top 3 results include at least one passage from the last 7 days.

Must be a string or null. If provided, parse for actionable rules (e.g., 'exclude', 'ensure'). Log a warning if a constraint cannot be programmatically enforced by the post-processing layer.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the temporal decay ranking prompt into a production RAG pipeline with validation, retries, and observability.

The Evidence Ranking with Temporal Decay prompt is designed to sit between your retrieval step and your answer generation step in a RAG pipeline. After your retriever returns a candidate set of passages with timestamps, this prompt re-ranks them by balancing semantic relevance against a configurable recency weight. The output is a ranked list that your downstream answer generator or citation selector can consume directly. Do not use this prompt as a standalone ranker on static corpora where all documents are equally fresh—the temporal decay logic will distort rankings when recency is irrelevant.

To wire this into an application, construct the prompt payload with three required inputs: [QUERY] (the user's question), [PASSAGES] (a JSON array of objects with id, text, and timestamp fields), and [DECAY_CONFIG] (an object specifying half_life_days, min_weight, and relevance_weight). Validate these inputs before calling the model: timestamps must parse as ISO 8601, the half-life must be positive, and the relevance weight should be between 0 and 1. On the output side, enforce a strict JSON schema with fields ranked_passages (ordered array of id, score, rationale), decay_applied (boolean), and config_used (echoed config). If the model returns malformed JSON, run a repair pass using a lightweight validator like jsonschema in Python. Log every ranking call with the query hash, passage count, decay config, and output schema validity for later debugging.

For production deployments, choose a model that reliably follows structured output instructions—GPT-4o or Claude 3.5 Sonnet with strict JSON mode enabled are good starting points. Implement a retry loop with exponential backoff (max 3 attempts) for schema validation failures. If the ranking output is used in high-stakes domains like financial intelligence, add a human review step for rankings where the top passage score falls below a configurable threshold or where the score gap between rank 1 and rank 2 is less than 0.1. Avoid calling this prompt on retrieval sets larger than 20 passages without chunking—most models exhibit position bias and ranking degradation with long lists. Finally, instrument the harness with trace logging that captures the decay config, input passage count, output ranking length, and validation status so you can detect drift when model behavior or data distributions change.

PRACTICAL GUARDRAILS

Common Failure Modes

Temporal decay ranking is powerful but brittle. These are the most common production failures and how to prevent them before they reach users.

01

Recency Overwhelms Relevance

What to watch: Fresh but tangentially related passages outrank highly relevant older evidence. A breaking news alert about a company's stock ticker change buries a detailed financial analysis from last quarter. Guardrail: Cap the maximum temporal boost. Require a minimum relevance threshold before decay weighting applies. Log cases where recency alone flipped the top-3 ranking.

02

Decay Curve Misses Domain Cadence

What to watch: A single decay function applied uniformly. Financial filings decay in hours, medical literature in years. Using the wrong curve makes rankings nonsensical. Guardrail: Parameterize the half-life by document type or query category. Validate decay parameters against domain experts. Run A/B tests with different curves on historical queries with known-good rankings.

03

Missing Publication Dates Produce Garbage

What to watch: Passages with null, malformed, or future timestamps get silently dropped, assigned epoch zero, or boosted to the top. Guardrail: Explicitly handle missing dates with a configurable default age or a separate date_confidence flag. Reject passages with future dates. Add a temporal_quality field to the output schema that surfaces date issues.

04

Stale Cache Masks Fresh Evidence

What to watch: The retrieval index hasn't been refreshed, so the ranker sees only old passages. Temporal decay correctly downranks everything, but there's nothing fresh to promote. The system looks calibrated while being completely blind. Guardrail: Monitor the age distribution of the top-K ranked passages. Alert if the newest passage in the top-10 is older than the decay half-life. Pair ranking with index freshness checks.

05

Position Bias Corrupts Temporal Signal

What to watch: The base retriever already sorts by recency. The ranker then applies temporal decay on top, double-counting freshness and amplifying noise. Guardrail: Shuffle or normalize the input passage order before ranking. Test ranking stability by permuting input order. If rankings change significantly, position bias is dominating the temporal signal.

06

Decay Produces Ties Without Tiebreaking Logic

What to watch: Multiple passages with identical relevance scores and publication dates collapse into an arbitrary order. Downstream citation selection picks randomly, producing inconsistent answers. Guardrail: Define a deterministic tiebreaking hierarchy: source authority, then passage specificity, then document position. Log every tiebreak decision so ranking is reproducible and debuggable.

IMPLEMENTATION TABLE

Evaluation Rubric

Run these checks on a golden dataset with known publication dates and expected rankings. Each criterion targets a specific failure mode in temporal evidence ranking.

CriterionPass StandardFailure SignalTest Method

Recency weighting

Passages published within [RECENCY_WINDOW] receive higher scores than older passages with equal relevance

Older passage outranks a newer passage with identical relevance score and source authority

Pairwise comparison on golden pairs with controlled publication dates and matched relevance

Temporal decay curve

Score difference between passages 1 day and 30 days old exceeds difference between 30 days and 180 days old

Linear score drop or no measurable decay between mid-range and old passages

Score delta measurement across three age brackets on a fixed-relevance golden set

Relevance preservation

Highly relevant old passage outranks low-relevance recent passage

Recent but irrelevant passage appears above older passage with strong query alignment

Golden set with deliberate relevance-age tradeoffs; check rank order against expected

Date parsing accuracy

All [PUBLICATION_DATE] formats in golden set produce valid timestamps without null scores

Any passage receives null score or default decay due to unparseable date field

Schema validation on output; count null or default scores across golden set

Score calibration

All scores fall within [MIN_SCORE] to [MAX_SCORE] range and are monotonically decreasing with age for equal-relevance passages

Scores outside defined range or score inversion for same-relevance different-age passages

Range check on all output scores; monotonicity check on controlled-relevance pairs

Ranking stability

Same input produces identical ranking order across 3 runs with temperature=0

Rank order changes between runs for same input and parameters

Repeatability test: 3 identical calls, compare rank lists for exact match

Boundary handling

Passage dated exactly at [RECENCY_WINDOW] boundary receives score between fresh and stale tiers, not a cliff drop

Score drops to minimum immediately at boundary or boundary passage receives same score as 1-year-old passage

Boundary injection test: insert passage at exact window edge, verify score between adjacent age brackets

Missing date fallback

Passage with missing [PUBLICATION_DATE] receives a neutral default score and is flagged in output

Missing-date passage receives maximum freshness score or is silently excluded from ranking

Null-date injection: include passage without date field, check output for default score and flag presence

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a small set of passages with known publication dates. Use a simple recency weight slider (e.g., decay_factor: 0.5) and ask the model to explain its ranking in plain text before moving to structured output.

code
[SYSTEM_INSTRUCTION]
Rank the following evidence passages by relevance to [QUERY], applying a temporal decay factor of [DECAY_FACTOR] so that older passages receive a penalty proportional to their age in days.

[PASSAGES]
[OUTPUT_FORMAT: Free-text ranked list with scores and age penalty notes]

Watch for

  • The model ignoring the decay factor entirely and ranking purely by semantic relevance
  • Inconsistent age calculations when dates are in different formats
  • Over-penalizing slightly older but highly authoritative passages
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.