Query-conditioned document modulation
The query adapter predicts an affine transform from the projected query and applies it to each candidate document, pulling relevant ones closer and pushing irrelevant ones away.
Official Project Website · EACL 2026
Interpretable Modular Retrieval Neural Networks (IMRNNs) augments frozen dense retrievers with two lightweight adapters: one uses the query to modulate document embeddings, the other uses retrieved documents to refine the query. The base retriever stays frozen. The semantic shift is visible, attributable, and inspectable.
Affiliations & Release Surfaces
Method
Starting from a frozen dense retriever, IMRNNs projects embeddings into a compact working space and applies two learned MLP adapters bidirectionally, exposing interpretable semantic shifts between queries and documents.
Live Visualization
IMRNNs starts from the frozen retriever's static embedding space and projects query and document embeddings into a compact working space for modulation.
The query adapter predicts an affine transform from the projected query and applies it to each candidate document, pulling relevant ones closer and pushing irrelevant ones away.
The document adapter produces document-side transforms whose aggregate shifts the query toward the relevant semantic neighborhood before final cosine scoring.
Modulation vectors are back-projected via Moore-Penrose pseudoinverse to expose the token concepts, such as Peso and Mexico, that causally drove each ranking change.
Paper
The paper presents IMRNNs as a retrieval adapter that works directly in embedding space. The base retriever remains frozen, the adapters are lightweight, and the ranking changes can be traced back to concrete token concepts.
IMRNNs adds two MLP adapters on top of a frozen dense retriever. One modulates document embeddings using the query, and the other refines the query using the candidate documents.
The adapters are trained with margin-based ranking loss and hard negatives while the underlying encoder is kept fixed. This preserves the original retriever and limits training cost.
Document embeddings are cached offline. At runtime, IMRNNs applies lightweight modulation and cosine scoring on top of those cached representations, which keeps the system practical for real retrieval pipelines.
The explanation is part of the model itself, not a separate post-hoc layer. The same modulation vectors that change rankings can be back-projected to reveal the concepts that mattered most.
Citation
@misc{saxena2026imrnns,
title={IMRNNs: An Efficient Method for Interpretable Dense Retrieval via Embedding Modulation},
author={Yash Saxena and Ankur Padia and Kalpa Gunaratna and Manas Gaur},
year={2026},
eprint={2601.20084},
archivePrefix={arXiv},
note={Accepted to EACL 2026}
}
Use IMRNNs
Use Hugging Face for published checkpoints. Use the GitHub package to cache embeddings, train on new datasets, or attach adapters to a different dense retriever.
from imrnns import IMRNNAdapter
# Load base retriever + IMRNN adapter checkpoint from Hugging Face
adapter = IMRNNAdapter.from_pretrained(
encoder="minilm",
dataset="webis-touche2020",
repo_id="yashsaxena21/IMRNNs",
device="cpu",
)
scores = adapter.score(
query="Should social media platforms ban political advertising?",
documents=[
"Restricting political ads can reduce targeted misinformation.",
"A recipe for roasted cauliflower with tahini sauce.",
"Ad transparency archives improve auditing of campaign messaging.",
],
top_k=3,
)
print(scores)
# Full training and evaluation flow
python -m imrnns cache \
--encoder minilm \
--dataset webis-touche2020 \
--datasets-dir /path/to/datasets \
--output-dir /path/to/cache_mini_webis-touche2020
python -m imrnns train \
--encoder minilm \
--dataset webis-touche2020 \
--cache-dir /path/to/cache_mini_webis-touche2020 \
--datasets-dir /path/to/datasets \
--output-dir /path/to/artifacts
python -m imrnns evaluate \
--encoder minilm \
--dataset webis-touche2020 \
--cache-dir /path/to/cache_mini_webis-touche2020 \
--datasets-dir /path/to/datasets \
--checkpoint /path/to/artifacts/imrnns-minilm-webis-touche2020.pt \
--k 10
# Attach IMRNNs to any custom dense retriever
python -m imrnns run \
--encoder-model-name my-org/my-retriever \
--embedding-dim 768 \
--query-prefix "query: " \
--passage-prefix "passage: " \
--dataset my-dataset \
--datasets-dir /path/to/datasets \
--cache-dir /path/to/cache_my_retriever \
--output-dir /path/to/artifacts \
--k 10
Ecosystem
Source code, CLI, baseline comparisons, and end-to-end workflow for caching, training, and evaluation.
→Released adapter checkpoints, public model card, and examples for rapid adoption across retrieval tasks.
→Complete method, training setup, interpretability formulation, and BEIR benchmark results.
→Research lab context and broader work on AI systems, knowledge-aware intelligence, and interpretability.
→