
RAG Retrieves the Wrong Answer When Your Corpus Ages. Here Is What You Can Do
Similarity search ignores time, so RAG serves outdated answers. Five mechanisms keep your corpus fresh without deleting a record.
Most RAG systems rank documents by semantic similarity.
A pricing page from last year and today's pricing page score nearly the same against the query "what does the Pro plan cost." The retriever returns both. The model answers from whichever ranks higher. Sometimes that is the stale one.
This is a demo I built to show five mechanisms that keep a knowledge corpus fresh.
The friction: similarity ignores freshness
A vector search returns the top matches by cosine distance. That is the entire ranking signal in a basic RAG pipeline.
Nothing in that signal knows a document expired. Nothing flags that two retrieved documents contradict each other. Nothing notices that a newer version replaced an older one.
The corpus grows. Old content stays retrievable at full weight. Answer quality degrades quietly.
Teams patch this with manual review. An engineer deletes stale docs. A subject expert audits the corpus every quarter.
Deletion destroys the audit trail. Quarterly review misses the three months in between. Neither approach reacts to how documents actually get used.
The gap widens as the corpus grows past a few thousand documents.
The solution: five expiry mechanisms over one corpus
I built a proof of concept that scores freshness, tracks replacements, and reacts to usage. It never deletes a document. It changes a document's state instead.
Mechanism 1: Decay score
Each document gets a freshness score between 0 and 1. The formula is
0.5^(age / half-life)The half-life depends on content type. News uses 7 days. Pricing uses 30. Policy uses 180. Technical docs use 365.
The final ranking score is semantic relevance times decay score. Old content sinks even when its text matches well.
Here is the effect from the demo. A document scored 0.82 semantic relevance against a query. Its decay score was 0.32. Its final score was 0.26.
A competing document scored 0.80 relevance and 0.79 decay. Final score 0.63. The fresher document won by a wide margin.
Mechanism 2: Declared TTL
Documents carry two optional dates. `valid_until` is a hard deadline. `review_after` is a soft reminder.
Past valid_until, an active document moves to Quarantined. It leaves the active corpus.
Past review_after, an active document moves to Suspect and enters the review queue. It stays retrievable, now under watch.
Mechanism 3: Supersession
A new document can replace an older one on the same topic. The system detects candidates at ingestion time.
The rule requires similarity at or above 0.85, an identical topic, and an earlier ingestion date. A match creates a proposal.
You confirm or reject. Confirm moves the old document to Superseded and records a directed edge in a graph. The old document points to its replacement.
Mechanism 4: Usage signals
The corpus learns from behavior. It counts retrievals, citations, not-useful votes, and outdated reports.
- Retrieval threshold at 10. Reaching it queues the document for review.
- Not-useful threshold at 3. Reaching it moves an active document to Suspect.
- One outdated report. Moves an active document to Suspect immediately.
- Citations. Tracked, never used to penalize.
Mechanism 5: Quarantine lifecycle
Documents move through five states: Active, Suspect, Quarantined, Archived, Superseded.
The state machine allows nine transitions and validates every one against a fixed whitelist. No transition leads to deletion. No delete operation exists in the code.
Every state change records the origin, target, reason, and timestamp. Any document returns to Active through rehabilitation.
Conflicts surface at query time
The retriever also compares the documents it returns against each other. Two documents with an identical topic, similarity at or above 0.80, and no supersession link get flagged as a conflict. The demo shows two FAQ entries claiming a device limit of three and five.
The system flags the pair and queues the older document for review. The user sees the contradiction instead of trusting one at random.
Why this matters
RAG quality is a data freshness problem as much as a retrieval problem.
Ranking by relevance alone trusts stale content. Deleting stale content destroys the record. This approach does neither.
It demotes what aged. It keeps what it demoted. It shows its work. Your corpus stays trustworthy without losing its history.
This is a proof of concept. I built it to demonstrate the mechanisms, not to serve production traffic.
How can you build it?
There are many ways to build this. What follows is one architecture, not the architecture. Treat this as a starting point and size each choice to your own workload.

I ran it serverless. The corpus is small, traffic is bursty, and idle cost should be zero. That shaped every decision below.
Compute: AWS Lambda. Two functions. One serves the API, one runs the scheduled evaluation. Lambda fits bursty traffic and costs nothing at rest. If you run steady high throughput, containers on ECS or Fargate may cost less per request. Measure before you commit.
Documents: Amazon DynamoDB. Four tables, single-digit millisecond reads, and transactions for atomic state changes. If your access patterns are relational or you need ad hoc queries, a relational store may serve you better. I chose DynamoDB for the transaction guarantee on lifecycle transitions.
Embeddings: Amazon Bedrock. This one is not optional. Similarity ranking is only as good as the embedding model. I used Titan Text Embeddings V2 at 1024 dimensions. Pick your embedding model deliberately. It sets the ceiling on retrieval quality.
Vector search: Amazon S3 Vectors. New, and worth a look. AWS positions it as lower cost than dedicated vector databases, which suits a demo or a modest corpus. Evaluate it against your scale and latency targets before you standardize on it. If you need high queries per second or advanced filtering, compare it with OpenSearch or a dedicated vector database.
Scheduling: EventBridge Scheduler. It re-evaluates the corpus every six hours. A cron on a container would also work. Scheduler keeps the serverless footprint and needs no server to babysit.
Delivery: S3 and CloudFront. The SPA is static. CloudFront serves it over HTTPS and routes /api/* to the same origin, so there is no CORS to manage.
The pattern that matters more than any service: keep the domain logic pure and put AWS behind adapters. Decay, the state machine, supersession, and ranking never call a cloud API. That let me test them for free and swap any service without touching the logic. Choose your services for your needs. Keep the core independent of them.
Where does your knowledge base go stale first? Pricing? Policies? Docs? Tell me what breaks for you.
further link and demo: https://www.linkedin.com/pulse/rag-retrieves-wrong-answer-when-your-corpus-ages-here-alfonso-61c8e/  ;
For further reading:
- Weaviate 1.35, object Time-to-Live in a production vector database: https://weaviate.io/blog/weaviate-1-35-release
- T-GRAG: A Dynamic GraphRAG Framework for Resolving Temporal Conflicts and Redundancy in Knowledge Retrieval: https://arxiv.org/abs/2508.01680
- VersionRAG: Version-Aware Retrieval-Augmented Generation for Evolving Documents: https://arxiv.org/abs/2510.08109
- Zep: A Temporal Knowledge Graph Architecture for Agent Memory: https://arxiv.org/abs/2501.13956
- RAG-Enhanced Large Language Models for Dynamic Content Expiration Prediction in Web Search https://arxiv.org/abs/2605.13052
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article