(Note · · 5 min read)

The chatbot is quoting last year's prices

A retrieval system holds a copy of your content, converted into vectors. The day someone edits the source, that copy is wrong, and nothing in the system notices. The assistant keeps answering confidently from material that has been superseded.

By Md. Habibur Rahman Shohel, full-stack & AI product engineer in Dhaka

The index is a cache with no expiry

It is worth naming it that way, because the familiar cache questions then apply: what invalidates it, how stale can it get, and how would anybody know. A one-off ingestion script with no invalidation path is a cache that never expires.

The failures are quiet. A price changes, a policy is withdrawn, a product is discontinued, and the assistant continues to describe the old state — with the authority of a system that cites its sources.

Re-embed on change, not on a schedule

A nightly full rebuild is simple and wasteful, and leaves a day of staleness. Better: when a document changes, re-chunk and re-embed that document, and replace its chunks.

Store a hash of each chunk's text. If the hash is unchanged, skip the embedding call — for a large corpus where a single article was edited, that turns a full rebuild into a handful of requests, and embedding calls are the cost.

Deletion is the step that gets missed

Adding and updating are obvious. Removing is not, and a deleted article whose chunks remain in the index will keep being retrieved and quoted — the worst version of this problem, because the content was deliberately withdrawn.

Key chunks by their source document so every chunk of a document can be removed together. Then reconcile periodically: list the documents in the source, list the documents represented in the index, and act on the difference in both directions.

Close the loop with the people who see failures

The fastest way to improve a retrieval system is for someone to read bad answers and correct the source. That requires a path from a wrong answer to the document responsible, and a re-embed that follows the correction.

On a support assistant I built, that is the loop: answers are reviewed in an admin panel, the source is corrected, and the content is re-embedded so the correction takes effect. Without the final step, a reviewer corrects the document and the assistant keeps answering from the old vector — which teaches the reviewer that correcting it does not work.

Changing the embedding model invalidates everything

Vectors from different models are not comparable. Switching models, or a provider changing one, means the whole index has to be rebuilt — a mixed index does not degrade gracefully, it retrieves nonsense.

Record the model and its version against every stored vector, so that incompatibility is detectable rather than mysterious. Build the new index alongside the old and switch over, rather than rebuilding in place and serving partial results meanwhile.

Make currency visible

Track the oldest indexed-at timestamp, the count of documents in the source against the count in the index, and the number of failed ingestions. Those three make staleness a number somebody can look at.

Alert on an ingestion pipeline that has not run, not only on one that errored. A pipeline that stopped quietly looks exactly like a pipeline with nothing to do.

Common questions

Why does my chatbot quote outdated information?

Because the retrieval index holds an embedded copy of your content, and editing the source does not change the copy. Treat the index as a cache and give it an explicit invalidation path — a one-off ingestion script is a cache that never expires.

Should I rebuild the whole index on a schedule?

Re-embed on change instead: re-chunk the changed document and replace its chunks. Store a hash per chunk and skip unchanged ones, which turns a full rebuild into a few requests when one article was edited — and embedding calls are the cost.

What is the most commonly missed sync step?

Deletion. A withdrawn document whose chunks remain is still retrieved and quoted. Key chunks by source document so they can be removed together, and reconcile the source's document list against the index's in both directions.

What happens if I change embedding model?

The whole index must be rebuilt — vectors from different models are not comparable, and a mixed index retrieves nonsense rather than degrading gracefully. Record the model and version against every vector, and build the replacement alongside before switching.

Need something like this built?