Encyclopedia · 311 concepts
Learn this concept as a feed

NLP & Language · beginner · concept 113 of 311 · Updated Nov 4, 2026

Bag-of-Words & TF-IDF

The pre-neural way to turn text into numbers: count the words, weight the rare ones higher (TF-IDF), ignore the order. Crude and still load-bearing, since BM25, its direct descendant, powers the sparse half of hybrid retrieval in modern RAG stacks and remains the search baseline to beat.

L5 · Machine learning practitionerDevelopersTech leadersQA and testing

Key terms

Term frequencyTF-IDFBM25Sparse vectorsN-grams

Learn these first

Where you meet it in the real world

Search engines, the sparse side of hybrid RAG retrieval, quick text classifiers, deduplication

Videos

▶ What is Bag of Words? ↗

IBM Technology · YouTube

Guides and articles