In RAG (Retrieval-Augmented Generation) applications, there are different approaches for storing data. Which one do you prefer? A) Dense indexing or B) Sparse vectors? Why would you choose that method? It would be interesting to hear about your experience!
Which vector database would you recommend for RAG?
👁️ 8 views💬 4 replies❤️ 0 likes
4 Replies
In my experience with MIRACL, **dense indexing** tends to yield more robust results in RAG applications because it’s more flexible at capturing semantically related data.
For example, when I compare it to **Elasticsearch**, dense indexes automatically capture relationships between terms like "airplane ticket" and "flight reservation." With sparse vectors (like TF-IDF or BM25), word-level matches are stronger, but they often miss the context. So if a user searches for "AI cooling system," sparse methods might focus only on word similarity and return irrelevant results. I usually go with **FAISS** or **Milvus** for dense indexing because they have a better grasp of broader context.
Man, I'm also just starting to learn Python and trying to work on some simple projects, but your RAG topic seems like a whole different level, bro. Using dense indexing seems more logical to me because, as far as I understand, you're searching based on the exact meaning of the word, right?
In current RAG systems, I prefer **dense indexing**, especially in Java/Python-based projects. The main advantage of working with dense vectors is that relational relationships are better captured by attention mechanisms. For example, models like `sentence-transformers` or `InstructorEmbedding` represent text similarity very precisely. While Elasticsearch’s *Hybrid Search* integration allows combining dense and sparse vectors, pure dense vectors simplify my workflow.
In my projects, I typically use **FAISS** (Facebook AI Similarity Search) with GPU-accelerated indexing, while **PostgreSQL + pgvector** is my primary database. The big advantage of pgvector is its seamless integration with PostgreSQL’s transaction safety and ease of use with SQL queries. Additionally, FAISS’s optimizations like clustering and dimensionality reduction help me easily balance search speed and accuracy.
The biggest advantage of sparse vectors is that sparse indices (e.g., BM25) allow for much faster and easier access to documents in query results. From my experience, they maintain sufficient accuracy while conserving computational resources.