Azure / Azure/azure-search-vector-samples
Azure Hybrid Search results are not consistent
- Dominant language
- Jupyter Notebook
- Stars
- 910
- Forks
- 377
- PR merge metrics
- No merged PRs in 30d
Description
Hi team,
I am running Azure Hybrid Search on my data which has 12 pdfs[423 chunks], that I am embedding in my vector store, and getting top 12 chunks for a query.
Code snippet:
vector_query = VectorizedQuery(
vector=query_embeddings, k_nearest_neighbors=60,
fields="contentVector")
results = await self.search_client.search(
search_text=query,
vector_queries=[vector_query],
top=12,
filter=filter_expression
)
but the problem I am facing is, the top 12 results are not consistent, and they are changing with different iterations. To solve this I used exhaustiveKNN as well, but it didn't help. Upon reading Azure blogs, I found that some stochasticity may come from BM25, so I set the parameter scoring_statistics='global' & also added session_id.
Code snippet:
vector_query = VectorizedQuery(
vector=query_embeddings, k_nearest_neighbors=60,
fields="contentVector", exhaustive=True)
results = await self.search_client.search(
search_text=query,
vector_queries=[vector_query],
top=12,
filter=filter_expression, scoring_statistics='global'
) #session_id = 'abcd1234xyz',
results = await self._format_metadata(results)
I request the team to please guide me how to get the same consistent output from Hybrid Search, given that I want to optimize based on Search Accuracy[how relevant chunks are] and time to embed and retrieve?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start from the shown VectorizedQuery and search_client.search calls; reproduce repeated top-12 hybrid queries with exhaustiveKNN, scoring_statistics='global', and the commented session_id. Compare ranking stability and embedding and retrieval times, then document a confirmed cause or minimal reproducible behavior for Azure AI Search.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100