<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: rahul shrivastava</title>
    <description>The latest articles on DEV Community by rahul shrivastava (@rahul_shrivastava_1d3d4ac).</description>
    <link>https://dev.to/rahul_shrivastava_1d3d4ac</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2104599%2F8d835799-20dc-48e2-ac82-967aa8cf8421.png</url>
      <title>DEV Community: rahul shrivastava</title>
      <link>https://dev.to/rahul_shrivastava_1d3d4ac</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rahul_shrivastava_1d3d4ac"/>
    <language>en</language>
    <item>
      <title>Your RAG Is Only as Good as the Evidence Your Vector Index Retrieves</title>
      <dc:creator>rahul shrivastava</dc:creator>
      <pubDate>Tue, 01 Sep 2026 17:38:40 +0000</pubDate>
      <link>https://dev.to/rahul_shrivastava_1d3d4ac/your-rag-is-only-as-good-as-the-evidence-your-vector-index-retrieves-nek</link>
      <guid>https://dev.to/rahul_shrivastava_1d3d4ac/your-rag-is-only-as-good-as-the-evidence-your-vector-index-retrieves-nek</guid>
      <description>&lt;p&gt;Your RAG assistant may hallucinate—not because the LLM is weak, but because the vector index failed to retrieve the right evidence. 🔎&lt;/p&gt;

&lt;p&gt;I saw this with a team whose RAG demo looked excellent at 50,000 chunks.&lt;/p&gt;

&lt;p&gt;Queries were quick. Citations looked credible. Everyone was ready to scale.&lt;/p&gt;

&lt;p&gt;Then the corpus reached millions of chunks.&lt;/p&gt;

&lt;p&gt;p95 latency climbed. Retrieval became inconsistent. Important long-tail documents disappeared from the top results.&lt;/p&gt;

&lt;p&gt;The first question was: “Should we switch the LLM?”&lt;/p&gt;

&lt;p&gt;The real issue was lower in the stack: the vector index.&lt;/p&gt;

&lt;p&gt;In RAG, an index is not merely a database setting. It decides how much of the corpus you can search within a latency and cost budget—and therefore affects grounded-answer quality.&lt;/p&gt;

&lt;p&gt;Here is the trade-off:&lt;/p&gt;

&lt;p&gt;Flat / brute force: compares against every vector. It gives exact nearest neighbours and is the right baseline for evaluation. But query cost grows linearly with the corpus.&lt;/p&gt;

&lt;p&gt;IVF: groups vectors into clusters and searches selected clusters. It can be efficient and more memory-friendly, but may miss a relevant chunk outside the probed clusters. Raise nprobe for better recall at the cost of latency.&lt;/p&gt;

&lt;p&gt;HNSW: connects similar vectors as a navigable graph. It commonly provides strong recall at low query latency, making it compelling for interactive RAG. The price: more RAM, longer builds, and extra operational tuning. Raise ef_search for better recall, again at a latency cost.&lt;/p&gt;

&lt;p&gt;IVF + PQ/SQ8: compresses vectors to reduce memory and infrastructure cost. Useful at very large scale—but compression may hurt recall, especially for rare or highly specific queries.&lt;/p&gt;

&lt;p&gt;For this team, a missed policy exception could create a confident but wrong answer.&lt;/p&gt;

&lt;p&gt;So the decision was not “Which index is fastest?”&lt;/p&gt;

&lt;p&gt;It was: “Which retrieval quality can this product afford to lose?”&lt;/p&gt;

&lt;p&gt;The eventual pipeline was:&lt;/p&gt;

&lt;p&gt;Hybrid retrieval → metadata/ACL filtering → ANN candidates → reranking → grounded answer with citations&lt;/p&gt;

&lt;p&gt;The index determines candidate recall.&lt;br&gt;
The reranker determines candidate order.&lt;br&gt;
The LLM determines how well it uses evidence.&lt;/p&gt;

&lt;p&gt;My rule of thumb:&lt;/p&gt;

&lt;p&gt;Flat for truth and offline evaluation.&lt;br&gt;
HNSW for high-quality, low-latency RAG when RAM is available.&lt;br&gt;
IVF when build speed, memory, or cost constraints dominate.&lt;br&gt;
Quantized IVF when full-precision vectors become impractical.&lt;/p&gt;

&lt;p&gt;Do not select an index from a benchmark chart alone.&lt;/p&gt;

&lt;p&gt;Measure Recall@K, p95/p99 latency, grounded-answer rate, citation correctness, real metadata-filter behaviour, ingestion lag, and cost per query.&lt;/p&gt;

&lt;p&gt;The best RAG index is not the one that returns vectors fastest.&lt;/p&gt;

&lt;p&gt;It is the one that retrieves the right evidence reliably enough to meet your product’s quality, latency, and cost promise.&lt;/p&gt;

&lt;p&gt;What index are you using in production—and which metric drove that choice?&lt;/p&gt;

&lt;h1&gt;
  
  
  RAG #GenerativeAI #VectorSearch #AIEngineering
&lt;/h1&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>software</category>
    </item>
  </channel>
</rss>
