Reading query and paragraph together
A bi-encoder decides what a paragraph's vector says before it has seen any question. A cross-encoder reads the question and one paragraph as a single input and returns one relevance score, so every question word can attend to every paragraph word in every layer. It is the most accurate kind of neural ranker and the most expensive, because nothing can be computed ahead of time: each new paragraph needs a new forward pass with the question again.
The usual answer is a two-stage pipeline. A cheap first stage, here the Embeddings tab's bge-small-en-v1.5, retrieves a short list from the whole corpus; the cross-encoder then reranks only that list. This tab's cross-encoder is bge-reranker-base, an XLM-RoBERTa encoder of 12 blocks with 278 M parameters, reranking bge-small's top 5, 10, 20 or 50 paragraphs for each of the 300 SQuAD questions.
One input, one logit
The Query and paragraph, read together panel shows the input: the start token, the question, two separator tokens, the paragraph and a final separator, 512 tokens at most. A classification head on the start token's last hidden state gives one number,
and is the same ranking on a 0 to 1 scale. The attention view under it picks a block and a reader, the start token or any question token, and shades the paragraph by that token's attention, with the shares that go to the question, the paragraph and the special tokens. Separators often draw much of it.
The cost per pair is a full forward pass over about tokens, with attention quadratic in that length. Here a pair averages 200 tokens, so reranking 10 candidates reads about 2,010 tokens per question and 50 candidates about 9,997, against bge-small's 23 query tokens, 8 of them its instruction; it took 43.5 ms per pair on the recording Mac's CPU. Reranking cannot change Recall@k: it only reorders what the first stage found.
Reranking the first stage
The Rerank bge-small's top k panel draws the same paragraphs in two orders, a line from each first-stage rank to its new rank, with the relevant paragraph green. If the first stage ranks the relevant paragraph outside the top , reranking cannot bring it back; within it, the cross-encoder may move it either way.
The Quality against cost bars give nDCG@10 for every depth. On these questions reranking hurts: bge-small alone scores 0.810, and reranking its top 5, 10, 20 and 50 gives 0.757, 0.723, 0.689 and 0.651. The deeper the list, the more paragraphs the reranker can wrongly prefer. Recall@1 falls from 0.673 to 0.467 at 50.
What the misses are
With all 50 reranked, the reranker's first choice is wrong for 160 questions, against bge-small's 98, and only 13 of those 160 paragraphs contain an answer at all: they are misses, not other right answers. The page tests one natural explanation, that a long paragraph dilutes its score, and rules it out: given only the sentence that holds the answer, the mean logit is 1.20, against 1.23 for the whole paragraph and 4.04 for the reranker's mistaken first choices.
So on SQuAD this base-size reranker is simply weaker than the small bi-encoder it reranks. Published results point the other way on average: the BEIR benchmark found re-ranking and late-interaction models the best zero-shot retrievers across its 18 datasets, at a high computational cost. An average over datasets says little about one dataset, and a reranker has to be measured on the data it will serve before it earns its cost.
Where it came from
Nogueira and Cho (2019) fine-tuned BERT as a cross-encoder to rerank BM25's candidates on MS MARCO and took the top of its passage-ranking leaderboard; their multi-stage follow-up added a second, pairwise reranker on top. Sentence-BERT set the trade-off this tab measures: cross-encoders for accuracy on a few pairs, bi-encoders for search over many. bge-reranker-base comes from the same FlagEmbedding project as bge-small, built on the multilingual XLM-RoBERTa. The ColBERT tab shows a model between the two kinds, and the RAG tab uses this reranker to choose the paragraphs a language model reads.
Papers
- Passage Re-ranking with BERT Introduces reranking a first stage's candidates with BERT reading query and passage together.
- Multi-Stage Document Ranking with BERT Retrieval followed by pointwise and pairwise BERT rerankers, each stage trading cost for quality.
- C-Pack: Packed Resources For General Chinese Embeddings The BGE models: bge-small-en-v1.5, the first stage here, and the reranker's model card cites it.
- Unsupervised Cross-lingual Representation Learning at Scale XLM-RoBERTa, the encoder bge-reranker-base is built on.
- Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks Why pairwise BERT is too slow for search and how a bi-encoder avoids it.
- BEIR: A Heterogenous Benchmark for Zero-shot Evaluation of Information Retrieval Models Rerankers across 18 datasets: best on average, at a high cost, which is not the same as best on every dataset.