RAG
BM25
BM25 is a sparse ranking function based on term frequency, document frequency, and length normalization.
How it works
It rewards query terms that are frequent in a document but rare across the collection. Saturation prevents repeated terms from increasing score without bound.
A concrete example
Illustrative: a rare term appearing 3 times contributes more than a common term appearing 3 times.
Do not confuse it with TF-IDF
BM25 adds term saturation and tunable document-length normalization.