Reranking
Initial search results often fail to capture nuanced relevance or diversity, potentially leading to suboptimal user experiences. Utilizing Vectara's reranking can significantly enhance the quality and usefulness of search results, leading to more effective information retrieval.
Reranking search results involves a process of rescoring and refining an initial set of query results to achieve a more precise ranking. It employs a machine learning model that while slower than the rapid retrieval step, offers more accurate results.
Available rerankers
Vectara currently provides the following rerankers:
- Multilingual Reranker v1 (
type=customer_rerankerandreranker_name=Rerank_Multilingual_v1) also known as Slingshot, provides more accurate neural ranking than the initial Boomerang retrieval. While computationally more expensive, it offers improved text scoring across a wide range of languages, making it suitable for diverse content. - Maximal Marginal Relevance (MMR) Reranker (
type=mmr) for diversifying results while maintaining relevance. - User Defined Function Reranker (
type=userfn) for custom scoring based on metadata.
Chain reranking
The Vectara Chain Reranker (type=chain) lets you combine multiple reranking
strategies in sequence to meet more complex search requirements. This lets you
completely customize the functionality of Vectara to your needs by giving you
absolute control over the ranking functions. For details, see Chain Reranker.
Knee reranking
Designed to work after the Slingshot reranker in a chain
(type=userfn and user_function=knee()), knee reranking
dynamically filters results by detecting natural cutoff points, improving
precision while maintaining recall.
Enable reranking
To enable reranking, specify the appropriate value for the type in the
reranker object. For the MMR reranker, use mmr. In most scenarios,
it makes sense to use the default query start value of 0 so that you're
reranking all of the best initial results. You can also set the limit of the
query to the total number of documents you wish to rerank. The default value
is 25.
The following example shows the limit and type values in a query. Note that
this simplified example intentionally omits several parameter values.
CODE EXAMPLE
Code example with json syntax.1
Refining the result set
Two parameters on every reranker control what comes out:
cutoff— minimum score for a result to be kept. Most useful with neural rerankers, whose scores are normalized to roughly0.0–1.0. The recommended starting value for the multilingual reranker is0.5.limit— maximum number of results returned by that stage. In a chain, each stage'slimitcaps the input to the next stage.
For full details on how these interact, including chained-reranker behavior and using cutoffs to improve LLM summarization, see Limits and cutoffs.
You can also enable reranking in the Vectara console under a corpus's Query tab → Retrieval. Useful for exploring the API interactively.