Skip to main content
PreparationZone Logo
PrepZone

Document Versions in a RAG System

Detect the change, re-embed the delta, retire stale vectors, and keep history when audit needs it.

Pass checkpoint below

Why this matters

  • HR published a March leave policy and PolicyDesk kept quoting January, because both PDFs were in the collection and January's wording was a closer vector to the question.
  • Stale retrieval looks like a model bug and is an ingestion bug.
  • Interviewers want the flow: detect, re-chunk, upsert, retire old points, filter to current.
  • Audit and "what was the rule on the day they applied" require keeping old versions on purpose, not by forgetting to delete them.

What you are tracking

Policies, product docs, and manuals change by edits and by full replacement. The RAG index is a copy of those words. If the copy lags, every faithful answer is faithfully wrong.

Give each document a stable document_id and a version (or an effective date). Store upload time, source, a content hash, and a status: active or archived. Default queries see only the active version. Old versions stay if audit, disputes, or "what did we say in January" are real requirements. They do not stay because cleanup was hard.

Updates are sometimes a paragraph and sometimes a new file. The pipeline should handle both: incremental re-embed when you can see the diff, full replacement when you cannot.

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 3 sections

  • The flow
  • Techniques
  • Benefits and costs

Test yourself

Answer these before moving on — recall is what makes it stick.