Keeping a RAG index fresh as the source corpus changes — what does incremental indexing require?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
The documents behind a RAG system are constantly created, edited, and deleted. Explain how to keep the index fresh incrementally rather than rebuilding it, and what you must handle for deletions.
Key chunks to a stable document id, detect changes by hash or timestamp, upsert edits as delete then insert, and hard-delete removals so stale content can never be retrieved.
Picture a library where the shelves are your search index and the catalogue cards point readers to the right shelf. Every day some books get added, some get a new edition, and some get pulled. You would not burn down the library and rebuild it from scratch each morning. Instead you give every book a fixed ID, check which ones changed since yesterday, and only touch those. A new edition means you take the old copy off the shelf and put the new one up under the same ID. A pulled book means you actually remove it, not just slip a 'do not lend' note inside while leaving it on the shelf — because if it is still on the shelf, a reader can still grab it. A RAG index works the same way: update only what moved, and make deletions real.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
8 min: reject full rebuilds, set up chunk identity, walk the three change-detection strategies, explain upsert as delete then insert with orphan risk, then make the case for hard deletes and a reconciliation pass.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Soft-deleting a removed document by flagging it instead of deleting its vectors — the chunks stay searchable and get retrieved, which is a correctness bug and, for revoked-access or right to be forgotten content, a compliance violation.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.