# Explanations that Transfer: Interpreting Medical Retrieval with Sparse AutoEncoders

Bouchacourt, Diane, Brison, Gaëtan · arXiv · 2026-11-13

- **Problem** Dense medical retrieval embeddings are opaque, and fine-tuning them on one medical corpus may reduce how well they transfer to other corpora.
- **Method** Trains a top-k sparse autoencoder on frozen embeddings with a reconstruction loss and an InfoNCE term on the sparse codes, then describes each neuron with TF-IDF terms and LLM-written descriptions.
- **Results** Reached 59.85±0.45 NDCG@10 on CURE for Gemini embeddings at k=256, up from 52.77 for the original embedding.

![Figure 6: OOD performance, fixedm= 3072, comparing the effect ofk- BGE embeddings](https://refivu.com/papers/fcc9b660-cb5e-4a36-99e8-e9d43824526d/figures/figure-26f18a571f906607bcf89a882322629d.png?thumb=512)

**Figure 6** : OOD performance, fixedm= 3072, comparing the effect ofk- BGE embeddings.

[Original paper](https://arxiv.org/abs/2611.18179v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Bouchacourt, Diane, Brison, Gaëtan · Explanations that Transfer: Interpreting Medical Retrieval with Sparse AutoEncoders · Original paper figure · Extracted the figure area from page 15 of the original PDF.

## Why retrieval embeddings need an explanation layer

Retrieval systems for medical question answering match a query embedding against document embeddings produced by a text encoder, usually a large language model, and return the closest documents. In medicine the answer has to rest on accurate sources, and encoders are being adapted to clinical text to improve this matching. Those encoders remain black boxes, which makes it hard for practitioners and users to see why a document was retrieved and to trust the system.

The study asks two questions about sparse codes learned from frozen medical embeddings: whether they can keep or improve retrieval quality, and whether the learned features transfer to medical corpora not used in training. A third question is whether neuron-level descriptions can say why a particular document ranks above another.

## Sparse codes on frozen embeddings

A frozen text embedder maps each query and each corpus document to a dense vector, and the sparse autoencoder is trained only on these vectors, so the embedder itself is never changed. The autoencoder follows the TopK formulation, in which the encoder output is cut down to its k largest entries and the rest are set to zero.

The encoder subtracts a pre-bias from the input, applies a linear map, and adds a bias; the TopK step then keeps k neurons, and the decoder reconstructs the embedding from that sparse code. \\\[ u = W\_{enc}(x - b\_{pre}) + b\_{enc}, \\quad z = \\mathrm{TopK}\_k(u), \\quad \\hat{x} = W\_{dec}\\, z + b\_{pre} \\\] The latent width m is much larger than the embedding size d, so the code is overcomplete, and each code has at most k non-zero values.

A ReLU is applied after the TopK step so that the active activations are non-negative.

Kang et al. keep relevance by aligning reconstructions to the originals with a Kullback-Leibler term, a choice that presumes the BGE training data; the authors judged that assumption unsafe for the medical models they use, so they rely on the ground-truth relevance labels instead.

## Joint reconstruction and contrastive training

The total loss adds a weighted contrastive term to the reconstruction term, so that the sparse code keeps the information of the dense embedding while also ranking relevant documents higher. \\\[ L = L\_{rec} + \\lambda L\_{NCE} \\\]

The reconstruction term averages the squared error between each reconstructed embedding and its original, computed separately over a batch of corpus documents of size N\_c and a batch of queries of size N\_q. \\\[ L\_{rec} = \\frac{1}{N\_c}\\sum\_{x\_c \\in B\_c}\\lVert \\hat{x}\_c - x\_c\\rVert^2 + \\frac{1}{N\_q}\\sum\_{x\_q \\in B\_q}\\lVert \\hat{x}\_q - x\_q\\rVert^2 \\\]

The contrastive term works on batches of B query-document pairs, where each query is paired with one relevant document. The score s\_{i,j} is the cosine similarity between the sparse code of query i and the sparse code of document j, and the temperature tau sets how sharply the softmax separates them. \\\[ L\_{NCE} = -\\frac{1}{B}\\sum\_{i=1}^{B}\\log\\frac{\\exp(s\_{i,i}/\\tau)}{\\exp(s\_{i,i}/\\tau)+\\sum\_{j \\in Z\_{-i}}\\exp(s\_{i,j}/\\tau)} \\\] The negatives Z\_{-i} are the positive documents of the other queries in the batch, together with the documents used for the reconstruction term.

Known positives of a query that appear among its distractors are masked out of the denominator, so a correct document is never pushed away as a negative.

Query reconstruction is reweighted by a factor of 0.1, because a corpus usually holds far more documents than there are queries, and without the weight the query term would be swamped by the corpus term. Among configurations whose 95% intervals overlap with the best, the smallest latent width m is chosen.

At test time a query goes through the frozen embedder and then the sparse encoder, and documents are ranked by cosine similarity between the sparse codes.

## Datasets and embedders

CURE is the only training corpus, with 244 600 corpus texts and 2000 questions spanning ten medical disciplines. Its queries are split into 1400 training, 200 validation and 400 test queries, and its relevance labels are graded. Table 4 lists each benchmark's role, document and query counts and relevance type.

MIRIAD is evaluated on 1000 test queries over a corpus of 31 000 passages with binary labels. NFCorpus has 3633 documents and 323 test queries with graded labels. MIRIAD, NFCorpus and CURE draw on academic biomedical literature, whereas the R2MED queries come from community question answering and their positive documents are web pages cited in the answers, so the R2MED corpora differ more from CURE.

Three embedders are compared: bge-large-en-v1.5, MedEmbed-large-v0.1, which is BGE fine-tuned on clinical data, and gemini-embedding-001, a proprietary model that exposes only final embeddings. The native dimension d is 1024 for BGE and MedEmbed and 3072 for Gemini, and the dense variant sets k equal to d. Results use three seeds and are reported as NDCG@10 in percent with 95% confidence intervals.

## In-domain retrieval on CURE

Table 1 gives NDCG@10 for the original embeddings and for SAE variants at each k, with a dense variant that keeps the native dimension but expands the latent space.

MedEmbed starts slightly lower than BGE on CURE, with 52.46 for the original against 53.06, and this gap persists after SAE training, where the dense BGE code reaches 61.87 and the dense MedEmbed code 60.38.

Increasing k trades sparsity for retrieval quality, and the dense variant gives the top score for each embedder. The k=128 and k=256 codes reach at least 94% of the dense performance on CURE for every embedder.

Setting lambda to 0 removes the contrastive term, and the authors report that CURE NDCG@10 then falls 7.5 points for BGE and 8.6 points for Gemini below the contrastive baseline, leaving the result no better than the original embedding.

## Transfer to out-of-domain corpora

On MIRIAD and NFCorpus the effect of k is not uniform across embedders: MIRIAD rises with k and peaks at the dense variant for all three embedders, while NFCorpus follows the same pattern except for MedEmbed. The authors read this as a consequence of corpus genre, since MIRIAD and NFCorpus are closer to CURE than the R2MED subsets are.

Across the grid of k and m, the in-domain score rises with m for dense models while the out-of-domain scores favour small m or stay flat. For sparse models with k at most 256, the smallest m is better than or tied with larger widths in every dataset, which the authors read as capacity control that transfers. For sparse models with k at most 256, the difference between lambda equal to 0 and lambda above 0 on the five unseen datasets is small and can favour either setting.

## Building neuron interpretations

Three interpretation types are built for each neuron: snippets, TF-IDF terms and an Interpreter LLM description. Snippets show the five top-activating corpus documents, two documents where the neuron does not fire, and five top-activating queries.

TF-IDF weights each term by how often it appears in a text and how rare it is across the training documents and queries, with unigrams and bigrams retained.

The Interpreter LLM, medgemma-4b-it, receives the same top-activating examples with their activation values, plus the non-firing documents, and returns a topic, a one-to-two sentence description and up to ten keywords. Table 2 shows the three interpretations for one neuron of the BGE SAE at k=64, where the TF-IDF terms and the description both centre on bone tissue and related cells.

## Scoring interpretations with activation prediction

The Activation Prediction LLM, medgemma-4b-it, reads an interpretation and outputs a probability that the neuron fires on a given text. A text counts as a positive for a neuron when the neuron is among its 20 strongest active features, and as a negative when the neuron is inactive, which avoids corpus-specific activation thresholds. Up to three positives and three negatives are sampled per neuron, and texts used to build interpretations, together with passages from the same article, are excluded.

Performance is the Pearson correlation between the predicted probability and the positive or negative label.

On CURE with the BGE SAE at k=64 and m=3072, the Interpreter LLM descriptions reach 0.440 and TF-IDF terms reach 0.439, while snippets reach 0.308. On MIRIAD the same setting gives 0.334 for the Interpreter LLM descriptions, 0.313 for TF-IDF terms and 0.216 for snippets. Snippets have the lowest correlation on every dataset, and the authors read this as concept-level descriptions being more useful to the predictor than raw examples.

The per-neuron AUROC for the BGE SAE lies between 0.928 and 0.955 and correlates with the Pearson values. Across the five out-of-domain corpora, the correlation between activation prediction and retrieval NDCG@10 lies between 0.69 and 0.94 for each embedder and interpretation type. The authors read this as evidence that sparse codes transfer when their semantics do.

The Activation Prediction LLM places 76% of its answers at or below 0.1, so its absolute probabilities are low. The mean probability still falls from the strongest rank band to the weakest, and the authors report a negative correlation with rank across all ranks 1 to 64, which the rank itself never reaches the model. Calibrating these probabilities is left for future work.

To check the influence of the MedGemma predictor, Qwen2.5-3B Instruct and Gemma3-4B were run on the same neuron-text pairs, and their correlations stay positive. Agreement between the three predictors is highest for Interpreter LLM descriptions, with values from 0.49 to 0.83, followed by TF-IDF terms at 0.42 to 0.71 and snippets at 0.17 to 0.56.

## Expert check of predicted activations

Five medical experts judged whether a neuron would fire on a passage from its description and the passage excerpt, on a four-point scale from definitely not to definitely yes. The 30 neurons were drawn at random from the 60 neurons with the highest interpretability scores, using 15 positive and 15 negative passages.

Averaging the five experts' predictions gives a Pearson correlation of 0.81 with the activation labels and an AUROC of 0.92. Because the sample comes from the top-scoring neurons only, this check does not cover the full range of neurons.

## Reading one retrieval decision through neurons

Two CURE test queries are analysed with the BGE SAE at k=64, showing the neurons whose activations differ most between two retrieved passages. In the kidney-stones query, the highly relevant passage is ranked first and the not relevant passage is ranked sixth, and the neurons for quality of life, kidney stones and pandemic impact favour the first.

The not relevant passage wins only on kidney disease, a broad neuron that any kidney condition can trigger.

In the retinoid query, the correct passage is ranked twenty-third and the wrong-population passage is ranked fourth, and the infant health neuron fires only on the correct passage. The wrong-population passage wins on laboratory, retinoids and surveillance, and the authors use this to say that the neurons can explain a retrieval error.

The four neurons account for 77% and 76% of the cosine similarity of each passage in the kidney-stones query, and for 53% and 35% in the retinoid query. These are two hand-picked cases, so they illustrate how the readout works and do not measure how often such explanations are correct.

## Limitations

The human expert study is small, and the authors plan a larger annotation study as future work.

For the Gemini embedder at k=64, the number of dead latents is 2713±156 without the auxiliary loss and falls to 38±116 with it. The auxiliary loss does not come free: out of ten out-of-domain comparisons, three are lower, for example Medical-Sciences at k=64 falls from 39.57 to 33.12. The authors leave the trade-off between latent liveness and retrieval quality to future work.

## Paper info

- **Authors**: Bouchacourt, Diane, Brison, Gaëtan
- **Venue**: arXiv · Preprint
- **First published**: 2026-11-13
- **Added**: 2026-11-16
- **Updated**: 2026-11-13
- **Version**: v1
- **arXiv**: 2611.18179
- **Category**: cs.IR · cs.LG
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2611.18179v1) · [PDF ↗](https://arxiv.org/pdf/2611.18179v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Medical AI systems that answer users' queries rely on retrieving medical knowledge from large document collections. In this context, finetuning general models on medical datasets can improve retrieval relevance. Yet the dense embeddings underlying modern retrieval systems remain largely opaque, making it difficult to understand the mechanics behind their results. Moreover, adapting to a specific medical dataset risks losing transferability to new clinical corpora. In this work, we tackle these issues by applying Sparse Autoencoders (SAEs) to medical information retrieval, transforming dense text embeddings into semantically interpretable representations. To do so, our model combines a reconstruction objective with an InfoNCE contrastive loss that directly preserves query-document relevance. We evaluate three embedding models across six medical retrieval datasets, both in-domain and out-of-domain. Trained on a medical corpus, our sparse codes improve in-domain retrieval over the original embeddings, and lose less out-of-domain performance than their dense counterparts, especially when the target corpus is distant from the training one. Importantly, our experiments show that the method yields interpretable features whose semantic content can be inferred from the queries and documents that activate them most strongly. The interpretation of these features sheds light on why a particular document was retrieved, and transfers beyond the training distribution.

## Quote from the paper

Bouchacourt, Diane, Brison, Gaëtan (2026). Explanations that Transfer: Interpreting Medical Retrieval with Sparse AutoEncoders. arXiv:2611.18179v1. https://arxiv.org/abs/2611.18179v1

**BibTeX**

```
@misc{diane2026explanations,
  title = {{Explanations that Transfer: Interpreting Medical Retrieval with Sparse AutoEncoders}},
  author = {Bouchacourt, Diane and Brison, Gaëtan},
  year = {2026},
  eprint = {2611.18179},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.18179v1}
}
```

## Other paper commentary

- [Who Counts as Exposed? Measurement Choices in an Open, Re-estimable Index of Occupational AI Exposure](https://refivu.com/en/papers/bc2cfc93-d47d-40b5-b11c-31874b253264-who-counts-as-exposed-measurement-choices-in-an.md)
- [The Google Similarity Distance](https://refivu.com/en/papers/bb278d2d-7ba0-4fc6-9c9b-7e248f6965c2-the-google-similarity-distance.md)
- [Latent Dirichlet Allocation (LDA) and Topic modeling: models, applications, a survey](https://refivu.com/en/papers/7c7dce20-b29a-401e-a22b-b97cd29a6ba4-latent-dirichlet-allocation-lda-and-topic-modeling-models.md)
- [Probabilistic Latent Semantic Analysis](https://refivu.com/en/papers/2bb41f8f-b6cc-410c-9347-fd84aed3b2b4-probabilistic-latent-semantic-analysis.md)
- [Personalized Top-N Sequential Recommendation via Convolutional Sequence Embedding](https://refivu.com/en/papers/7c1f4e3a-96df-4fe9-a8b5-6c36b294a565-personalized-top-n-sequential-recommendation-via.md)
- [Deep Learning based Recommender System: A Survey and New Perspectives](https://refivu.com/en/papers/a0b4c642-cc6f-408f-8e70-b8aaebc9c4da-deep-learning-based-recommender-system-a-survey-and.md)
- [JFinBench: A Continuously Refreshable Japanese Financial Benchmark from the Latest Certification Exams](https://refivu.com/en/papers/507f003d-f0bb-48de-a7b8-b4a9727995ee-jfinbench-a-continuously-refreshable-japanese-financial.md)
- [Small Is Not Dead: Distance-Aware Cluster Revival for e-means](https://refivu.com/en/papers/f2b6f05d-7401-4871-be99-b749f117115c-small-is-not-dead-distance-aware-cluster-revival.md)
- [PerfArena: Ranking LLMs by Code Performance](https://refivu.com/en/papers/c040cebb-8cde-4fb3-b12d-79a3fe746bfa-perfarena-ranking-llms-by-code-performance.md)
- [FEND: Far-End Detection in Outbound Voice AI Calls](https://refivu.com/en/papers/8f9be405-cbfb-49aa-8c22-204722d38a37-fend-far-end-detection-in-outbound-voice-ai.md)
- [Cracks in Embeddings: Robustness and Stability of JEPA-Based Chest X-Ray Representations](https://refivu.com/en/papers/daee5a77-a7ae-4a85-aa91-3c0350658e14-cracks-in-embeddings-robustness-and-stability-of-jepa.md)
- [Tracing Uncertainties of Extreme El Niño Prediction to Mesoscale Ocean Currents](https://refivu.com/en/papers/e50737f2-d670-42f4-9b3c-5a4a5eaf3da4-tracing-uncertainties-of-extreme-el-nino-prediction-to.md)

## Terms in this paper

- [cosine similarity](https://refivu.com/en/terms/3baa01a8760d-cosine-similarity)
- [AUROC](https://refivu.com/en/terms/096f06e69425-auroc)
- [TF-IDF](https://refivu.com/en/terms/b8fd079027e3-tf-idf)
- [nDCG@10](https://refivu.com/en/terms/2d8a23b2a2b1-ndcg-10)
- [Sparse Autoencoder (SAE)](https://refivu.com/en/terms/b4606ff9dbb1-sparse-autoencoder-sae)
- [InfoNCE loss](https://refivu.com/en/terms/eab7554fe65f-infonce-loss)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/fcc9b660-cb5e-4a36-99e8-e9d43824526d-explanations-that-transfer-interpreting-medical-retrieval)
