Applied AI · deep dive

How to update a RAG knowledge base without stopping the system

A demo lives on a static corpus, production on a moving one. Incremental updates instead of full reindexing, swapping the index without a restart, deleting documents, and which metrics reveal retrieval degradation before users report it.

8 min read

Why updating is an engineering problem of its own

In a demo the corpus is loaded once and updating never comes up. In production documents change daily, and a system answering from a superseded revision is worse than no system: it sounds just as confident while quoting a cancelled rule.

So updating is designed together with retrieval rather than bolted on later. Three questions need answers before launch: how a document enters the index, how it leaves, and what a user sees at the moment the index changes.

Incremental updates instead of full reindexing

Reindexing the whole corpus takes hours and real money in embeddings, and there is no reason to run it because one document changed. The working pattern: a content hash at document and chunk level, recomputing only the chunks that changed and leaving the rest alone.

This has a non-obvious consequence: chunking must be deterministic. If the same document is split differently each run, the hashes never match and the “incremental” update becomes a full reindex under another name.

Swapping the index without a restart

Restarting the service to refresh the base is not a solution but a postponement: it drops open sessions and makes updates rare, because each becomes an event. The standard approach is a versioned index behind a pointer: the new version is built alongside, verified, then the pointer is switched atomically while the old version is kept until in-flight requests finish.

The crucial part is verification before the switch, not after. An index built with a broken pipeline switches over just as smoothly as a correct one and is discovered only through complaints.

Deletion: the part remembered last

A document is removed from storage while its chunks stay in the index, and the system keeps answering from something that no longer exists. In sensitive domains that is not an inconvenience but a breach: an employee sees data whose access has been revoked.

The minimum working scheme: the document store is the source of truth and the index is derived from it; deletions and permission changes travel the same pipeline as additions and are verified by the same test. Access rights live in chunk metadata and are applied as a pre-search filter rather than trimmed out of the answer.

What updating does to retrieval quality

Adding to an index changes not only its contents but the competition for the top results: new chunks displace old ones on similar wording. A separate trap is changing the embedding model: old and new vectors are not comparable, and such a move requires a full rebuild rather than an append.

  • The share of questions where the right fragment reached the top results — before and after the update, on the same question set.
  • The share of answers with empty retrieval: a rise means something fell off in the pipeline.
  • The age of the freshest document in the index — the simplest indicator that updates are running at all.
  • Update cost: how many chunks were recomputed per document edit.

What is enough at the start

Not every project needs real-time updates. If policies change quarterly, a nightly rebuild with verification before the switch closes the task entirely and costs far less to maintain.

The difference between “once a day” and “within the hour” is pipeline configuration, not a different architecture. The difference between having deletion and not having it, however, is architectural and must be built in from the start.

// In short
Incremental updates only work when chunking is deterministic.
Version the index and switch it behind a pointer: restarting to refresh is a postponed problem.
Deletions and access rights travel the same pipeline as additions, or the system answers from revoked data.
Changing the embedding model means a full index rebuild, not an append.
// Questions

Can the index be updated without stopping the service?

Yes, and it is standard practice: a new index version is built alongside, verified on a question set, then the pointer is switched atomically. In-flight requests finish on the old version. A restart is needed only when the storage schema changes.

How often does the index need a full rebuild?

By event, not by schedule. A full rebuild is required when the embedding model changes, when chunking rules change, or when the metadata schema changes. In all other cases incremental updates of changed documents are enough.

What happens to answers during an update?

With a versioned index, nothing: before the switch users are served from the old version, after it from the new one. Trouble starts where chunks are appended to a live index without versioning: then part of the retrieval set reflects the old state and part the new one.

How do you notice that an update made things worse?

Run the same question set before and after the switch and compare the share of questions where the right fragment reached the top results. That is cheaper than any manual review and catches regressions before users do.

Should document version history be kept?

In regulated domains, yes, together with the effective date in chunk metadata. That allows answering “as of a date” and explaining why an answer was what it was — which in a dispute matters more than the answer itself.

// Read next

Need a knowledge base that does not go stale in a month? Let us design updates together with retrieval.