Implement information extraction solutions 5.1 Build retrieval and grounding pipelines

A multitenant Azure AI Search index serves many small tenants.

Study guide skill: Configure semantic search, hybrid search, and vector search for grounding

Question B7-020

A multitenant Azure AI Search index serves many small tenants. Vector queries use k set to 5, a filter on tenantId, and vectorFilterMode set to postFilter. For small tenants, queries often return fewer than five matches, or none, even though matching documents exist. What should you change?

Select one answer.

  • A Keep postFilter and lower k to 1 so the filter has fewer candidates to remove
  • B Remove vectorFilterMode, because filters can't be combined with vector queries
  • C Set vectorFilterMode to strictPostFilter (preview) so the filter runs after the global top k is found
  • D Set vectorFilterMode to preFilter so the filter is applied during the HNSW traversal ✓ Correct answer

Answer: D

preFilter applies the filter during HNSW traversal on each shard and maximizes recall, at some CPU and latency cost for highly selective filters. postFilter can miss matches when filters are highly selective or k is small, and strictPostFilter (preview) has the highest risk of doing so. A filter on a filterable field can be combined with vector queries, and vectorFilterMode sets where it applies.

Deep dive

How it works

In Azure AI Search, a filter on a vector query restricts which documents count. vectorFilterMode decides when the filter runs relative to the HNSW nearest-neighbor search, which affects latency, recall and throughput. There are three modes:

  • preFilter: applies the filter during HNSW traversal on each shard. It maximizes recall, but for highly selective filters it can traverse more of the graph, increasing CPU and latency.
  • postFilter: runs traversal and filtering on each shard independently, intersects results, then aggregates each shard's top k into a global top k. It can create false negatives for highly selective filters or small k values.
  • strictPostFilter (preview): finds the unfiltered global top k first, then filters. It has the highest risk of false negatives.

A filter on tenantId is highly selective for a small tenant, and k is 5. With postFilter, the top candidates per shard are mostly other tenants' documents. Filtering removes them, leaving fewer than five or none. preFilter only walks matching documents, so it returns that tenant's real nearest neighbors.

The cost is some extra CPU and latency on the most selective filters, usually a fine trade for correct results.

The other options, and when you'd use them

  • Lower k to 1 with postFilter: Smaller k makes it worse. postFilter's false negatives grow with selective filters and small k values.
  • Filters can't be combined with vector queries: They can. Vector fields themselves aren't filterable, but filters on other fields narrow the documents considered for vector search.
  • strictPostFilter (preview): It filters after the unfiltered global top k, which has the highest false-negative risk.

Exam tip

Selective filters (per tenant) + small k on vector queries = preFilter. postFilter and especially strictPostFilter can return too few results.

References

Last reviewed:

Ready to test yourself? The quiz asks this and every other AI-103 question, with instant feedback. Practice this in a quiz →

All Information extraction questions · AI-103 study guide

Thanks for your feedback!