{
  "id": 23154610,
  "title": "Day 37/90 — Your RAG System Is Only as Good as Its Vector Search",
  "url": "https://urgent.news/2026/12/02/day-37-90-your-rag-system-is-only-as-good-as-its-vector-search",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-02T18:23:59.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/rimsha_kanwal/day-3790-your-rag-system-is-only-as-good-as-its-vector-search-291b"
  },
  "original_language": null,
  "account": "Day 37/90 — HNSW Configuration Determines RAG Retrieval Performance\n\nExact nearest-neighbor search compares a query vector against every stored vector, providing true nearest neighbors but becoming slow with large data sets. Approximate Nearest Neighbor (ANN) search, like HNSW, offers faster retrieval at the cost of some recall. HNSW, a graph-based approach, builds a multi-layer index for efficient candidate exploration.\n\nHNSW has three key parameters:\n\n1. m: Graph connectivity, affecting memory use and build time, potentially improving recall.\n2. ef_construction: Candidate exploration during index building, longer build times for higher-quality graph.\n3. ef_search: Candidate exploration during queries, offering higher recall but increased latency.\n\nStart with pgvector's default settings: m=16, ef_construction=64, ef_search=40. Then, measure retrieval quality and latency on your data. Common tuning progression:\n\n- Start with ef_search=40 for a fast baseline\n- Increase to ef_search=80 for better recall and moderate latency\n- Try ef_search=100 as a strong production starting point\n- Higher ef_search values may improve recall but increase latency and cost\n\nEvaluation involves comparing approximate search with exact search using the same queries, embeddings, and settings. Metrics include ANN Recall@10 (exact top-10 retrieval), Relevant Recall@10 (human-labeled relevant documents), P50 and P95 latency, and query throughput. Remember, higher recall does not guarantee relevance, so always evaluate answer quality using RAG metrics.\n\nIn production, begin by creating a representative evaluation set from real user queries, labeling relevant documents or chunks. Measure exact search ground truth, then ANN Recall@10 and relevance Recall@10. Tuning ef_search first (no index rebuild needed) followed by adjusting m or ef_construction if needed. Set recall and latency targets, such as maintaining 95% ANN Recall@10 with P95 latency below 50 ms.\n\nAvoid common pitfalls like optimizing only average latency, treating recall as relevance proof, changing m/ef_construction before testing ef_search, or neglecting metadata filters. A strong RAG system depends on both powerful embeddings and a well-tuned vector search pipeline.",
  "summary": "Why tuning HNSW can improve retrieval without changing your embedding model or LLM. Many AI engineers improve RAG systems by switching embedding models, adding rerankers, or upgrading LLMs. But sometimes the real bottleneck is inside the vector index. Even when the correct document exists in your vector database, approximate nearest-neighbor search can fail to return it. Today, let’s look at how…",
  "summary_source": "publisher",
  "key_points": [
    "HNSW is a graph-based approximate nearest neighbor search method",
    "Three key HNSW parameters: m, efconstruction, efsearch",
    "Tuning starts with pgvector defaults (m=16, efconstruction=64, efsearch=40)"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "outlets_capped": false,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}