You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: localization/v2.4.x/site/en/userGuide/search-query-get/single-vector-search.md
+2-7Lines changed: 2 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1769,7 +1769,7 @@ res = <span class="hljs-keyword">await</span> client.<span class="hljs-title fun
1769
1769
</svg>
1770
1770
</button></h2><p>In Milvus, grouping search is designed to improve comprehensiveness and accuracy for search results.</p>
1771
1771
<p>Consider a scenario in RAG, where loads of documents are split into various passages, and each passage is represented by one vector embedding. Users want to find the most relevant passages to prompt the LLMs accurately. The ordinary Milvus search function can meet this requirement, but it may result in highly skewed and biased results: most of the passages come from only a few documents, and the comprehensiveness of the search results is very poor. This can seriously impair the accuracy or even correctness of the results given by the LLM and influence the LLM users’ experience negatively.</p>
1772
-
<p>Grouping search can effectively solve this problem. By passing a group_by_field and group_size, Milvus users can bucket the search results into several groups and ensure that the number of entities from each group does not exceed a specific group_size. This feature can significantly enhance the comprehensiveness and fairness of search results, noticeably improving the quality of LLM output.</p>
1772
+
<p>Grouping search can effectively solve this problem. By passing a <codetranslate="no">group_by_field</code>, Milvus users can bucket the search results into several groups. This feature can significantly enhance the comprehensiveness and fairness of search results, noticeably improving the quality of LLM output.</p>
1773
1773
<p>Here is the example code to group search results by field:</p>
1774
1774
<pre><codetranslate="no"class="language-python"><spanclass="hljs-comment"># Connect to Milvus</span>
1775
1775
client = MilvusClient(uri=<spanclass="hljs-string">'http://localhost:19530'</span>) <spanclass="hljs-comment"># Milvus server address</span>
<p>In the given output, it can be observed that “doc_11” completely dominated the search results, overshadowing the high-quality paragraphs from other documents, which can be a poor prompt to LLM.</p>
1841
-
<p>One more point to note: by default, grouping_search will return results instantly when it has enough groups, which may lead to the number of results in each group not being sufficient to meet the group_size. If you care about the number of results for each group, set group_strict_size=True as shown in the code above. This will make Milvus strive to obtain enough results for each group, at a slight cost to performance.</p>
1842
1837
<p><strong>Limitations</strong></p>
1843
1838
<ul>
1844
-
<li><p><strong>Indexing</strong>: This grouping feature works only for collections that are indexed with the <strong>HNSW</strong>, <strong>IVF_FLAT</strong>, or <strong>FLAT</strong> type. For more information, refer to <ahref="https://milvus.io/docs/index.md#HNSW">In-memory Index</a>.</p></li>
1839
+
<li><p><strong>Indexing</strong>: This grouping feature works only for collections that are indexed with these index types: <strong>FLAT</strong>, <strong>IVF_FLAT</strong>, <strong>IVF_SQ8</strong>, <strong>HNSW</strong>, <strong>DISKANN</strong>, <strong>SPARSE_INVERTED_INDEX</strong>.</p></li>
1845
1840
<li><p><strong>Vector</strong>: Currently, grouping search does not support a vector field of the <strong>BINARY_VECTOR</strong> type. For more information on data types, refer to <ahref="https://milvus.io/docs/schema.md#Supported-data-types">Supported data types</a>.</p></li>
1846
1841
<li><p><strong>Field</strong>: Currently, grouping search allows only for a single column. You cannot specify multiple field names in the <codetranslate="no">group_by_field</code> config. Additionally, grouping search is incompatible with data types of JSON, FLOAT, DOUBLE, ARRAY, or vector fields.</p></li>
1847
1842
<li><p><strong>Performance Impact</strong>: Be mindful that performance degrades with increasing query vector counts. Using a cluster with 2 CPU cores and 8 GB of memory as an example, the execution time for grouping search increases proportionally with the number of input query vectors.</p></li>
Copy file name to clipboardExpand all lines: localization/v2.5.x/site/en/userGuide/search-query-get/grouping-search.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -371,6 +371,7 @@ res = <span class="hljs-keyword">await</span> client.<span class="hljs-title fun
371
371
></path>
372
372
</svg>
373
373
</button></h2><ul>
374
+
<li><p><strong>Indexing</strong>: This grouping feature works only for collections that are indexed with these index types: <strong>FLAT</strong>, <strong>IVF_FLAT</strong>, <strong>IVF_SQ8</strong>, <strong>HNSW</strong>, <strong>HNSW_PQ</strong>, <strong>HNSW_PRQ</strong>, <strong>HNSW_SQ</strong>, <strong>DISKANN</strong>, <strong>SPARSE_INVERTED_INDEX</strong>.</p></li>
374
375
<li><p><strong>Number of groups</strong>: The <codetranslate="no">limit</code> parameter controls the number of groups from which search results are returned, rather than the specific number of entities within each group. Setting an appropriate <codetranslate="no">limit</code> helps control search diversity and query performance. Reducing <codetranslate="no">limit</code> can reduce computation costs if data is densely distributed or performance is a concern.</p></li>
375
376
<li><p><strong>Entities per group</strong>: The <codetranslate="no">group_size</code> parameter controls the number of entities returned per group. Adjusting <codetranslate="no">group_size</code> based on your use case can increase the richness of search results. However, if data is unevenly distributed, some groups may return fewer entities than specified by <codetranslate="no">group_size</code>, particularly in limited data scenarios.</p></li>
376
377
<li><p><strong>Strict group size</strong>: When <codetranslate="no">strict_group_size=True</code>, the system will attempt to return the specified number of entities (<codetranslate="no">group_size</code>) for each group, unless there isn’t enough data in that group. This setting ensures consistent entity counts per group but may lead to performance degradation with uneven data distribution or limited resources. If strict entity counts aren’t required, setting <codetranslate="no">strict_group_size=False</code> can improve query speed.</p></li>
0 commit comments