Capstone: The Mathematics of a Production Multimodal Financial RAG System
The retrieval stack arrived as a dozen separate topics — lexical scoring, dense MIPS, IVF and PQ and HNSW, late interaction served by PLAID, reciprocal-rank fusion; this capstone composes the published stack into one finance pipeline and proves the three laws that govern it end to end — cascade recall multiplies across stages, hybrid fusion gains exactly when its legs de-correlate, and a fixed compute budget is allocated across heterogeneous per-modality legs by water-filling — with the single exact statement that a full-budget pipeline recovers brute-force retrieval, and everything above it a heuristic speed-for-recall trade measured honestly on a finance frontier
Overview & motivation
Every prior topic in this series built one organ of a retriever. The probabilistic-IR track built the lexical leg; the dense dual encoder and late interaction built the neural legs; IVF, product quantization, and HNSW built the index; PLAID served late interaction at scale; reciprocal-rank fusion combined heterogeneous rankings; the over-fetch laws priced the cost of recall. A production multimodal financial RAG system is what you get when these organs are wired into one body, and the wiring has mathematics of its own — not a new primitive, but the composition of the ones already built.
This capstone proves the three laws that govern the composed pipeline. They are deliberately honest about their status: one is an exact theorem, the rest are measured propositions, and the difference is the whole point. We have built the retrieval half of the stack; the generation, grounding, and evaluation layer above it — pointwise mutual information between query and answer, conformal factuality, determinantal context selection, GraphRAG, retrieval distillation — is the unbuilt upper curriculum, named here but not yet derived. What we can compose now is everything from ingest through rerank, and that is enough to see the system as a single object.
End-to-end retention is the product of the per-stage retentions (1.00 · 0.92 · 0.92 = 0.851), and to deliver k survivors the front end over-fetches by 1/∏rᵢ ≈ 1.18×. That product is exact only under independent per-stage survival; under the positive dependence real queries exhibit, FKG/Harris makes it a conservative lower bound — drag ρ above 0 and the true recall lifts above the dashed product line, below 0 it falls under it, with equality at ρ = 0. The measured pipeline (recall 0.9225) sits above its product 0.851, as the bound predicts.
Notation: the served pipeline and one shared truth
A query enters a pipeline of stages — candidate generation, fusion and pruning, rerank — each a lossy map that keeps some documents and discards others. The exact end-scorer is brute-force MaxSim, , and its top- defines the ground truth: the true neighbors of are the documents that the full, uncompressed scorer would return. This choice matters. Because the truth is the exact scorer and not any one cheap leg, no candidate-generation leg is privileged — the oracle is the act of reranking everything, not any single retriever — which is exactly what lets the legs genuinely complement and lets a full-budget pipeline reach recall .
The corpus is one shared multi-view document set. Each document is a bag of unit-norm token vectors (the token view), seen three ways: a lexical leg matches a window of the tokens’ quantized centroid identifiers (BM25 over a centroid vocabulary), a dense leg pools a disjoint window into a single vector (cosine MIPS), and a late-interaction leg scores a third window by cheap centroid-MaxSim. Three partial views of one document — the systems-level shape of multimodality, where a text leg, a transcript leg, and a chart leg each observe part of a filing and fusion recombines them. The cross-modal alignment that would map them into one joint embedding is a separate, future topic; here the legs are independent retrievers feeding fusion.
Movement 1 — cascade recall composition
Fix a query and one true top- neighbor . Let be the event that survives stage given it entered, and the stage’s per-neighbor retention. The neighbor reaches the output exactly when it survives every stage.
Definition 1 (The served cascade and its retentions).
The pipeline is the composition of filters. Stage generates candidates (a token-IVF probe), fuses the legs and prunes to a survivor set, and reranks the survivors by exact MaxSim. A true neighbor is recalled iff it lies in the final top-; its end-to-end retention is , and the per-stage retentions are measured against the shared MaxSim truth.
The first law is the one every engineer half-knows and half-misstates.
Theorem 1 (The product law and its over-fetch (exact under independence)).
If the survival events are mutually independent, then end-to-end retention is the product
exactly, and to leave surviving true neighbors the front end must inject of them in expectation. This over-fetch is a single negative-binomial law (the imported scan law of the filtered-ANN topic) applied to the composite retention ; the equality is algebraic, not a multiplication of separate physical scan counts, because the intermediate stages are not independently re-ranked streams.
On the measured pipeline the three retentions are , , — candidate generation loses nothing at this breadth, fusion and rerank each drop a little — so the product is and the over-fetch a modest . But the product law is exact only under an idealization, the same positional-independence assumption the over-fetch topic flagged for a single stage, now lifted to the whole pipeline. Real queries violate it, and the direction in which they violate it is the load-bearing claim.
Proposition 1 (Positive dependence makes the product a lower bound (FKG/Harris)).
If the survival events are positively associated — each an increasing event in a shared query-easiness latent, so that a query easy for one stage is easy for all — then
with equality at independence; negative association reverses the inequality. Under the positive dependence real pipelines exhibit, the independent product under-states true recall — it is a conservative lower bound — and provisioning the front end at over-provisions, which is the safe direction.
The temptation is to guess the wrong sign: surely correlated failures lose more? They do not. Positive correlation piles the failures onto the same hard queries, which fail anyway, so fewer distinct documents are lost than independence predicts and true recall sits above the product. The argument is FKG/Harris — increasing events on a positively-associated law have — but because the intuition is so easy to invert, the notebook does not trust it: it generates dependence with a bivariate-normal survival copula and sweeps the correlation across both signs. The gap runs from at strong negative dependence through at independence to at strong positive dependence, monotone, with equality pinned at — the first panel makes the slider live. The measured pipeline obliges: its realized recall, , sits above its own product, , exactly as a lower bound should.
Movement 2 — hybrid fusion gain
The pipeline’s middle stage fuses heterogeneous legs. Fix a query with true-relevant set at depth , let be the relevant documents leg surfaces, and its recall. The fused ranking is with , reciprocal-rank fusion imported verbatim. The question is when fusing helps, and the honest answer is a condition, not a guarantee.
Proposition 2 (The coverage ceiling (exact upper bound)).
For any fusion rule emitting a list of depth at least ,
since a relevant document no leg places in range cannot be retrieved. Disjoint coverage maximizes the ceiling. But the ceiling is vacuous — equal to — whenever a single leg already covers , so it bounds the gain from above and does not explain the failure below.
Proposition 3 (Fused ≥ best leg is false; the flip needs co-endorsement).
There exist legs for which . Under a single top-rank vote contributes , weaker than two mid-rank votes at , so a false positive overtakes a true neighbor only when it is co-endorsed by both legs. Concretely, a strong leg ranking first but also placing a false positive at rank , fused with a noisy leg ranking on top and burying , yields a fused top- of : recall . Remove from the strong leg — no co-endorsement — and survives, recall back to .
This is the topic’s headline-flip discipline made literal. The naive expectation — a noisy leg drowns out a good one — is right in spirit and wrong in mechanism, and the notebook builds and runs the counterexample before the prose is allowed to claim anything. A lone loud vote is not enough under RRF’s near-uniform weights; it takes a conspiracy of two. The second panel reconstructs the RRF scores live and shows falling past the top- cut.
What survives the scrutiny is the conditional gain.
Proposition 4 (The fusion gain under complementarity (demonstrated)).
On the multimodal finance corpus, where each leg observes a different partial view and so recalls true neighbors the others miss, the fused recall strictly exceeds the best single leg, (a gain of ), and the gain grows with leg de-correlation: from at a cloned, redundant leg to at disjoint coverage. Inter-leg Kendall- is a proxy for that coverage disjointness — neither necessary nor sufficient on its own — and the gain is one cloud’s number, not a universal ranking.
The complementarity is not incidental; it is engineered and it is the real multimodal story. When the three legs were three approximations of one scalar truth, they formed a quality ladder — each strictly better than the last — and no fusion could beat the best, because the worse legs added only noise. Making each leg a partial view of the document, blind to what the others see, is what gives fusion something to recombine. That is precisely the value a lexical leg adds over a dense one in a real financial retriever: it surfaces the exact tokens — tickers, line-item names, dollar figures — that a paraphrase-trained embedding smears, documents the dense leg never had.
Movement 3 — end-to-end budget allocation
The whole pipeline runs on a budget. Each stage buys retention by spending compute , and the costs must share a unit — distance-computations per query — or a single budget is meaningless. A sparse lexical match touches a few centroid-id terms; a dense leg is one pooled dot product; late-interaction MaxSim scores every query token against every document token, an order of magnitude more per document. The system-design question is how to spend a fixed budget across these unequal stages.
Theorem 2 (Water-filling: equalize the marginal log-recall).
Model end-to-end recall by the separable product and maximize it subject to . Because and monotone, , a separable objective; if each is concave the Lagrangian is concave, so any stationary point is the global maximum, and at every active stage
the marginal log-recall equalized across stages — water-filling — with on inactive stages and fixed by the active-budget identity.
Two honesties belong with this theorem. First, the equal-marginal condition is not bought by the logarithm. The un-logged product has , and the common scalar cancels, so falls out of the product directly; what the log buys is separability — decoupling the stationarity equations — and, with concavity, a global optimum. Second, the separable model is the Movement-1 object: measured stage-by-stage against the global truth and multiplied, it is a conservative lower bound on the true coupled-pipeline recall, which unions the legs and does at least as well. We optimize the bound, honestly labeled.
Proposition 5 (Water-filling beats uniform and all-in-one (demonstrated); the anchor).
On the finance curves at the demo budget, water-filling reaches — scanning the cheap lexical and dense legs deep and the expensive late-interaction leg shallow, with the marginal log-recall leveled across stages — against for naive uniform splitting and a mere for pouring the budget into any single leg, where a starved factor tanks the product. Concavity holds on the measured operating grid (verified, not assumed), and at full budget every , so : the collapse anchor.
That anchor is the one exact statement of the entire capstone. Probe every cell, prune nothing, rerank by exact MaxSim, and the pipeline is brute-force retrieval — recall , the same probe-all/prune-nothing collapse the PLAID topic proved for its cascade, here for the whole stack. Everything above it — the product law, the fusion gain, the water-filling allocation — is a heuristic speed-for-recall trade we measure rather than guarantee.
Finance case study
Honest accounting
Connections
- the served late-interaction leg and the collapse-anchor pattern this capstone generalizes: PLAID's probe-all/prune-nothing/exact-rerank recovers brute MaxSim, and the capstone's full-budget pipeline recovers brute-force retrieval the same way; the exact MaxSim of that topic is the neutral end-scorer the whole pipeline approximates and reranks toward multi-vector-ann-retrieval
- the fusion engine, lifted from two legs to the multimodal multi-leg case: RRF's rank-only scale-invariant score is imported verbatim, and that topic's Kendall-tau geometry is the de-correlation axis along which the fusion gain is measured; the capstone adds the multimodal complementarity story and the co-endorsed dominated-leg flip rank-fusion-rrf
- the over-fetch k/r negative-binomial law is the per-stage spine the cascade composes: end-to-end the front-end over-fetch is 1/∏rᵢ, one negative-binomial law on the composite retention, and that topic's positional-independence caveat is lifted from one stage to the whole pipeline filtered-incremental-ann
- the graph ANN leg, the other answer to the candidate-generation problem the cascade's first stage solves; its navigability and the recall-versus-distance-computations cost model feed the same budget the water-filling allocates hnsw
- the compression/storage accounting behind the served index's footprint: the centroid-id-plus-residual representation collapses the raw multi-vector store, the storage panel's 32x-to-1x story, and prices the per-leg index the budget movement allocates over optimized-product-quantization
References & Further Reading
- paper Reciprocal Rank Fusion Outperforms Condorcet and Individual Rank Learning Methods — Cormack, Clarke & Buettcher (2009) The fusion rule the capstone imports and lifts to the multimodal multi-leg case: RRF(d) = Σ 1/(c + rₗ(d)), depending only on ranks, hence scale-invariant; SIGIR 2009
- paper A Cascade Ranking Model for Efficient Ranked Retrieval — Wang, Lin & Metzler (2011) The cascade-ranking model this movement formalizes: a sequence of increasingly expensive stages, each pruning candidates for the next, with the end-to-end recall and cost the composition of the per-stage trade-offs; SIGIR 2011
- paper PLAID: An Efficient Engine for Late Interaction Retrieval — Santhanam, Khattab, Potts & Zaharia (2022) The served late-interaction leg of the pipeline: the centroid-pruning, residual-decompression cascade over a token IVFADC index whose recall-versus-cost the budget movement allocates; CIKM 2022
- paper ColBERTv2: Effective and Efficient Retrieval via Lightweight Late Interaction — Santhanam, Khattab, Saad-Falcon, Potts & Zaharia (2022) The centroid-plus-residual token compression behind the storage panel's 32x-to-1x collapse; NAACL 2022
- paper Product Quantization for Nearest Neighbor Search — Jégou, Douze & Schmid (2011) IVFADC — the coarse k-means quantizer with inverted lists and product-quantized residuals — the index every candidate-generation leg is built on; IEEE TPAMI 2011
- documentation Pyserini: A Python Toolkit for Reproducible Information Retrieval Research with Sparse and Dense Representations — Lin, Ma, Lin, Yang, Pradeep & Nogueira (2021) The reference system for the hybrid lexical-plus-dense retrieval the fusion movement formalizes — a production reproducibility toolkit that fuses sparse and dense legs; SIGIR 2021