is an option for functions such as SemanticSearch to determine how results are sorted after initial retrieval.


RerankingMethod
is an option for functions such as SemanticSearch to determine how results are sorted after initial retrieval.
Details


- RerankingMethod is used to specify how to improve the sorting of semantically similar elements.
- Accepted values for RerankingMethod include:
-
Automatic default reranking None no reranking Tiny, Small, Medium, Large predefined model sizes f a custom reranking function "string" a generic SemanticRanking model {"string",size} a specific-sized SemanticRanking model <|opt1val1,…|> detailed options specifying reranking parameters - A custom reranker f must operate on the reference string and a list of strings to produce a vector of the same length.
- Specific reranking models include:
-
"MiniLM" default (Medium) "MiniLM" ranker {"MiniLM",Tiny} MiniLM-V2 L-2 {"MiniLM",Small} MiniLM-V2 L-4 {"MiniLM",Medium} MiniLM-V2 L-6 {"MiniLM",Large} MiniLM-V2 L-12 - Parameters for RerankingMethod include:
-
"Function" SemanticRanking function ranking the candidate items "MaxItemMultiplier" 2 multiple of MaxItems provided as candidates "MinItems" 10 minimum number of candidate items "Query" Automatic query string used for ranking "Target" "Item" which property prop the function operates on - When reranking with "MinItems"min, "MaxItemMultiplier"k and MaxItemsmax, the initial number of candidate items is Max[min,k*max].
Examples
open all close allBasic Examples (1)
Search with Automatic reranking:
Disabling reranking can make the results faster but may degrade results:
Use a smaller SemanticRanking model for some improvement in results:
Specify a custom reranking method as a function of the items:
Specify the reranker as a function of the items and the query:
Scope (4)
Reranking defaults to a minimum of 10 candidate items retrieved from the database, then returns the requested number of MaxItems:
Disabling reranking will give the first result from the initial search:
Reduce the minimum number of candidate items provided to the reranker:
The number of candidates is calculated by taking the larger of "MinItems" and the product of the "MaxItemMultiplier" method option and the specified number of MaxItems:
Create an index with tags corresponding to the frequency of words in the text:
Default sorting gives close matches, but the first match may be obscure or only mentioned a few times in the text:
Rerank based on the most prevalent words:
Use a custom question when reranking to further refine the results:
Specify the size of the model to be used:
Using a larger SemanticRanking model can give better results at the cost of a longer evaluation time:
See Also
History
Text
Wolfram Research (2025), RerankingMethod, Wolfram Language function, https://reference.wolfram.com/language/ref/RerankingMethod.html.
CMS
Wolfram Language. 2025. "RerankingMethod." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RerankingMethod.html.
APA
Wolfram Language. (2025). RerankingMethod. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RerankingMethod.html
BibTeX
@misc{reference.wolfram_2025_rerankingmethod, author="Wolfram Research", title="{RerankingMethod}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/RerankingMethod.html}", note=[Accessed: 04-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_rerankingmethod, organization={Wolfram Research}, title={RerankingMethod}, year={2025}, url={https://reference.wolfram.com/language/ref/RerankingMethod.html}, note=[Accessed: 04-August-2025]}