Rerank pairs with a Sentence Transformers CrossEncoder
Answer: Cross Encoder models, also called reranker models, calculate a similarity score given pairs of inputs. They generally provide superior performance compared to a Sentence Transformer bi-encoder model, and they are often slower.
Characteristics
A Cross Encoder requires computation for each pair rather than each text. Due to those characteristics, Cross Encoders are often used to re-rank also the top-k results from a Sentence Transformer model. Pairs are typically text pairs, but also image-text or other modalities.
predict and rank
Load a pre-trained CrossEncoder model such as cross-encoder/ms-marco-MiniLM-L6-v2. Predict scores for a pair of sentences with predict. Rank a list of passages for a query with rank. rank returns a score and a corpus_id.
MS Marco models return logits rather than scores between 0 and 1. Load the CrossEncoder with activation_fn set to a sigmoid to get scores between 0 and 1. This does not affect the ranking.
Some Cross Encoder models support multimodal pairs, such still as a text query and an image document. Use modalities and supports() to check modality support.
| predict | rank | |---|---| | CrossEncoder | Load a pre-trained reranker model | | predict | Predict scores for sentence pairs | | rank | Rank passages for a query | | corpus_id | A score and a corpus_id | | activation_fn | Optional sigmoid for MS Marco logits |
See also
Claims
- id: C1 claim: A Cross Encoder calculates a similarity score for pairs of inputs and is often used to rerank bi-encoder results. source: S1 evidence: "Calculates a similarity score given pairs of inputs"
- id: C2 claim: Cross Encoders are often slower than bi-encoders because they compute a score for each pair. source: S1 evidence: "requires computation for each pair rather than each text"
- id: C3 claim: MS Marco Cross Encoder models return logits, and a sigmoid activation can map those scores between 0 and 1 without changing rank order. source: S2 evidence: "MS Marco models return logits rather than scores"
Sources
- [S1] Quickstart. Sentence Transformers. https://www.sbert.net/docs/quickstart.html . License: Apache-2.0. Accessed 2026-11-19.
- [S2] Cross Encoder usage. huggingface/sentence-transformers (GitHub). https://github.com/huggingface/sentence-transformers/blob/main/docs/cross_encoder/usage/usage.rst . License: Apache-2.0. Accessed 2026-11-19.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Sentence Transformers, Quickstart; huggingface/sentence-transformers (GitHub), Cross Encoder usage. Apache-2.0; Apache-2.0. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Sentence Transformers, Quickstart; huggingface/sentence-transformers (GitHub), Cross Encoder usage. Apache-2.0; Apache-2.0.
Cite this
iinventedlight. 2026. "Rerank pairs with a Sentence Transformers CrossEncoder." iinventedlight Library, iil:note:mfjxdqjw, version of 2026-11-19. https://iinventedlight.com/library/notes/sentence-transformers-cross-encoder/. License: CC-BY-4.0.
@misc{iil_note_mfjxdqjw,
author = {{iinventedlight}},
title = {{Rerank pairs with a Sentence Transformers CrossEncoder}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-19},
url = {https://iinventedlight.com/library/notes/sentence-transformers-cross-encoder/},
note = {Permanent ID iil:note:mfjxdqjw. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- sentence-transformers-cross-encoder.table.json (table; CC-BY-4.0)
- sentence-transformers-cross-encoder.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/sentence-transformers-cross-encoder.md.