BM25 (Best Matching 25) is a ranking function used for information retrieval that scores documents based on term frequency and document length. It's a probabilistic model that improves upon TF-IDF by handling term saturation and document length normalization more effectively.
In RAG systems, BM25 is often used as a keyword-based retrieval method, complementing dense vector (semantic) search for hybrid retrieval approaches.