EasyDeepLearn

How do metadata filters interact with vector search?

hard

Answer

  • Two implementation strategies: (1) Pre-filter: apply metadata filter first, then vector search on the filtered subset — memory-friendly if the subset is small but breaks HNSW's graph if it fragments too many nodes.
  • (2) Post-filter: retrieve top-k * expansion via vector search, then filter — simpler but may under-retrieve if filters are strict.
  • Modern vector DBs (Qdrant, Weaviate, Milvus) implement hybrid strategies (filterable HNSW, bitmap pre-filtering) that maintain recall.
Check yourself — multiple choice
  • Filters don't matter
  • Pre-filter vs post-filter trade-off; modern vector DBs use filterable HNSW / bitmap pre-filtering to preserve recall
  • Only in Elastic
  • Impossible to combine

Metadata filters: pre / post / filterable HNSW — recall depends on implementation.

#vector-db#retrieval

Practise LLMs & GenAI

214 interview questions in this topic.

Related questions