AI / Engineering journal

Keeping a RAG Knowledge Base Up to Date

A real citation can still point to an old policy. Detect changes, re-embed only what moved, propagate deletions and permissions, and prove it with evaluation.

Sylantix Engineering Team7 min read
A person reviewing revised manuals beside a laptop with document versions.
Sylantix / Engineering journalRAG · AI · Search
In this article 11 sections
TL;DR

Key takeaways

  • Give each source a stable ID and detect changes with hashes, timestamps or webhooks, then re-embed only the chunks that changed.
  • Handle deletions and permission changes as their own paths, because they often leave no content change to detect.
  • Build a new versioned index when the embedding model changes, and swap it in after evaluation.
  • Show freshness in answers and run a scheduled reconciliation between the source and the index.

The citation can be real and still be wrong

A support assistant answers a refund question and cites an official policy. The policy was replaced yesterday, but the search index still holds the old version. The answer looks well supported because the reference exists.

Keeping a RAG knowledge base current means tracking the lifecycle of its sources: creation, edits, moves, deletion and permission changes. A successful first upload does not prove any of that.

This article follows that lifecycle: identity, change detection, incremental updates, deletions and permissions, model changes, what users see, evaluation and reconciliation.

Give each source a stable identity

Track a source document ID separately from its title or path where the source system allows it. Otherwise a rename looks like a new document while the old chunks remain searchable.

For every chunk, keep enough metadata to trace it back: source ID, source version or modification time, content hash, ingestion time, processing status and the access rule that applies. When someone reports an old answer, this lets support ask a precise question: did the new version fail to enter the index, or did retrieval choose something else?

Detect changes

Pick the cheapest reliable signal each source offers:

  • Webhooks or change feeds: fastest, and the right first choice where available. They can be missed or duplicated, so treat them as hints that trigger a fetch. The handling patterns in webhook retries and idempotency apply.
  • Modified timestamps or ETags: poll for items changed since the last successful run. Store the cursor only after the batch is processed.
  • Content hashes: hash the normalized extracted text (after stripping boilerplate such as navigation or dates that change on every render). Equal hash means no work, even if the timestamp moved.

Combine them: use events for speed, polling as a safety net and hashes to avoid needless work.

Re-embed only what changed

Embedding every document on every run is slow and costly, and it makes the index unstable. Split the document into chunks, hash each chunk, compare with the stored hashes and embed only new or changed chunks. Delete chunks whose hash no longer exists.

Chunk boundaries matter here. If an inserted paragraph shifts every boundary, all chunks look changed. Chunk on structure such as headings and sections, not fixed character counts, so an edit stays local.

Suppose a manual changes from twenty sections to twelve. Updating twelve chunks leaves eight old ones behind unless the pipeline compares the full set. Publish a complete replacement: ingest the new version, verify it is complete, then make it the version eligible for retrieval and remove the old one according to your retention policy. Queries should never receive an accidental mixture of versions.

Treat deletions as their own path

An update shows up in a modification feed. A deleted file may simply stop appearing, and a polling job has nothing to read. Microsoft's Azure AI Search guidance on changed and deleted blobs illustrates the distinction: change detection does not automatically provide deletion detection, and orphaned search documents are the result of skipping that configuration.

Define how a removed source makes every associated chunk unavailable. Prefer a soft delete flag or tombstone that retrieval filters on immediately, with physical removal afterward. Include caches in the review: retrieval caches, stored answers and summaries can all keep the old text alive.

Record failed processing separately from deletion. If a connector cannot read a document because of an outage, do not assume the author removed it.

Propagate permission changes

A document can become restricted without changing a byte. Depending on the source, the timestamp your sync watches may not move. Microsoft's indexer reset and resync documentation notes that some permission metadata changes need separate handling.

Store access control data as filterable metadata on each chunk, and apply the current user's permissions as a filter at query time, not after the model has seen the text. Sync permissions on their own faster schedule than content. Test a permission-only change explicitly, including cached results. For the broader boundary between customers, see multi-tenant data isolation. A freshness dashboard that ignores access freshness misses one of the most serious error classes.

Re-index when the embedding model changes

Vectors from different embedding models, or different versions, are not comparable. Mixing them in one index silently degrades retrieval. When you change the model, the dimensions or the chunking strategy:

  • Build a new, versioned index beside the old one and fill it in the background.
  • Run your evaluation set against both and compare retrieval and answer quality.
  • Switch traffic by changing an alias or setting, keeping the old index for rollback until the new one proves stable.

Record the model name, version and chunking settings in the index metadata so you always know what produced a vector.

Choose a freshness target and show it

Different sources tolerate different delays. A historical manual can be daily. A current refund policy may need minutes. Ask the content owner how quickly an update must affect answers, then measure source change to searchable content. "The indexer runs every hour" is not the same as "changes are searchable within an hour" if jobs queue or fail.

Show freshness in the answer: cite the source with its last-updated date, for example "Refund policy, updated 2026-11-02". It lets users judge age themselves and makes stale answers easier to report. For urgent corrections, give authorized editors a way to withdraw a document from retrieval immediately while the replacement is prepared, without needing access to the vector database.

Evaluate after every re-index

Re-indexing changes what the system retrieves, so test it like a release. Keep a fixed set of real questions with expected sources, and after a major re-index check that the right chunks are retrieved, that removed documents no longer appear and that restricted documents stay hidden. The methods in evaluating LLM features before launch apply, and keyword versus semantic search helps when the failures are retrieval-related rather than freshness-related.

Reconcile on a schedule

Event-driven updates are fast, and missed notifications still need a recovery path. On a schedule, such as nightly, compare the source inventory with the index inventory: documents present in one and missing in the other, version mismatches and chunks with no known source.

Put safeguards around the comparison. A connector that returns a partial list during an outage must not trigger deletion of most of the knowledge base. Record the completeness of each inventory run, and refuse to apply deletions above a threshold, for example more than five percent of documents, without human approval.

Useful alerts: documents waiting too long for processing, repeated update failures, indexed records with no source and the age of the oldest unprocessed change. Keep enough history to tell a backlog from a temporary spike.

Test one document's whole life, then plan

Create a short test policy and ask a question it answers. Then edit the answer, rename the document, restrict access and delete it, checking the retrieved sources after every step. Repeat with an ingestion failure halfway through an update.

Your first step is to measure today's source-to-index delay for one important document type, and write down who must be able to withdraw a document quickly. Our RAG development work includes the ingestion and maintenance paths that keep answers grounded in the intended sources.

Facing this in your own product?

Describe your situation in a few sentences. Our engineering team replies within 24-48 hours on business days, and the first 30-minute consultation is free.

Sylantix Engineering Team

Written by the senior engineers who build these systems for clients: backends, AI features, mobile apps and the infrastructure under them. Questions about your own case go straight to them.

About the team →