Track document freshness in a RAG pipeline
In this article (5 sections)
A document can remain searchable after its rule is obsolete. Freshness is a source contract: which date matters, how old evidence may be, who reviews it and what the assistant does after the limit.
Compute age from a declared date
The RAG ingestion lab evaluates its synthetic corpus on 20 September 2026.
from ingestion_cases import freshness_case
result = freshness_case()
assert result["as_of"] == "2026-09-20"
assert result["maximum_age_days"] == 210
assert result["stale_ids"] == ["refund-v1", "public-help-v1"]
print(result["documents"])This uniform 210-day rule is a teaching fixture. Real policies need source-specific review or effective intervals; age alone does not make a document wrong.
Store dates with meaning
Keep publication, effective-from, effective-to, last verified, ingested and observed dates separately. “Updated” may describe a web page template rather than policy content. Record the owner and review schedule.
Use event-driven updates where sources provide them, plus periodic reconciliation against the inventory. A changed digest with an unchanged version should alert the owner. A superseding version should close the prior effective interval without deleting historical evidence needed for audit.
Define stale behaviour
Options include exclude from current answers, retrieve with a visible warning, require corroboration or abstain and contact the owner. Choose by task risk. Do not let the model decide freshness from prose or hide a stale-source warning.
Evaluate current, historical, future-effective, missing-date and conflicting-version questions. Measure whether the selected evidence matches the query’s as-of date and whether stale items are kept out of current answer context.
The Generative & Agentic AI course connects freshness to source ownership, retrieval filters and release evaluation.
Exercise
Add effective intervals and review rules to 20 sources. Simulate a superseding version and a missed review. Test current and historical queries, then demonstrate the exact abstention or warning path.
Continue learning
This article is part of the RAG ingestion and document preparation sequence. Use the neighbouring tasks when you need the prerequisite or the next application.
- Review the prerequisite or neighbouring task in Deduplicate documents without erasing valid versions.
- Continue with Delete a source document from every retrieval index.
Reference: NIST Generative AI Profile.
Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.
This article is part of our Generative & Agentic AI programme — 3 months. Add practical GenAI, retrieval and agent-building skills to your existing toolkit.
Explore Generative & Agentic AI