Quant Memo
Core

Hybrid Retrieval: BM25 Plus Embeddings

Why the best retrieval systems over financial documents combine old-fashioned keyword search with modern embedding search, instead of picking one — each one covers the other's blind spot.

Prerequisites: Vector Databases and Embedding Search, Bag of Words and TF-IDF

Ask a retrieval system to find passages mentioning "CUSIP 037833100" and a pure embedding search can fail badly — embeddings are trained to capture meaning, and a specific alphanumeric identifier has no meaning to embed, only an exact string to match. Ask the same system to find passages about "concerns over rising input costs" and a pure keyword search can also fail, because the actual filing might say "margin pressure from higher raw material prices" without ever using the word "concerns" or "input costs." Each retrieval method is excellent exactly where the other is weak, which is why production systems over financial text run both and combine the results rather than choosing one.

Two different notions of "match"

BM25 (a refinement of TF-IDF) scores a passage by how often the query's exact keywords appear in it, discounted for how common each keyword is across the whole corpus and for how long the passage is. It's fast, needs no training, and is extremely good at exact and rare-term matches — ticker symbols, CUSIPs, specific dollar figures, proper nouns — precisely the terms an embedding model tends to blur together with similar-sounding alternatives.

Embedding search represents both the query and each passage as vectors and ranks passages by vector similarity (typically cosine similarity). It captures semantic closeness even when no words overlap at all, which is exactly what BM25 cannot do, but it can miss a passage that uses an unusual specific term the embedding model wasn't trained to distinguish finely.

Hybrid retrieval runs both scorers over the same candidate passages and combines the two rankings — often with a weighted sum of normalized scores, or a rank-fusion method like reciprocal rank fusion — so a passage that scores well on either axis has a good chance of surfacing near the top.

Worked example: combining two rankings with reciprocal rank fusion

Suppose a query returns these top-3 rankings from each method over the same corpus of five passages (A–E):

RankBM25Embeddings
1CA
2AB
3DC

Reciprocal rank fusion scores each passage by 1k+rank\sum \frac{1}{k + \text{rank}} across the lists it appears in, using a small constant k=60k=60 to soften the effect of rank position. Passage A: appears at BM25 rank 2 and embedding rank 1, so its score is 160+2+160+1=162+1610.0325\frac{1}{60+2} + \frac{1}{60+1} = \frac{1}{62} + \frac{1}{61} \approx 0.0325. Passage C: appears at BM25 rank 1 and embedding rank 3, giving 161+1630.0323\frac{1}{61} + \frac{1}{63} \approx 0.0323. Passage B appears only in embeddings at rank 2: 1620.0161\frac{1}{62} \approx 0.0161. A and C — the two passages both methods agree are relevant, even from different angles — end up ranked above B, which only one method liked. This is the core benefit of fusion: agreement across two different notions of relevance is a stronger signal than a high score from either alone.

BM25 exact terms CUSIPs, tickers Embeddings paraphrase, synonyms both agree: strongest signal
BM25 and embedding search each catch relevant passages the other misses; hybrid retrieval keeps both and rewards agreement.

What this means in practice

Financial retrieval is a domain unusually rich in both exact identifiers (tickers, CUSIPs, dates, dollar figures) and paraphrased language (analysts and management describing the same event differently), which is why hybrid retrieval tends to outperform either method alone by a wide margin on financial corpora specifically. The extra cost is running two retrieval systems and a fusion step instead of one, which is a modest engineering overhead against the retrieval-quality gain, especially before a reranker gets a final pass at the candidates.

BM25 excels at exact keyword and identifier matches; embedding search excels at semantic matches with no word overlap. Hybrid retrieval runs both and fuses the rankings, because in financial text — full of CUSIPs, tickers, and paraphrased commentary — each method alone misses a meaningful share of what's relevant.

Related concepts

Practice in interviews

Further reading

  • Robertson and Zaragoza, The Probabilistic Relevance Framework: BM25 and Beyond
ShareTwitterLinkedIn