RAG Index Maintenance: Updates, Deletions and Stale Answers — AI Automation article by Rui Codex

A RAG index stays current by treating each source document as a versioned record. Detect changes at the source, re-chunk and re-embed only the changed content, remove vectors for deleted or superseded documents, and check retrieval after every run. Without these steps, the assistant keeps retrieving old passages and presents them as current.

Key takeaways

  • Stale answers usually come from pipeline gaps, not from the language model itself.
  • Change detection based on content hashes is more reliable than timestamps alone.
  • Deletions must remove chunks and vectors from the index, not only from the source system.
  • Every update run should end with retrieval checks against known questions.

Why do stale answers happen in a RAG system?

Stale answers happen when the retrieval index no longer matches the documents the business currently relies on. The language model only sees what retrieval returns, so an outdated chunk produces an outdated answer, often phrased with full confidence.

The gap usually opens in one of three places. The ingestion job may run on a schedule that misses edits made between runs. The job may update new documents but never remove old ones. Or it may re-embed a document while leaving its earlier chunks behind, so two versions compete at query time.

Each failure looks different to the user. A missed update returns a policy that was replaced last month. A missed deletion returns a withdrawn price list. A duplicate version returns a mix of both, which is harder to notice because parts of the answer are correct.

Tip: Ask the team which document types are expected to change weekly. Those are the sources that need the most frequent sync, and they should be tested first.

How do you detect that a source document has changed?

Compare a content hash of each document against the hash stored at the last successful ingestion. A hash changes whenever the text changes, regardless of what the file system reports, so it is the safest basis for deciding what to re-process.

Timestamps are a useful hint but a weak signal on their own. Some systems update a modified date when a file is only opened, and some copy operations reset it. Exports from document platforms may also rewrite every file, which makes every document look changed.

Most teams combine three signals: the source's change feed or webhook where one exists, a periodic full listing to catch missed events, and a hash comparison before any expensive embedding step. The full listing matters because webhooks can fail silently.

  • Store the source identifier, the content hash, the chunk list and the embedding model version for every document.
  • Record the time of the last successful run separately from the time of each document change.
  • Quarantine documents that fail parsing rather than silently skipping them.

Should you re-embed whole documents or only changed chunks?

Re-embed only the chunks whose text changed, but only if chunk boundaries are stable. If a small edit shifts every boundary after it, the practical effect is a full re-embed of that document anyway.

Stable boundaries depend on how the document is split. Splitting by headings or by fixed structural units keeps most chunks identical after a local edit. Splitting by a fixed character count does not, because one inserted sentence moves everything downstream.

Changing the embedding model is a different problem. Vectors from two models are not comparable, so a model upgrade requires re-embedding the full corpus or maintaining two indexes during a migration. Treat the model version as part of the index identity.

Tip: Write the chunk identifier as a hash of the source identifier, the position and the text. Identical chunks then keep their identifiers across runs, which makes diffs cheap to audit.

How should a RAG index handle deletions and superseded content?

A deletion must remove every chunk and vector that came from the deleted source, and it must be recorded so that a later sync does not restore it. Removing the file from the source system alone leaves the vectors in place.

Superseded content needs its own rule. When a new version replaces an old one, the old chunks should be removed in the same transaction as the new ones are written. Otherwise a query can retrieve chunks from both versions. If the business needs history for audit purposes, keep the archived versions in a store that retrieval does not query.

Deletions fail in predictable ways. A source can be moved rather than deleted, which looks like a delete followed by a create, and the identifier changes. Access permissions can also be revoked, so a document disappears from one user's view but remains searchable for others. Handle moves by mapping old identifiers to new ones, and handle permission changes by filtering at retrieval time as well as at ingestion.

  • Delete by source identifier, not by a fuzzy match on the file name.
  • Run deletion and insertion in one job so a failure cannot leave both versions live.
  • Keep a tombstone record so a re-sync does not resurrect removed content.

Hypothetical examples

Here are two hypothetical scenarios:

In the first scenario, an internal support assistant indexes a shared folder of product guides. A guide is revised and the new version is ingested, but the old chunks remain because the job only inserts. Staff then receive instructions for a setting that no longer exists. The fix is to compare hashes per source and delete the old chunk set before inserting the new one.

In the second scenario, a contract-search tool indexes documents from a legal team's document management system. A contract is moved to an archive folder, which changes its identifier. The pipeline treats the move as a deletion and an unrelated addition, so the archived contract is still searchable under its old identifier. A mapping table from old to new identifiers resolves this, and a nightly reconciliation job compares source listings with index contents to catch any remaining mismatch.

Tip: Build a reconciliation job that compares the list of source identifiers with the list of indexed identifiers. Any item present in only one list is a finding to review, and this check catches silent failures that the update logic never reports.

Does GDPR require you to remove personal data from an index?

If the index holds personal data, GDPR obligations apply to the copies in the index as well as to the source, so an erasure request generally has to reach the vectors and chunks too. The regulation sets out the principles and the rights of data subjects, and the official text is the reference for the exact obligations. Regulation (EU) 2016/679 (GDPR) on EUR-Lex sets out these obligations, including the right to erasure. This article is general information and not legal or tax advice.

Technically, erasure needs a way to find every chunk derived from a person's data. Storing the source identifier with each chunk makes this possible. Without it, the only option is a full rebuild, which is slow and easy to forget.

Rui Codex offers technical implementation support for these pipelines, including deletion tracing and index design. It does not provide legal, tax or compliance advice, audits or certification.

How do you check that answers are current?

Check answers by running a fixed set of questions with known current answers after each update run, and by inspecting the sources returned. Automated retrieval tests catch index problems that a language model review would miss, because the model can only repeat what it was given.

Build the test set from real questions, not from the documents themselves. Include questions whose answers changed recently, questions about withdrawn content, and questions where the old and new versions both exist. A passing test should check the returned source identifiers, not only the generated text.

Measure freshness as the age of the newest indexed version of each source compared with its current version. Alert when the gap exceeds the tolerance the business has agreed for that content type.

Tip: Include at least one question about content you deliberately removed. If the assistant still cites it, the deletion path has failed.

Frequently Asked Questions

How often should a RAG index be updated?

The right frequency depends on how quickly the source documents change and how costly a wrong answer is. Fast-changing operational content may need event-driven updates, while reference material can often sync on a schedule. Whatever the interval, a periodic full reconciliation is still needed to catch missed events.

Is a timestamp enough to detect changed documents?

No, a timestamp is not enough on its own because some systems change it without changing content and some copy operations reset it. Comparing a content hash with the last ingested hash is more reliable. Use timestamps as a cheap first filter, then confirm with the hash before re-embedding.

What happens if a deleted document is still returned?

A deleted document is still returned when its chunks or vectors were never removed, or when a later sync restored them. Check whether a tombstone record exists and whether the deletion ran in the same job as the source change. The reconciliation job should flag any identifier present in the index but absent from the source.

Should old document versions be kept in the index?

Old versions should generally not be searchable in the live index because they compete with the current answer. If history is needed for audit or review, store archived versions separately and exclude them from retrieval by default. Make the archive query an explicit, separate capability.

When should you rebuild the entire index?

A full rebuild is appropriate after an embedding model change, a change to the chunking strategy, or when reconciliation shows widespread drift. Run it into a new index and switch traffic only after the retrieval tests pass. This avoids serving a half-rebuilt index during the process.

Conclusion

Keeping a RAG index current is an engineering discipline with clear parts: reliable change detection, stable chunk boundaries, deletions that remove every derived vector, and tests that check which sources are returned. Each part fails in a known way, and each can be monitored. Teams that treat the index as a versioned data product rather than a one-time import usually find stale answers much easier to prevent. If you are designing an ingestion pipeline and want a second engineering view, request a project consultation or email info@ruicodex.com.

Sources

Tags: RAG index retrieval augmented generation AI automation data synchronisation vector database API integration GDPR workflow automation

Need Help Implementing This?

Our team can help you put these insights into practice. From AI automation to custom software development, we build solutions that deliver real results.

Send a project request