How do I effectively manage document versioning when using Chroma DB for high-volume RAG systems?
3 answers
Managing updates in Chroma DB requires a strategic approach to metadata. Instead of clearing the collection, you should implement an "upsert" logic by using unique IDs for every document chunk. When a document is modified, you generate new embeddings only for the affected IDs. In a production environment I managed last year, we added a 'timestamp' or 'version_hash' to the metadata. This allowed our retrieval logic to filter for the most recent version of a vector during the query phase, ensuring that the LLM always received the most up-to-date context without the need for a full re-index.
Margaret, have you noticed if the storage size of Chroma DB grows significantly when keeping multiple versions of the same vector in the same collection?
I highly recommend using the delete method with specific where filters based on document IDs before inserting new data to keep the index clean.
I agree with Brian; using clear IDs is essential in Chroma DB. I found that using a SHA-256 hash of the content as the ID makes deduplication almost automatic.
Jason, it definitely does! To keep the Chroma DB instance lean, we run a cleanup script every weekend that deletes any vector with a version_hash older than the current active one. This maintains performance and keeps our memory usage within the limits of our cloud instance.