Back to AI Glossary
RAG & Knowledge Systems

What is BM25?

BM25 (Best Matching 25) is a ranking function that scores documents based on term frequency and inverse document frequency with saturation, representing state-of-the-art sparse retrieval. BM25 remains competitive baseline for keyword-based search.

This RAG and knowledge systems term is currently being developed. Detailed content covering implementation approaches, best practices, technical considerations, and evaluation methods will be added soon. For immediate guidance on RAG implementation, contact Pertama Partners for advisory services.

Why It Matters for Business

BM25 provides fast, interpretable keyword search that outperforms vector-only retrieval for queries containing specific product names, part numbers, or technical terminology. This proven algorithm runs efficiently on standard hardware without GPU requirements, making it ideal for mid-market companies managing retrieval costs. Hybrid architectures combining BM25 with semantic search improve retrieval accuracy by 15-25% compared to either approach deployed independently.

Key Considerations
  • Probabilistic ranking function for keyword search.
  • Considers term frequency with diminishing returns (saturation).
  • Weights rare terms higher (IDF).
  • Fast retrieval via inverted indexes.
  • Strong baseline despite age (1990s).
  • Often combined with dense retrieval for hybrid search.
  • Implement BM25 as your baseline retrieval method before adding vector search, establishing measurable performance benchmarks against which semantic approaches must improve.
  • Tune the k1 saturation parameter between 1.2 and 2.0 based on your document collection's average length and vocabulary distribution characteristics.
  • Combine BM25 keyword matching with dense vector retrieval in hybrid search configurations to capture both exact terminology and conceptual similarity effectively.
  • Calibrate saturation parameter k1 between 1.2 and 2.0 and document length normalization parameter b around 0.75 using relevance judgments from your domain-specific evaluation corpus.

Common Questions

When should we use RAG vs. fine-tuning?

Use RAG for knowledge that changes frequently, needs citations, or is too large for context windows. Fine-tune for style, format, or behavior changes. Many production systems combine both approaches.

What are the main RAG implementation challenges?

Retrieval quality (finding right documents), chunking strategy (preserving context while fitting budgets), and evaluation (measuring end-to-end system performance). Each requires careful tuning for specific use cases.

More Questions

Evaluate retrieval quality (precision/recall), generation faithfulness (answer supported by context), answer relevance (addresses question), and end-to-end accuracy. Use frameworks like RAGAS for systematic evaluation.

References

  1. NIST Artificial Intelligence Risk Management Framework (AI RMF 1.0). National Institute of Standards and Technology (NIST) (2023). View source
  2. Stanford HAI AI Index Report 2025. Stanford Institute for Human-Centered AI (2025). View source

Need help implementing BM25?

Pertama Partners helps businesses across Southeast Asia adopt AI strategically. Let's discuss how bm25 fits into your AI roadmap.