RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Eruo Fredoline
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
Glossary / Large language models / BM25 (Best Matching 25)
Large language models

BM25 (Best Matching 25)

BM25 is the canonical sparse-retrieval algorithm: a TF-IDF variant that saturates term frequency (a token appearing 100 times isn't 100× more relevant than once) and normalizes by document length. Default scorer in Lucene, Elasticsearch, OpenSearch, and Tantivy.

BM25 is decades old, requires no training, and runs on any corpus with a tokenizer. For exact-match and rare-vocabulary queries it often beats much-fancier neural retrievers; that's why hybrid retrieval keeps it.

Tunable knobs: k1 (term frequency saturation, typically 1.2–2.0) and b (length normalization, 0.75 default). Domain tuning rarely helps beyond defaults for general corpora.

Practical example

An operator setting up local search over API documentation notices that queries for exact parameter names like max_tokens or top_p return poor results from their dense embedding index, so they add an Elasticsearch BM25 index alongside it as part of a hybrid retrieval setup. Because BM25 needs no training and no GPU, it's trivial to stand up locally — index the docs, and queries run in milliseconds on CPU. They leave k1 and b at Elasticsearch's defaults (1.2 and 0.75) since tuning rarely moves the needle for a general documentation corpus, and instead spend the effort on chunking strategy, which has a much bigger effect on BM25 recall than parameter tuning does.

Related terms

Sparse RetrievalHybrid Retrieval

Reviewed by Eruo Fredoline. See our editorial policy.

Buyer guides
  • Best GPU for local AI →
  • Best laptop for local AI →
  • Best Mac for local AI →
When it doesn't work
  • CUDA out of memory →
  • Ollama running slowly →
  • ROCm not detected →