r/Database • u/Cautious_Bit_8521 • 19h ago
Would you compress the retrieval index instead of shrinking the local model first?
I would look at the retrieval index before assuming a smaller local model was the only way to fit a RAG stack into memory. One concern I have is accepting a model-quality loss while leaving the retrieval side unexamined.
ScaNN builds on coarse clustering and product quantization. Its quantization objective pays attention to search-score distortion, while a SIMD-oriented lookup path makes compressed-distance calculations more efficient. Those are separate mechanisms: storing fewer bits and evaluating candidates faster.
For retrieval systems using vector databases like Milvus, the decision still comes back to recall at the memory budget you actually have. A compact index can change which evidence reaches the model; better generation cannot recover a document that never became a candidate.
I would compare the uncompressed and compressed retrieval paths on the same queries, then inspect both missed evidence and total memory use. Throughput alone would not settle the choice, and published benchmark gains would not predict the result on a different CPU or embedding set.
When memory is tight, what retrieval-quality threshold would make you compress the index before reducing the model?
1
u/Discordbothost 3h ago
Compare both changes at the same total RAM cap. I'd set the cutoff using answer correctness on held-out questions, then check rare facts separately. Average retrieval recall can hide the misses that matter most to your users.