← Back to list

Embeddings in NLP: Turning Numbers into Understanding

Have you ever wondered how AI can tell that ‘king’ and ‘queen’ are related? Or why it can suggest similar words, complete your sentences…

Amit Jaiswar · 2025-07-20 10:38 · 0 claps · 2.6 min read
#naturallanguageprocessing #word-embeddings #ai-language-model #ai-language-understanding #word-to-vector
Open on Medium ↗
Wiki topics: RAG · RAG & Retrieval GEN · Genomics & Sequencing

Embeddings in NLP: Turning Numbers into Understanding

Have you ever wondered how AI can tell that ‘king’ and ‘queen’ are related? Or why it can suggest similar words, complete your sentences, or even detect the emotion in a tweet?

The secret lies in a powerful technique called word embeddings.

Previously, we saw how basic vectorization turns words into numbers. But those techniques had limitations: they didn’t truly understand the meaning of words, how words relate to one another, or how they change based on context. That’s where word embeddings come in. They help computers move beyond counting words and start learning what words mean.

What Are Word Embeddings?

A word embedding is a list of numbers (called a vector) that captures what a word means, based on how it is used in real text. These vectors are not just arbitrary numbers — they reflect actual relationships between words. Words that appear in similar situations will have similar vectors.

These vectors are dense, meaning they are compact and contain real-valued numbers, unlike long, sparse vectors with mostly 0s.

For example:

king   → [0.23, 0.11, 0.87, ...]
queen  → [0.22, 0.09, 0.88, ...]
banana → [0.01, 0.44, 0.13, ...]

Here, ‘king and ‘queen’ are closer in vector space (meaning they’re semantically related), while ‘banana’ is far away — it’s unrelated in meaning. This shows that the model understands something about the meaning and relationships between these words.

How Do Embeddings Work?

The idea behind word embeddings comes from a simple rule:

“Words that occur in similar situations tend to have similar meanings.”

For example, the word ‘bank’ might frequently appear near words like ‘money,’ ‘loan,’ and ‘account.’ Another word like ‘hospital’ might appear near ‘doctor, ‘nurse,’ or ‘patient.’

By scanning millions of sentences, the model learns which words tend to appear together and builds vector representations based on that.

There are two common ways that AI learns these word meanings:

  • CBOW (Continuous Bag of Words): The model tries to guess a word based on the words around it.
  • Skip-Gram: It tries to guess nearby words based on one central word.

These approaches help the model gradually learn which words tend to appear together, and what kinds of meanings they share.

Popular Word Embedding Models

Here are some well-known tools that generate word embeddings:

1. Word2Vec (by Google)

  • Learns from large text corpora
  • Uses CBOW or Skip-Gram architecture
  • Captures both semantic and syntactic relationships

2. GloVe (by Stanford)

  • Based on global word co-occurrence statistics
  • Builds a matrix of how frequently words appear together
  • Creates vectors that reflect these patterns

3. FastText (by Facebook)

  • Breaks words into character n-grams (subwords)
  • Allows the model to understand misspellings and rare/new words
  • Especially useful for morphologically rich languages

Visualizing Word Embeddings

Embeddings can be visualized in a way that highlights how words relate not just in meaning but in direction and distance.

       king       queen
         ● -------- ●


          ● -------- ●  
      man           woman

                                           ● banana (away)

This shows:

  • “Man” → “King” and “Woman” → “Queen” have similar vector directions
  • Equal distance reflects similar relationships (e.g., like gendered pairs).
  • “Banana” is distant — it’s not semantically connected

This kind of structure even allows simple vector math, like:

*king - man + woman ≈ queen*

Real-World Use Case

Let’s say you type ‘cute dog videos’ into the search bar. Even though you didn’t use the word ‘puppy,’ the app still shows puppy videos. Why? Because embeddings help it understand that:

  • ‘cute’ is often near ‘puppy’
  • ‘dog’ and ‘puppy’ are semantically related

Word embeddings were a game-changer. They helped AI move from memorizing words to understanding meaning, capturing relationships, analogies, and even basic logic through math.

But language is rich, messy, and full of nuance. A single word can mean different things in different situations, and these traditional embeddings may fail to capture them.


메타데이터
post_id
328ebbd4032e
slug
embeddings-in-nlp-turning-vectors-into-understanding-328ebbd4032e
url
https://medium.com/@amit-jsr/embeddings-in-nlp-turning-vectors-into-understanding-328ebbd4032e
canonical_url
https://medium.com/@amit-jsr/embeddings-in-nlp-turning-vectors-into-understanding-328ebbd4032e
author_url
https://medium.com/@amit-jsr
status
ok
fetched_at
2026-08-01 04:45:58