← All answers

How do you handle superseded regulatory documents in a RAG system?

You do not solve it by deleting the old documents, and you cannot solve it with similarity search alone — a revoked circular is still textually the best match for a question about its subject. The working approach has three parts. Model the corpus as chains rather than files: each document belongs to a lineage, carries a version identifier and a validity interval, and knows what it replaced. Filter retrieval by validity at query time, relative to the date the question is about, not the date it was asked. And keep the superseded versions indexed but marked, because “what was the rule in March” is a legitimate question in a regulated environment, and because an answer that cannot show what changed is not auditable.

By Corrado Patierno · updated

Why the naive system gets this wrong

A vector index ranks by semantic similarity. Nothing in that operation knows about time, authority or revocation. Ask about a procedure and the index returns the passages that discuss it best — which will include the 2023 circular that the 2025 one replaced, often ranked above it, because the older text is longer and more explicit.

The generation step then makes it worse rather than better: it synthesises fluently across both, producing an answer that reads as authoritative and quietly merges two regimes. This is the failure mode that matters in regulated work, and it is not a hallucination in the usual sense — every sentence is grounded in a real document. The document is simply no longer in force.

Model the corpus as chains, not as files

The unit that matters is not the document, it is the lineage: the sequence of versions through which an obligation has passed. Each version needs four properties, and they have to be established at ingestion, because reconstructing them later from PDFs is guesswork:

  • Lineage identifier. What thing is this a version of. Two documents with different titles can belong to the same lineage; two with the same title often do not.
  • Version identifier. Immutable, and referenced by every chunk derived from the document, so a retrieved passage can always name its origin exactly.
  • Validity interval. From when, and until when — where the end is open until a successor closes it. This is what makes 'in force' computable.
  • Relation to the predecessor. Replaces, amends, integrates, or revokes. The distinction changes the answer: an amendment leaves most of the earlier text standing, a revocation does not.

Where the source publishes structured metadata, use it. Where it does not — which is most sectoral publishing — extraction of these four fields is a task worth doing with review in the loop, because an error here propagates into every answer the lineage ever grounds. In the Federfarma deployment the version chain is explicit and visible in the answer, so the reader can check the claim rather than trust it.

Filter at retrieval, not in the prompt

The temptation is to retrieve everything and instruct the model to prefer recent documents. This does not work reliably and cannot be audited: the instruction is a request, not a constraint, and nothing in the record shows which documents were in play.

The correct place is metadata filtering in the retrieval query itself. A question is evaluated against a reference date — normally today, but explicitly the date in question when a user asks about the past — and only versions valid on that date are eligible. Superseded versions remain in the index, retrievable when a historical question calls for them, and marked in the result so that neither the model nor the reader can mistake one for current.

Two refinements matter in production. Retrieve the successor alongside a superseded hit, so the system can say what replaced it rather than simply refusing. And keep the eligibility decision in the record — an answer that cannot show which versions it was allowed to see is not reconstructable, whatever else it logs.

Show the chain in the answer

The last part is interface, and it is where the burden actually shifts. An answer that cites “Circular 12/2025, in force since 3 March 2025, replacing Circular 7/2023” with a link to both is checkable in ten seconds. An answer that cites a title and a page number asks the reader to trust it, and in a regulated environment the reader is the one carrying the professional responsibility for acting on it.

This is the difference between a system that reduces compliance burden and one that merely moves it: the burden of establishing what is current sits in the system, and the evidence for it is on the screen.

Sources

Primary sources for the regulatory statements above. Where this page describes what an obligation requires, the text of the act is the authority, not this page.

This page is technical and architectural guidance, written from delivery experience in regulated environments. It is not legal advice, and it does not establish the regulatory classification of any specific system.

Currency is an architecture problem

If your assistant cannot say which version an answer stood on, the fix is in the ingestion pipeline, not in the prompt.

Start the conversation →