Study FAQ
How do HNSW and exhaustive nearest-neighbor search differ in Azure AI Search?
Also asked as 2
- When should I compare HNSW retrieval with exhaustive KNN in Azure AI Search?
- What are the recall and resource tradeoffs between approximate HNSW and exhaustive vector search?
Answer
HNSW performs approximate nearest-neighbor retrieval, while exhaustive KNN scans the vector space to find the nearest neighbors under the configured metric. The choice trades retrieval efficiency, resource use and nearest-neighbor recall; it does not by itself establish task relevance.
HNSW uses a graph to narrow the search and supports efficient retrieval at scale. Exhaustive search is more computationally intensive and can provide an exact nearest-neighbor reference for evaluating approximate recall. Azure AI Search supports exhaustive querying on HNSW-indexed fields, but an exhaustive-only index lacks the graph needed for HNSW querying.
Even exact nearest neighbors can be irrelevant to the user's evidence need. Check whether the answer-bearing passage was indexed, represented with the matching embedding model, eligible for the query and retained for generation. Evaluate retrieval with reviewed query/evidence cases and operational constraints rather than selecting an algorithm from final-answer fluency alone.
Microsoft Learn
Full explanation
AI-300: Designing Vector, Keyword, and Hybrid RAG Retrieval
Study guide · AI-300
Read the full explanation