Embedding Freshness Decay Calculator

Model how document embedding relevance decays over time for time-sensitive RAG.

Apply exponential or linear time decay to vector similarity scores based on document age, with a configurable half-life. Re-rank results so fresher documents win in time-sensitive retrieval, and see the adjusted scores side by side. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

Why decay similarity scores by age?

Pure vector similarity ignores time, so a perfectly-matching but stale document can outrank a slightly-less-similar fresh one. In domains like news, pricing, or policy, recency matters, and decay folds age into the ranking.

Vector similarity is blind to time. In domains where freshness matters — news, prices, policies, support docs — a stale document that happens to embed close to the query can beat a newer, slightly-less-similar one. A freshness decay layer fixes that by multiplying each similarity score by a factor that shrinks with document age. This calculator lets you model that factor and see the re-ranked result before you wire it into your pipeline.

How it works

For each document you supply an age in days and a base similarity from your vector search. The tool computes a freshness factor with the model you choose and multiplies it into the score:

  • Exponential: factor = 0.5 ^ (age / half-life) — smooth, never zero.
  • Linear: factor = max(0, 1 − age / cutoff) — straight-line drop to zero at the cutoff.
  • Step: factor = 1 while age ≤ cutoff, otherwise a fixed penalty.

It then re-sorts the documents by the adjusted score so you can compare the original and recency-aware rankings.

Worked example

Suppose a user query about a software pricing plan retrieves these three candidates from a vector search:

DocumentAge (days)Base similarity
Pricing guide 2023 (stale)5400.91
Feature comparison Jan 20241700.87
Current pricing page140.83

Without decay, the 2023 guide wins on similarity and is the top result — even though the pricing information it contains is likely outdated. With exponential decay and a 60-day half-life:

factor (540 days) = 0.5^(540/60) = 0.5^9 ≈ 0.002   → score ≈ 0.0018
factor (170 days) = 0.5^(170/60) = 0.5^2.8 ≈ 0.143  → score ≈ 0.124
factor (14 days)  = 0.5^(14/60) ≈ 0.848              → score ≈ 0.704

The current pricing page now tops the ranking despite having the lowest base similarity. For a question about current pricing, this is the right result.

Choosing a decay model and half-life

The right half-life depends entirely on how quickly your domain’s content expires:

DomainRecommended half-lifeReason
Financial news, live pricesHours to 1 dayInformation is materially wrong within hours
News and current events1–3 daysStories develop and context changes rapidly
Software documentation30–90 daysVersions ship; API signatures and UI change
Product descriptions60–180 daysPricing and features update quarterly or less
Legal or policy references90–365 daysAmendments are periodic but significant
Scientific reference materialYearsFundamental data rarely changes

Use the step model when freshness is binary: content within a defined window is fully valid, anything outside is uniformly penalised. This suits domains like legal citation periods or regulatory filing dates.

Implementation notes

  • Apply decay as a post-retrieval re-rank, not inside the approximate nearest-neighbour search itself. ANN indexes search on raw vectors; inject decay after retrieving the top-K candidates.
  • Store timestamps as metadata on each document in the vector database. Computing age at query time from a stored created_at field is cheap; storing age as a static number means re-indexing whenever you change your decay window.
  • If fresh documents begin dominating obviously irrelevant matches, your half-life is too short. Lengthen it until the quality-freshness balance feels right on your evaluation set.