Learn about AI >

From Words to Vectors — How Meaning Becomes Math

Different granularities of language require different embedding approaches. Word embeddings capture individual term meaning, sentence embeddings capture the meaning of a full thought, and document embeddings capture the meaning of longer content. The choice between them reflects the nature of the task being solved.

Once you understand what embeddings are, the next question is which kind to use. The answer depends almost entirely on what unit of meaning matters for your task.

Word embeddings are the foundational version. Each word gets a vector, and that vector captures the word's meaning in relation to every other word the model has seen. They work well when the task is about individual terms: keyword matching, vocabulary analysis, finding synonyms. The limitation is that words change meaning in context. "Bank" means something different in "river bank" and "investment bank," but a word embedding gives it a single fixed vector regardless.

Sentence embeddings solve that. Instead of embedding individual words, you embed the whole sentence as a single vector that captures the meaning of the complete thought, in context. This is what makes semantic search work: you can find documents that mean the same thing as a query even if they don't share any of the same words. Sentence transformers are the architecture most commonly used to produce them.

Document embeddings extend the same idea to longer content: an entire article, a contract, a research paper gets compressed into a single vector representing its overall meaning. These are useful when you want to compare or cluster documents at a high level rather than search within them.

Feature embeddings are a more general version of the concept, applied to structured data rather than language. A product, a user, a transaction can each be embedded as a vector, capturing its relationships to other items in the same space. Recommendation systems rely heavily on this.

The other dimension that matters is density. Dense vectors pack meaning into a compact numerical representation where most values are non-zero. Sparse vectors represent meaning through a large number of mostly-zero values, where each dimension corresponds to something specific and interpretable. Dense vectors are better for semantic similarity; sparse vectors are better for exact keyword matching. Many production systems use both, combining them to get the benefits of each.

The choice of embedding type isn't a technical detail to leave to engineers. It reflects a genuine decision about what kind of meaning you're trying to capture.