Skip to content

TF-IDF

A classical measure of word importance for a document: a word is valuable if it frequently appears in this text but rarely in others.

What It Consists Of

  • TF (Term Frequency) — how often a word appears in the document;
  • IDF (Inverse Document Frequency) — how rare a word is across the entire collection.

The result is the product: TF × IDF. The higher the value, the more 'characteristic' the word is for a specific text.

Why It Is Needed

TF-IDF transforms text into a numerical vector: each word gets a weight. Then vectors are compared using the cosine measure to find similar documents. This is the foundation of classical search, which now coexists with embeddings.

Difference from Embeddings

TF-IDF Embedding
Meaning Word statistics Semantics
Synonyms Does not understand Understands
Speed Very fast Slower
Training Not needed Model needed

See Also

← All Terms