Encyclopedia · 187 concepts

NLP & Language · beginner · concept 78 of 187

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.

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