Deep Dive · Explainability

Why Did You Rank That? Explainability for LLM-Powered Retrieve-and-Rank

Modern search and recommendation run a four-stage funnel where cost climbs three-to-four orders of magnitude from retrieval to LLM rerank. Each stage exposes a different surface to explain — a cosine scalar, a feature vector, a permutation, a paragraph of prose. This is the method-by-method guide to all four, and the one rule underneath them: plausible is not faithful.

The whole idea in 30 seconds

A ranking system isn’t one model — it’s a funnel of four, and you have to explain each one differently.

This is a method guide. It assumes the funnel from the companion piece, Two Towers, One Index — here we ask not how it ranks, but how you explain what it ranked. The “Go deeper” boxes hold the dense bits.

An item shows up at the top of a feed, or a document wins the top spot in a search. Someone — a user, an engineer, a regulator, an auditor — asks the oldest question in machine learning: why that one? It sounds like one question with one answer. It isn’t. A modern ranking stack is four models in a row, each with its own logic. The honest answer to “why” depends on which of the four you mean — and on whether your explanation reflects what the model did, or just sounds like it might.

This post is a field guide to the second part: the explainability methods for an LLM-powered retrieve-and-rank system, organized by stage. For each, the questions that matter are always the same three: what does it actually compute, which stage does it apply to, and is it faithful or merely plausible? That last one is the whole game.

01The funnel, in one page

Industrial search and recommendation is a cascade: a sequence of models that each take the survivors of the previous one and trim further, getting more expensive and more accurate as the candidate set shrinks. (For how the retrieval stage itself works, see the two-tower companion; here it’s just stage one.)

The funnel and its explanation surfaces

Each stage exposes a different thing to explain — and a different best method. Hover any box. Green = faithful by structure, amber = faithful but costly/offline, red = readable but not faithful.

Stage & how many candidates What it exposes → best faithful method Two-tower retrieval over an ANN index. Narrows the full catalog (10^6–10^9) to ~thousands. Cheapest stage, sub-millisecond per candidate. Retrieval 10⁹ → ~10³ · two-tower + ANN A light, often two-tower-plus model trims thousands to hundreds, under a consistency constraint with the heavy ranker (Gu et al., 2022). Pre-rank ~10³ → ~10² · light scorer A rich cross-feature model (DLRM, DCNv2, DIN) scores hundreds. Tens of ms. The most consequential and most opaque stage. Heavy rank ~10² → ~10¹ · cross-features An LLM and/or policy layer reorders the final tens: listwise rerank, diversity, business rules. 50–300 ms per LLM pass. Rerank / policy ~10¹ · LLM + rules Best explained by structural readouts: SPLADE term weights or ColBERT token alignments literally compose the score. Single-vector dense is the hard case — use SAEs / ANN provenance. cosine / token aligns SPLADE / ColBERT structural (dense = hard) Feature attribution defined for a permutation, not a scalar: RankingSHAP / Rank-LIME offline, TreeSHAP online for GBDT. Faithful but costly. feature vector → a score RankingSHAP · Rank-LIME · TreeSHAP · activation patching faithful, but offline / expensive (attention & raw saliency: not faithful) A permutation plus an optional rationale. Trust the logits (FIRST/PRP/setwise) + a counterfactual check; treat the prose as UX, never as an audit trail. permutation + prose logits + counterfactual rationale ≠ cause prose = UX only
The cruel irony, read left to right: the hardest stage to explain (dense retrieval) is the cheapest; the most consequential (heavy ranking) is the most opaque; and the most readable output (an LLM’s written reason) is the least faithful. Color is faithfulness, not effort.

Two facts about this funnel drive everything downstream. First, per-candidate cost rises three-to-four orders of magnitude from head to tail — which is why cross-encoders and LLMs, far too slow on millions of items, are affordable on the final tens. Second, and the theme of this whole post: each stage exposes a structurally different thing to explain. You cannot point one tool at all four.

02The one rule: faithful is not the same as plausible

One distinction governs every method below. Two explanations of the same ranking can both read beautifully, yet only one is true to the model. Borrowing the framing from Jacovi & Goldberg (ACL 2020), there are two orthogonal axes:

The trap is that these can be inversely correlated: the explanation a person finds most satisfying may be the one furthest from the computation. And here’s the kicker — faithfulness is unobservable. You can’t look at an explanation and see whether it’s true; you can only run proxy tests, each with its own failure mode. Human evaluation, crucially, can only ever validate plausibility — a model with randomized weights can produce explanations people rate highly.

The four traps this post keeps flagging

(1) A plausible explanation is not a faithful one. (2) Attention is not explanation. (3) A generated rationale is not a cause. (4) Clean per-stage explanations do not compose into an end-to-end answer to “which stage caused this.”

Go deeper: the faithfulness toolkit (and why every test is a proxy)

You test faithfulness by perturbing what an explanation claims is important and checking the model actually moves: comprehensiveness & sufficiency (ERASER, DeYoung et al. 2020), deletion/insertion AOPC curves, the ROAR retrain test (Hooker et al. 2019), and simulatability (can a human predict the model from the explanation?). And run sanity checks (Adebayo et al. 2018): if a saliency map barely changes when you randomize the model’s weights, it isn’t explaining the model — a necessary, not sufficient, filter.

Each proxy has a known hole. Perturbation pushes inputs off the data manifold, so the score drop may be distribution shift, not importance; ROAR fixes that by retraining but is costly and leaks information through the mask. Recent OOD-robust, retrain-free estimators (F-Fidelity, 2024; ICE, 2026) patch this. And the disagreement problem (Krishna et al. 2022) lurks under all of it: SHAP, LIME, and gradients routinely rank the same features differently, with no ground truth to arbitrate. Worse, attributions are adversarially manipulable — “Fooling LIME and SHAP” (Slack et al. 2020) builds models that hide bias from exactly these explainers.

03Explaining retrieval: an interpretability gradient

The first stage is the cheapest to run and, perversely, the hardest to explain — because a single-vector bi-encoder crushes a document into one dense vector and scores by a cosine. There’s no native per-word reason; contrastive training makes the geometry deliberately uninterpretable. But not all retrievers are equally opaque. There’s a clean gradient of interpretability:

Retrieval, from transparent to opaque
RetrieverHow it scoresWhat you can read off
BM25 transparentTerm overlap, TF-IDF weights.Exactly which terms matched and how much. Fully glass-box.
SPLADE structuralSparse weights over the vocabulary, off the masked-LM head.Each non-zero weight is a real word — you see the matched terms and the model’s learned expansions (synonyms BM25 can’t add).
ColBERT structuralFor each query word, its best-matching document word (MaxSim), summed over the query.The score decomposes into token↔token alignments — which query word matched which doc word.
Single-vector dense opaqueOne cosine between two vectors, over an approximate index.A number. No native attribution — this is the hard case below.

SPLADE and ColBERT explanations are structural: the readout literally composes the score, so it can’t lie about the arithmetic. (Be precise, though — call them transparent, not magically faithful: a SPLADE expansion term can still be spurious, and ColBERT tells you which token pair aligned, not why those two dense token vectors are similar.) That structural readout is the single best reason to reach for a sparse or late-interaction retriever when explainability is a hard requirement.

In plain terms: a structural explanation is an itemized receipt — the line items add up to the total, so they can’t be fiction. Explaining a single-vector dense score is reverse-engineering the shopping list from one final number: an educated guess about a surrogate, not the receipt.

For the opaque single-vector case, you have three honest options. Post-hoc attribution (Integrated Gradients adapted to retrievers) reveals that dense models do both soft and exact matching, and that some tokens carry negative weight — but IG is baseline-sensitive and noisy. ANN-neighbor provenance is the pragmatic production answer: surface the matched chunk, similarity, and nearby neighbors as the “why retrieved.” Honest, but association-level — and since the index is approximate, the neighbor you show may not be the true nearest. And the 2024–26 frontier: train a sparse autoencoder on the embeddings to crack each dense vector into a few human-namable concepts.

Go deeper: sparse autoencoders, and why you can’t just read embedding axes

The tempting move — “dimension 412 means ‘sci-fi’” — fails. Embeddings are polysemantic and in superposition (more concepts than dimensions, smeared across many axes), and anisotropic (collapsed into a narrow cone that inflates raw cosine). Unsupervised disentanglement is provably impossible without an inductive bias (Locatello et al. 2019).

Sparse autoencoders supply that bias via a sparsity prior: an overcomplete dictionary that re-expresses each vector as a few active, auto-labeled latent concepts — now a frontier for retrieval and recommendation (RecSAE, CL-SR / “Decoding Dense Embeddings,” EMNLP 2025). The honesty caveats are real: latents can be dead or polysemantic, auto-generated labels can be plausible-but-wrong (FADE, 2025), and reconstruction is lossy — so the “interpretable view” isn’t the exact vector the retriever used. The discipline for any probe, concept vector, or SAE: ablate the direction and measure the actual retrieval-metric change. If recall doesn’t move, you were reading tea leaves.

04Explaining the heavy ranker: attribution that survives a permutation

The heavy ranker is where the consequential decisions and the worst opacity both live — rich cross-feature models — DLRM, DCNv2, DIN, and increasingly transformer “generative recommenders” — whose whole power is in learned feature crosses that no single input attribution captures. And here a subtlety trips up most teams:

Classification SHAP and LIME do not work out of the box on a ranker

Off-the-shelf SHAP/LIME assume a scalar output. A ranker outputs a permutation. “Feature importance” only means something once you define it against a ranking metric: how much a feature moved NDCG (a standard ranking-quality score), or the target item’s rank. That redefinition is exactly what the listwise variants do.

Feature attribution for rankers
MethodWhat it computesCost & where it runs
RankingSHAP faithfulShapley values with the value function redefined as ordered-list distance (Kendall’s Tau with vs. without a feature). The first faithful listwise attribution; ships its own faithfulness tests.Offline. Many model evaluations per item.
Rank-LIME faithful (local)LIME for ranked lists: perturb inputs, fit a surrogate against a differentiable ranking loss (ApproxNDCG).Offline. Many perturbed forward passes.
TreeSHAP tree-exactPolynomial-time Shapley values for GBDT / LambdaMART tabular rankers — exact for its path-dependent value function (not interventional SHAP).Cheap enough to run online.
Integrated Gradients baseline-sensitivePath integral of gradients from a baseline to the input; sums to the output.~20–300 backprops. No natural “zero” for embedding tables.
Permutation / LambdaMART λs near-freeShuffle a feature and measure NDCG drop; or read LambdaMART’s λs, which already encode ΔNDCG-weighted swap importance.Cheap baseline, often skipped.

Two caveats that separate a defensible attribution from a misleading one. First, importance lives in the crosses: a feature can show near-zero marginal attribution yet matter only through an interaction. So for cross-networks, the readable cross-weight matrices (DCNv2) and interaction-aware attribution (Shapley-Taylor / Faith-Shap) tell you more than any per-feature number. Second, multi-task heads mean there is no single explanation: a feature can lift predicted click-through while lowering predicted dwell-time before the scores are fused, so “the importance of feature X” is underspecified until you say importance for which objective. And pick your SHAP variant by what you can afford: TreeSHAP is exact and online-cheap for trees; KernelSHAP needs hundreds-to-thousands of passes per item and is offline-only.

05Attention is tempting, free, and not faithful

Transformer rankers come with attention weights, and it is tempting to point at them and say “the model looked here.” Resist. The landmark exchange — Jain & Wallace, “Attention is not Explanation” (NAACL 2019) vs. Wiegreffe & Pinter, “Attention is not not Explanation” (EMNLP 2019) — settled into a careful consensus: a single raw attention distribution is not a reliable faithful explanation, though attention isn’t useless either. You can construct entirely different attention maps that yield the same prediction.

Why it misleads in rankers specifically: by the upper layers every token is a residual-stream blend of all the others (cross-layer mixing); the few causal heads get washed out when you average across heads; and attention sinks ([CLS], [SEP], BOS) soak up weight while carrying little information. Attention rollout and flow aggregate across layers and correlate a bit better with real importance, but remain heuristics.

The faithful alternative is causal

The strongest method for transformer rankers isn’t reading activations — it’s intervening on them. Activation patching against term-frequency axioms (Chen, Lupart et al., SIGIR 2024) localizes where a neural retriever computes term-frequency — specific attention heads and the [CLS] token — by patching activations and watching the score move. It’s the most expensive method here and the only one that establishes a cause. You instrument the heavy reranker with it; you never bother on the cheap retrieval stage.

And kill one specific misconception: visualizing attention does not explain why document A outranked document B. Attention is per-token mixing inside one forward pass — it is not a contrastive, pairwise account of a ranking decision, which is the thing you actually care about.

06Explaining the LLM reranker: trust the logits (the model’s raw output scores), not the prose

At the tail, an LLM reranks the final shortlist. How it’s prompted determines what it exposes to explain:

The methods that are actually faithful read the model’s logits, not its sentences. FIRST (Reddy et al., EMNLP 2024) ranks from first-token identifier logits — roughly half the latency, and the logit distribution doubles as a calibratable confidence signal. In-Context Reranking (Chen, Gutiérrez & Su, ICLR 2025 — not, as often miscited, Zhuang et al.) scores documents from aggregated attention with a clever N/A-query calibration, zero-shot and >60% faster than RankGPT — though, true to §5, the authors flag attention-faithfulness as a caveat, not a guarantee.

The rationale trap, quantified

When an LLM tells you why it ranked something, treat that text as a press release, not a logbook. Turpin et al. (NeurIPS 2023): inject a bias (always make the answer “A”), and models follow it while their chain-of-thought never mentions it — accuracy dropped up to 36 points with the cause unstated. Anthropic (Chen et al., 2025): reasoning models verbalized a decisive hint only ~25–39% of the time; they exploited a reward hack in >99% of cases but admitted it in <2%; training to be faithful helped, then plateaued around 20–28%. Unfaithful explanations were often the longer, more convincing ones.

So the defensible recipe for an LLM reranker: pair a faithful score (first-token logits, PRP win-counts, setwise logit margins) with a counterfactual check — drop the evidence span the model cites and see if the ranking actually flips. If it doesn’t, the stated reason wasn’t causal. And watch the confounds: LLM rankers have strong position bias (perturb candidate order before trusting any result), sliding-window non-determinism, and are vulnerable to prompt injection — a passage can instruct the model to rank itself first — which is itself an argument for logit-based scoring over free-text output, and for open rerankers whose logits you can actually see.

07Natural-language rationales: post-hoc by architecture

A whole research line generates sentence explanations for recommendations — “recommended because it’s a cozy mystery like the ones you finish in a weekend.” Lovely for the user. But in systems like PETER, PEPLER, and P5, the text comes from a separate generation head fed user and item embeddings or a review corpus — decoupled from the actual ranking score. It can be fluent and feature-accurate yet have zero causal link to why item i beat item j — post-hoc not by sloppiness but by architecture.

And the metrics reward the wrong thing. These models are scored on BLEU/ROUGE and feature-mention rates — fluency and review-likeness, never causal fidelity. Higher feature coverage is not a more truthful explanation. The 2024–26 grounding work (XRec; attribution-conditioned generation) reduces hallucinated facts — real progress, but it doesn’t make the prose reflect the ranker’s internal scoring. Treat generated rationales as what they are: communication aids. A regulator’s “right to an explanation” needs an attribution-backed account, not a generated one.

08Counterfactuals, neighbors, and glass boxes

Attribution answers “what mattered?” Three other families answer different, often more useful, questions.

Counterfactuals answer “what minimal change would flip this rank?” (Wachter et al. 2017; ranking descendants CREDENCE, CfIR, RecRec). They’re actionable — but non-unique (many edits work), can land off-manifold (constrain them to real corpus documents), and double as a gaming recipe: an explanation of how to rank higher is also an SEO instruction manual.

Example-based explanations are the free, faithful lunch at retrieval: a two-tower score is a similarity, so “recommended because similar to X” is the literal mechanism, not a story. (The same sentence attached to a cross-encoder’s output would be post-hoc fiction.) For debugging the model rather than a query, training-data attribution (influence functions, TracIn, TRAK) points to the training examples behind a behavior — powerful, but offline and famously fragile for deep nets.

Or don’t bolt on an explainer — build a glass box

For structured ranking features, the interpretable-by-design route often costs little accuracy (Rudin, 2019). Explainable Boosting Machines (GA²M) are additive shape functions that are the model — exactly faithful and editable (they famously surfaced a dangerous asthma/pneumonia confound). Monotonic lattices give hard, certified guarantees (“more recent → never ranked lower”). Concept bottleneck models route the prediction through human-named concepts you can inspect and intervene on. The composition payoff: sparse/concept embeddings for transparent retrieval, then a glass-box ranker — and the whole pipeline is explainable, not just one stage.

Honest limits apply here too: lattices scale badly in jointly-interacting features, and concept bottlenecks leak (the concept activations smuggle extra information, so the bottleneck is less faithful than it looks). The recurring discipline: measure the “price” — usually small — rather than assume interpretability is free or that it costs you the leaderboard.

09Which stage actually failed? Why per-stage explanations don’t compose

This failure mode trips up even experienced teams. A good item didn’t show up. Why? There are two categorically different answers: it was never retrieved (a recall failure — irreversible; no downstream ranker can resurrect an item it never received), or it was retrieved and then down-ranked or pruned. These need opposite fixes, and most production explainers silently conflate them.

In plain terms: multi-stage blame is a relay race. If the baton is dropped on the first leg, it doesn’t matter how fast the anchor runs. Asking “why did we finish last?” while staring only at the runner you can see — the final ranker — is the classic debugging mistake.

The faithful diagnostic is stage-of-loss tracing: log the gold item’s rank and survival at every cut — retrieval top-K, ranker top-k, rerank top-n. The earliest stage that drops it below its cut is the culprit. (And split “down-ranked” further: scored low by the ranker is a feature problem RankingSHAP can address; scored fine but pruned by an aggressive top-k is a budget problem invisible to any feature attribution — you see it only in the logs. A glorious recall@1000 means nothing if the rerank cut is top-10 and your item sits at 600.)

For a causal end-to-end answer, only one method delivers: counterfactual stage ablation — replace a stage with an oracle (inject the gold document to isolate ranker fault) or an identity (skip the reranker to measure its contribution) and read the metric delta. It costs a pipeline re-run per counterfactual, but it’s the only thing that cuts through. Per-stage explanations are locally faithful, not end-to-end faithful, because each stage conditions on the previous stage’s output. A pristine RankingSHAP explanation of the reranker says nothing about whether retrieval ever surfaced the item.

Go deeper: the RAG corollary — cited is not the same as used

RAG inherits all of this and adds a twist: was the retrieved passage actually used, or did the model answer from parametric memory and cite the passage afterward? “Correctness is not Faithfulness in RAG Attributions” (Hagström et al. 2024) found up to ~57% of citations are post-rationalized rather than causal. Model-internal attribution (MIRAGE) separates “retrieved and used” from “retrieved and ignored.” The inline citation — the dominant shipped “explanation” for LLM systems — is a plausibility surface, not a faithfulness guarantee. The most common debugging mistake everywhere in this section: blaming the last visible stage for a failure that happened upstream.

10What ships, what regulators want, and a playbook

What production actually ships is rarely a faithful rendering of the deep ranker. “Why am I seeing this post” (Meta), “recommended because you bought X” (Amazon), “Because you watched” (Netflix) are precomputed signal- and source-surfacing. They’re faithful-by-construction at retrieval — they name the candidate generator — and that’s exactly why they stop there. Real SHAP/IG/counterfactual attribution is too costly per request for the heavy ranker. So it lives in offline debugging dashboards and slice-based monitoring, never the serving path.

What regulators want differs from what engineers want, and conflating the two causes grief. Engineers want local, faithful attribution for one decision. Regulation pulls toward global, parameter-level transparency:

The regulatory surface (as of 2026)
InstrumentWhat it demands
GDPR Art. 22 + 13–15“Meaningful information about the logic” of solely-automated decisions. The CJEU SCHUFA ruling (C-634/21, 2023) confirmed credit-style profiling counts.
EU DSA Art. 27 / 38Plain-language “main parameters” of recommender systems and their relative importance; very large platforms must offer a non-profiling option.
EU AI ActTransparency and documentation obligations phasing in 2025–27; ranking systems in hiring, credit, and similar contexts face the stiffer high-risk duties.
P2B / OmnibusSearch-ranking parameter disclosure for marketplaces, with fines up to 4% of turnover.

Note the tension baked in: full parameter disclosure invites SEO spam and leaks IP, so “more transparency” is not monotonically good. And a token human reviewer does not exempt you — rubber-stamp review still counts as “solely automated.”

The playbook — pick by stage
StageReach forDon’t ship as an audit trail
RetrievalSPLADE / ColBERT structural readouts; ANN-neighbor provenance; SAEs for exploration.Raw embedding-axis readings.
Heavy rankerRankingSHAP / Rank-LIME offline; TreeSHAP online for GBDT; DCNv2 cross-weights; permutation baseline.Raw attention; uncalibrated saliency.
LLM rerankFaithful logit signals (FIRST / PRP / setwise) + a counterfactual span ablation; perturb order.The model’s free-text rationale.
Whole funnelStage-of-loss logging always; counterfactual stage ablation for causal blame.A clean single-stage explanation as the whole story.

One honest counterweight, lest “plausible ≠ faithful” become dogma: sometimes plausibility is the right objective. A user-facing “because you watched” exists to help someone decide whether to click, not to pass an audit — usefulness and trust are the correct yardsticks there. The discipline isn’t “always demand faithfulness.” It’s knowing which you need: a faithful account for the engineer debugging a drop and the regulator auditing for bias, a plausible-and-helpful one for the person scrolling. The error is shipping the second where you owed the first.

The takeaway

“Why did you rank that?” has no single answer because the system is no single model. It’s a funnel, and each stage hands you a different thing to explain: a similarity, a feature vector, a permutation, a paragraph. Match the method to the stage — structural readouts at retrieval, listwise attribution at the ranker, faithful logits at the LLM, stage-of-loss tracing across the whole pipeline.

And hold one line through all of it. A plausible explanation is not a faithful one. Attention isn’t explanation, a generated rationale isn’t a cause, and a clean per-stage story isn’t an end-to-end answer. The faithful methods — structural decompositions, RankingSHAP, activation patching, counterfactual ablation — are either architecturally constrained or expensive. The cheap, readable ones — attention maps, written rationales — are the ones you must never hand to an auditor. Measure faithfulness. Don’t read it off the prose.

How this was made: assembled by a multi-agent research pass — 16 agents across distinct facets (the funnel, each stage’s methods, faithfulness evaluation, regulation), then a fact-checking stage that verified the quantitative and citation-heavy claims and corrected six attributions (e.g. In-Context Reranking is Chen, Gutiérrez & Su, ICLR 2025, not Zhuang et al.; pre-ranking consistency is Gu et al., 2022). Numbers tied to a paper come from that paper; quantified faithfulness results (Turpin; Anthropic) are setup-specific and have not been measured on ranking rationales specifically.

SM
Sugeerth MurugesanStaff ML Engineer / Scientist · LLM & Recommendation Systems