Standard RAG systems rank documents by cosine similarity with no awareness of when information was true, causing outdated documents to surface ahead of current ones. This post describes a temporal reranking layer inserted between the vector retriever and the LLM that addresses three distinct time problems: hard-removing expired facts, boosting active time-bounded events, and using exponential decay to prefer newer versions of updated documents. The design uses two orthogonal axes — validity state (EXPIRED/VALID/TEMPORAL) and document kind (STATIC/VERSIONED/EVENT) — combined in a scoring formula that blends semantic similarity with decay score, recency score, validity multiplier, and an event relevance gate. Content-type-specific half-life profiles (from 1 day for breaking news to 36,500 days for mathematics) prevent over-penalizing timeless content. Additional features include document pairing for weak-but-useful sources, confidence tiers for conflicting documents, query-adaptive temporal weighting, and version-chain deduplication. The implementation adds 15–30ms overhead and requires only a created_at timestamp on documents. Full code is available on GitHub.
Table of contents
TL;DRWho this is forWhy Vector Search Has No Sense of TimeThree Time Problems, Three Different FixesWhat I Built: A Temporal LayerThe Core Design: Two Orthogonal AxesThe Scoring FormulaThe Failure That Revealed the EVENT Relevance GateFour Scenarios: Before and AfterWhat broke next — and how I fixed itNot All Content Decays at the Same RateWhat This Does Not SolveThe TakeawayRun It YourselfReferencesDisclosureSort: