How BERT-based Cross-Encoders Model Relevance in Information Retrieval?
Mathias Vast, Basile Van Cooten, Laure Soulier, Benjamin Piwowarski
cs.IR
2026-10-30
BERT cross-encoders match exact tokens early and semantics late; [CLS] gets relevance only at the end. 33M MiniLM uses non-relevance and holds up better OOD than 340M MonoBERT.
A cross-encoder concatenates the query and the document, runs one BERT over the pair, and reads relevance from the [CLS] vector at the front of the sequence. Search and RAG reranking depend on that score. Every pair needs its own forward pass, which is why these models are both accurate and expensive.
A BM25 score can be traced to term frequency. A BERT score cannot. Zhan et al. sketched three stages for MonoBERT: each side contextualizes itself, then the two sides interact, then the model composes a score. The evidence was thin, and query-to-document attention was treated as the lesser direction. Jiang et al. used the information bottleneck and found both lexical matches and semantic relations, with [CLS] collecting relevance only late. Lu et al. found matching heads in one MiniLM cross-encoder that behave like a semantic BM25; those signals reconstruct the model output at a correlation of 0.80. Each study used one model and one dataset. BEIR had already shown that in-domain and out-of-domain neural retrieval diverge. The gap is smaller for cross-encoders than for bi-encoders, and it is still there. Which layers and which neurons move under that shift had not been checked across model sizes.
Three BERT cross-encoders separate size from pretraining. MiniLM-L12 has about 33 million parameters and 12 layers, pretrained by deep self-attention distillation, from a public MS MARCO checkpoint. MonoBERT-large has about 340 million parameters and 24 layers, also a public checkpoint, pretrained with masked language modeling and next-sentence prediction. MonoBERT-base is the control: 12 layers and the same pretraining family as large, fine-tuned separately on MS MARCO with InfoNCE.
In-domain data are the TREC Deep Learning tracks from 2019 to 2022, 226 topics and more than 400,000 human judgments. Out of domain, the BEIR sets that still look like ordinary retrieval: FiQA, TREC-Covid, NFCorpus, BioASQ, Natural Questions, and Robust04. TREC-News is excluded because its queries are documents. Random documents are easy negatives, labeled -1. Retrieved non-relevant documents are hard negatives, labeled 0.
Signals inside a transformer are entangled, so the same samples go through three methods.
Matching heads are found by contrasting attention on relevant and non-relevant pairs. The query-key circuit explains how they pair tokens. Linear discriminant analysis times when a relevance direction appears in [CLS]. Probing cannot point at a single neuron, and full-model path patching does not scale to three models across many datasets, so neither was run across the board.
In-domain and out-of-domain runs follow the same three stages, and two pieces of Zhan's order do not hold.
From the early layers through the middle, self-attention and cross-attention fire together. Identical tokens can match before contextualization is finished. Query-to-document and document-to-query transfers both matter from early on. Blocking document self-attention hurts around the middle: about layer 7 in MiniLM, about layer 9 in MonoBERT-large, earlier in base. Blocking that path in every layer still leaves nDCG far above a random ranking. Blocking query self-attention and query-document interaction together drops all three models to a random ranking in domain. Out of domain, only the two MonoBERT models keep part of the score, so some match signal can remain in [CLS] without an explicit cross-attention path.
Relevance then piles up on the query tokens. In the bottleneck masks this is layers 8 and 9 for MiniLM and layers 9 and 10 for MonoBERT-base. The write into [CLS] comes later, and the window is short. NIG gives MiniLM one or two layers for it; the bottleneck gives three, mostly read from the query. [CLS] attending to itself does almost nothing there. MonoBERT-large takes longer, reads query and document together, and in some settings uses [CLS]-to-[CLS] in the last layer to revise the signal. Base sits between them.
The highest-attribution heads are the matching heads. Early and middle layers match occurrences of the same token. The last layers match contextualized tokens that are close in meaning. Their query-key circuit prefers cross-attention and pairs similar source and target tokens.
[SEP] does not carry relevance. NIG sometimes marks flow into the first [SEP] as important, but the feed-forward neurons at those positions are not. That is an attention sink: the token absorbs attention and damps other transfers. With the query-document path cut, special tokens in MonoBERT-large carry essentially no relevance, while MiniLM's average score falls below a random model, so those tokens penalize a document when relevance evidence is missing. MiniLM's prediction tracks non-relevance signals. Both MonoBERT models track relevance signals. In all three, a relevance direction inside [CLS] appears only in the final layers. Earlier, [CLS] behaves like a no-op, in the same family as [SEP].
Domain shift splits the neuron sets. On MiniLM the top 1% overlaps heavily across out-of-domain datasets, so the same neurons matter everywhere. On both MonoBERT models the intersection across those datasets is nearly empty. The extra pieces in MonoBERT-large are mostly attention heads in layers 14, 15, 19, 21, and 22. What changes is where information is moved.
Table 2 gives the scale in nDCG@10:
| Model | DL19 | DL20 | DL21 | DL22 | Covid |
| MiniLM | 0.74 | 0.68 | 0.65 | 0.49 | 0.74 |
| MonoBERT-base | 0.73 | 0.68 | 0.64 | 0.49 | 0.73 |
| MonoBERT-large | 0.71 | 0.68 | 0.63 | 0.49 | 0.70 |
On FiQA, large is slightly ahead, 0.32 against MiniLM's 0.31. NFCorpus is 0.35 for all three. On BioASQ, MiniLM and base score 0.50 and large scores 0.47. The largest change after the bottleneck mask is MiniLM on DL19, 0.74 to 0.71, and it is not significant.
From 33M to 340M parameters, these nDCG@10 numbers do not move.
Reranker pruning can follow the stages. Early and middle layers do the matching. The score accumulates on query tokens. The classification head reads a vector written in the last layers. Earlier work already knew these models were over-parameterized and that layers or heads could come out. The missing piece was which stage a cut would hit.
MiniLM is still the default small reranker, and speed is only part of that. Out of domain it keeps using the same neurons. MonoBERT-large recruits extra late heads. The BEIR pattern that a larger model is not automatically steadier now has a neuron-level picture.
There is no new ranker here. The gain is the design of the study: three sizes, in-domain and out-of-domain data, one protocol, and a corrected order in which self-context and cross-matching happen together. The fine-tuning recipes do not match, so this is not a reason to swap a production MonoBERT-large for MiniLM.
The paper states that integrated gradients do not always point at neurons that actually model relevance. Attention sinks get marked as important. The information bottleneck was hard to make both sparse and accurate on MonoBERT-large, so the three-stage account for the large model rests mainly on NIG, and the mask map is messy.
Size, depth, pretraining, and fine-tuning all change at once. Base was trained with InfoNCE for this study. MiniLM and large are public checkpoints. The control separates depth from BERT pretraining, and the loss is not aligned. A more consistent mechanism in the small model is an observation. It does not show that distillation caused the stability.
The ablation write-up anchors the curves at random, below random, and far above random, plus layers 7 and 9. Exact per-layer drops are not listed. The circuit analysis covers high-attribution heads only. The study stops at BERT encoders, and decoder rerankers are outside the experiments. Extra out-of-domain neurons may also be attribution noise, because gradients move with the input. An empty intersection does not by itself prove that the mechanism was replaced.