How do you keep a RAG index fresh as documents change?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Freshness is a pipeline-and-consistency problem, and stale answers are among the most corrosive RAG failures ("the wiki was updated Tuesday; the bot still gives the old policy").
Full worked answer with diagram
Freshness is a pipeline-and-consistency problem, and stale answers are among the most corrosive RAG failures ("the wiki was updated Tuesday; the bot still gives the old policy").
Change detection: prefer event-driven ingestion - webhooks or change-data-capture from source systems (Drive/Confluence/SharePoint APIs expose change feeds) - over blind full re-crawls. Where only polling is possible, use content hashes or modified-timestamps to skip unchanged documents. Track per-document: source ID, version/hash, last-indexed time.
Incremental re-indexing: on document change, re-parse → re-chunk → re-embed → delete the old chunks, insert the new - as close to atomically as your store allows. The classic bug: chunk counts and boundaries shift between versions, so updating "in place" by chunk position leaves orphans. The robust pattern is doc-scoped replacement: all chunks carry a doc_id + doc_version, new-version chunks are written, then old-version chunks are deleted (or queries filter to latest version). Deletions from the source must propagate too - a "deleted" document still surfacing from the index is a compliance incident, not just a bug.
Index maintenance: ANN indexes degrade under churn - HNSW tombstones deleted nodes and its graph quality erodes; IVF centroids drift from the data distribution. Plan periodic compaction/rebuilds, and monitor recall-vs-exact on a probe set as a canary.
Consistency across stores: hybrid systems duplicate state (vector index + BM25 index + metadata DB). Drive all of them from one ingestion log/outbox so they can't diverge; staleness bugs where BM25 knows a doc that the vector index doesn't produce maddening intermittent behaviour.
Freshness SLO: state one - e.g., "changes visible in ≤5 minutes p95" - and measure ingestion lag as a first-class metric. Also mind caches: semantic answer caches and prompt caches must be invalidated (or keyed) on document version, or freshness work upstream is invisible to users. For rapidly changing data (inventory, on-call schedules), don't index it at all - fetch it live via a tool call and reserve RAG for slow-moving knowledge.
Worth sketching. Version-scoped replacement is easier shown than described, orphan chunks and cache invalidation included.
flowchart LR
S["Change feed<br/>or webhook"] --> H{"Content hash<br/>changed?"}
H -->|"no"| SK["Skip, cost nothing"]
H -->|"yes"| P["Re-parse, re-chunk,<br/>re-embed"]
P --> W["Write chunks at<br/>doc_version N plus 1"]
W --> D["Delete every chunk<br/>at version N"]
D --> C["Invalidate answer and<br/>retrieval caches for that doc"]
D --> M["Compact or rebuild once<br/>tombstones pile up"]
What a good answer covers
- Freshness is a pipeline-and-consistency problem, and stale answers are among the most corrosive RAG…
- Change detection: prefer event-driven ingestion - webhooks or change-data-capture from source systems…
- Where only polling is possible, use content hashes or modified-timestamps to skip unchanged documents
- Track per-document: source ID, version/hash, last-indexed time
- Incremental re-indexing: on document change, re-parse → re-chunk → re-embed → delete the old chunks,…
Key terms: Change detection · Incremental re-indexing · Index maintenance · Consistency across stores · Freshness SLO · caches
Interviewer follow-ups to expect
A document's chunk count changes between versions - walk through the failure and your fix. How do you verify deletions actually propagated everywhere?
Which data in a typical enterprise should bypass the index entirely and be fetched live?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep