Overview
This recipe runsBAAI/bge-reranker-v2-m3 with
Hugging Face Text Embeddings Inference on a Salad GPU. It
accepts a query and candidate passages, scores each query-passage pair, and returns the candidates in descending order
of relevance.
A reranker complements embedding and vector search. Vector search efficiently retrieves a broad candidate set, while a
reranker evaluates each candidate together with the original query to improve the final ordering. In a RAG pipeline,
this helps select the most relevant passages before sending context to an LLM.
BAAI/bge-reranker-v2-m3 is a multilingual reranker based on XLM-RoBERTa. It supports inputs up to 8192 tokens and is a
good fit for multilingual search, document retrieval, and RAG result refinement.
Quick Start
- Open the SaladCloud Portal.
- Deploy the BGE Reranker API recipe.
- Enter a Container Group Name.
- Decide whether to enable Require Container Gateway Authentication:
- Enabled: requests must include your SaladCloud API key.
- Disabled: anyone with the URL can call the reranking service.
- Deploy and wait for the model to download and the replica to become ready.
The model is downloaded from Hugging Face at startup, so it can take several minutes before the deployment becomes
ready.
Defaults
The recipe comes preconfigured with these defaults:- Server: Hugging Face Text Embeddings Inference
- Model ID:
BAAI/bge-reranker-v2-m3 - Container image:
ghcr.io/huggingface/text-embeddings-inference:89-1.9 - Command equivalent:
text-embeddings-router --model-id BAAI/bge-reranker-v2-m3 --port 3000 - Container port:
3000 - Host bind:
:: - Data type:
float16 - Max batch tokens:
16384 - Max client batch size:
32 - Readiness probe:
GET /health - Authentication: enabled by default
API Endpoints
Useful TEI endpoints include:GET /health- readiness probe and health checkGET /info- model and server metadataGET /docs- Swagger documentationPOST /rerank- score and rank one query against candidate textsPOST /predict- score query-text pairs using TEI’s prediction interface
Authentication
Require Container Gateway Authentication is available in the deployment form and is enabled by default.- Enabled: every request must include the
Salad-Api-Keyheader. - Disabled: anyone with the deployment URL can call the API.
Example Request
Send one query and multiple candidate passages to/rerank:
Salad-Api-Key header.
The response is sorted by descending relevance. Scores depend on the input and model version, but the response shape is:
index refers to the candidate’s position in the original texts array. Set return_text to false if your
application already tracks documents by index and does not need passage text repeated in the response. Set raw_scores
to true only if you need raw model logits instead of normalized relevance scores.
Test A Deployment
Check health:index equal to 0. Add the Salad-Api-Key header if gateway authentication is enabled.
Tuning Notes
- Keep
MODEL_IDset toBAAI/bge-reranker-v2-m3unless you intentionally want to repurpose the recipe. - The default
MAX_CLIENT_BATCH_SIZEallows up to 32 candidate texts in one/rerankrequest. Increase it only after testing memory usage and latency with your expected passage lengths. - Long passages and large candidate lists consume more VRAM. Lower
MAX_BATCH_TOKENSif replicas run out of memory. - For larger retrieval sets, retrieve broadly with vector search and rerank a smaller top-k candidate set rather than sending the full corpus to the reranker.