Axiomatic Causal Interventions for Reverse Engineering Relevance Computation in Neural Retrieval Models

Catherine Chen, Jack Merullo, Carsten Eickhoff

Introduction

Neural ranking models, particularly those based on transformer architectures like BERT, have significantly advanced the state-of-the-art in information retrieval. However, these models often operate as "black boxes," where the internal logic driving relevance scores remains opaque. Traditional interpretability methods, such as probing, typically identify correlations between internal representations and external features (e.g., term frequency). Yet, correlation does not imply causation; a model may represent a feature without utilizing it for its final ranking decision. This work addresses this gap by applying causal intervention techniques to identify the specific internal components responsible for computing document relevance.

Methodology: Activation Patching

To move beyond correlational analysis, the authors adapt Activation Patching (also known as causal mediation analysis) to the retrieval domain. This technique involves comparing a "clean" input (a highly relevant document) with a "corrupted" input (a document with lower relevance). By systematically "patching" internal activations—such as the output of a specific attention head—from the clean run into the corrupted run, researchers can observe the resulting change in the model's final relevance score.

Overview of the activation patching process for identifying causal components in relevance computation.

If patching a specific component causes the corrupted document's score to recover to the level of the clean document, that component is deemed causally responsible for the relevance calculation. The study specifically targets components that adhere to the TFC1 Axiom, which dictates that increasing the frequency of a query term should increase a document's relevance score.

Experimental Setup

The researchers utilized the MS-MARCO dataset to create diagnostic axiomatic subsets designed to isolate term-frequency effects:

  • TFC1-Inject (TFC1-I): A query term is appended to a document to observe the model's response to increased term frequency.
  • TFC1-Replace (TFC1-R): Existing query terms are replaced with filler tokens to measure the impact of decreased frequency.

These datasets allow for the isolation of the term-frequency signal, enabling a granular view of how the model processes repeated query terms.

Key Results and Localization

The investigation revealed that relevance computation is remarkably localized within the model. In the TAS-B model (a 6-layer DistilBERT bi-encoder), the term-frequency signal is not distributed across all 72 attention heads but is instead concentrated in a small "circuit" of four specific heads (0.9, 1.6, 2.3, and 3.8).

Heatmaps showing the causal impact of different token types across layers for TFC1-I and TFC1-R experiments.

As shown in the heatmaps, the intervention's effect is highly specific to certain layers and token types. The authors identified a functional specialization among these heads:

  1. Duplicate Token Heads: Heads in the early layers (0.9 and 1.6) function as counters, identifying repetitions of query terms.
  2. Aggregation Heads: Heads in the middle layers (2.3 and 3.8) aggregate this count information and "write" it to the [CLS] token, which serves as the final representation for scoring.

Patching just these four heads allowed the model to almost fully recover its ranking performance in the TFC1-I experiments, achieving a normalized difference of approximately 1.0.

Discussion and Future Work

The study also uncovered a significant positional bias, where terms at the beginning of a document carry more weight than those appearing later. Additionally, the [SEP] token was found to act as a "sink," absorbing attention from less relevant tokens to preserve the model's focus on key term repetitions.

While these findings provide a causal map of relevance in TAS-B, limitations remain. The use of "filler tokens" creates somewhat unnatural document structures, and it is unclear if larger cross-encoders exhibit similar localization. Future research will explore Model Editing—manually tuning these identified heads to mitigate biases—and Path Patching to trace the step-by-step flow of information from input tokens to final scores.

Summary updated

BibTeX
@inproceedings{chen2024axiomatic,
  author = {Catherine Chen and Jack Merullo and Carsten Eickhoff},
  title = {{Axiomatic Causal Interventions for Reverse Engineering Relevance Computation in Neural Retrieval Models}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2024},
}
Figure