Reranking
Reranking can help improve the quality of AI Search results by reordering retrieved documents based on semantic relevance to the user’s query. It applies a secondary model after retrieval to "rerank" the top results before they are outputted.
By default, reranking is disabled for all AI Search instances. You can enable it during creation or later from the settings page.
When enabled, AI Search will:
- Retrieve a set of relevant results from your index, constrained by your 
max_num_of_resultsandscore_thresholdparameters. - Pass those results through a reranking model.
 - Return the reranked results, which the text generation model can use for answer generation.
 
Reranking helps improve accuracy, especially for large or noisy datasets where vector similarity alone may not produce the optimal ordering.
You can configure reranking in several ways:
When you make a /search or /ai-search request using the Workers Binding or REST API, you can:
- Enable or disable reranking per request
 - Specify the reranking model
 
For example:
const answer = await env.AI.autorag("my-autorag").aiSearch({  query: "How do I train a llama to deliver coffee?",  model: "@cf/meta/llama-3.3-70b-instruct-fp8-fast",  reranking: {    enabled: true,    model: "@cf/baai/bge-reranker-base"  }});When creating a new RAG in the dashboard:
- 
Go to AI Search in the Cloudflare dashboard.
Go to AI Search - 
Select Create > Get started.
 - 
In the Retrieval configuration step, open the Reranking dropdown.
 - 
Toggle Reranking on.
 - 
Select the reranking model.
 - 
Complete your setup.
 
To update reranking for an existing instance:
- 
Go to AI Search in the Cloudflare dashboard.
Go to AI Search - 
Select an existing AI Search instance.
 - 
Go to the Settings tab.
 - 
Under Reranking, toggle reranking on.
 - 
Select the reranking model.
 
Was this helpful?
- Resources
 - API
 - New to Cloudflare?
 - Directory
 - Sponsorships
 - Open Source
 
- Support
 - Help Center
 - System Status
 - Compliance
 - GDPR
 
- Company
 - cloudflare.com
 - Our team
 - Careers
 
- © 2025 Cloudflare, Inc.
 - Privacy Policy
 - Terms of Use
 - Report Security Issues
 - Trademark