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 / Sparse Retrieval
Large language models

Sparse Retrieval

Sparse retrieval scores documents by lexical overlap with the query — high-dimensional vectors where most entries are zero. BM25 is the canonical algorithm; TF-IDF, Lucene-style scoring, and SPLADE (learned sparse) are variants.

Sparse retrieval excels at exact-match queries (product codes, function names, rare terminology) where dense embeddings often miss. It's also faster to update incrementally and easier to interpret — every match has an explainable token overlap.

For RAG, sparse-only retrieval underperforms hybrid on most benchmarks but stays competitive on technical / code corpora where vocabulary is unique.

Practical example

An engineer building search over a local codebase index finds that dense embeddings consistently fail to retrieve the right file when a user searches for an exact function name like parse_config_v2 — the embedding model treats it as a generic "parsing" concept and returns semantically similar but wrong results. Switching that query path to sparse retrieval (BM25 over tokenized identifiers) fixes it immediately, since the query and the correct chunk share an exact rare token. This is the standard reason code-search tools and log-search tools default to sparse or hybrid: identifiers, error codes, and stack traces are exactly the vocabulary where dense retrieval embeddings are weakest, because rare tokens are undertrained relative to common words.

Related terms

Dense RetrievalHybrid RetrievalBM25 (Best Matching 25)

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 →