Skip to main content
InterviewHubPRO
Section Overview
Q15

Question 15 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

30%
Vector DBs & RAG (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What are the differences between Pre-Filtering, Post-Filtering, and Single-Stage Filtered Search?

senior LevelSystem Design

In Simple Words: When searching vectors with scalar metadata filters:

  1. Post-Filtering: Runs vector ANN search first to find top 100 matches, then discards items that don't match metadata. Problem: If the filter is selective (e.g. only 0.1% of items match), post-filtering may return 0 results!
  2. Pre-Filtering: Filters items by metadata first, then brute-force searches the remaining vectors. Problem: Cannot leverage the pre-computed HNSW graph index.
  3. Single-Stage Filtered Search (Modern Standard): Traverses the HNSW graph while dynamically ignoring nodes that fail the metadata predicate during graph exploration.