The fundamental challenge in text analysis is transforming discrete linguistic tokens into numerical vectors that capture semantic relationships.
Sparse representations rely on exact keyword matches.
Pros: Extremely fast, mathematically interpretable, excellent for domain-specific jargon. Cons: Fails on synonyms (the "Lexical Gap"). A query for "puppy" will not find a document containing "dog."
Dense representations (e.g., BERT, Ada-002) map text into a continuous high-dimensional vector space (\mathbb{R}^d).
Pros: Handles semantic similarity, polysemy, and multilingual search. Cons: Computationally expensive (requires GPUs), prone to "hallucinating" relevance on irrelevant exact matches.
The current state-of-the-art in information retrieval is Hybrid Search: combining sparse (lexical) and dense (semantic) results to get the best of both worlds.
Reciprocal Rank Fusion (RRF) is a standard way to merge the ranked lists from two disparate scoring systems without needing to normalize their raw scores.
The RRF score for a document d is calculated as:
{BM25, Dense}).Why RRF works: It rewards documents that appear consistently high in both lists, while penalizing those that only appear at the bottom of one. It is robust to outliers and requires zero parameter tuning compared to weighted sums.