We’re going to break down the math, expose the quirks, and show you how to turn those vectors into meaning using "Text Embeddings"
Language is messy, chaotic, and beautiful. Mathematics is precise, cold, and rigid. Today we're going to find out how those two can shake hands.
+ why is text embeddings important
+ identify a connect with something they care about
+ Add an explanation (introduction character telling) before the embedddings map. Walkthrough, tell people to try things
LET'S TRAVEL INTO THE SPACE OF MEANINGS!!
LET'S TRAVEL INTO THE SPACE OF MEANINGS!!
If every word in the English language was a star in the night sky, text embedding is the telescope that reveals the constellations connecting them.
Let's use some "magic" to reveal the first step of how AI understands language.
Original Text
I ❤ strawberries
Tokenization ↓
Token ID Sequence
[40, 1037, 21020, 219, 23633, 1012]
Every word, symbol, and even typo must be converted to numbers before the model can start "thinking."
Splits by spaces and punctuation—simple and intuitive.
Drawback: Huge vocabulary, can't handle new words or typos.
Encountering "Covidlicious" results in [UNK] (Unknown).
Breaks text into individual characters, extremely small vocabulary.
Drawback: Sequences too long, loses semantics, low efficiency.
"unbelievable" is split into 12 characters, making it hard for the model to understand the overall meaning.
Balances efficiency and meaning by breaking words into meaningful "building blocks."
un + believ + able = unbelievable
common prefix + root + common suffix = complete word
This way, the vocabulary is small, fewer unknown words, and it can understand that "unbelievable" is composed of "un + believable."
Ask AI: "How many 'r's are in 'strawberry'?"
s-t-r-a-w-b-e-r-r-y, at a glance, 3.
['str', 'aw', 'berry'], original letter information is lost, can only guess.
Tokenization Information Loss
How do tokenizers handle ever-evolving internet language?
"🌟💀 slayyy 🖌️" gets split into ['🌟', '💀', 'slay', 'yy', '🖌️'].
If an emoji is a commonly used "word," it gets its own ID.
"Covidlicious" might be split into ['Covid', 'licious'].
Subword models can "understand" and process newly coined words.
"yyds", "amazing" etc.—if popular enough, they're treated as a complete token in new model training.
Embedding encodes word meaning as an "address" in high-dimensional space—a vector.
King → Royal, Male → [0.2, -0.5, 0.8, ..., 0.1]
In this space, words with similar meanings are closer together, and models understand relationships by calculating "distance."
King - Man + Woman = Queen
Embeddings not only encode word meaning but also relationships.
Through vector addition and subtraction, we can explore analogies and logic in language.
Imagine a colony of ants (the model) crawling through Wikipedia.
Early embeddings were static—one word, one vector.
Modern models (like BERT) can dynamically adjust word meaning based on context.
"I need to open an account at the bank."
→ Vector points to "financial institution"
"We're having a picnic by the bank."
→ Vector points to "riverbank"
The same word "bank" gets different vector representations in different contexts, allowing the model to truly understand its meaning.
Embedding technology has expanded beyond text—any data can be encoded as vectors.
Through models like CLIP, images and text can be mapped to the same vector space, enabling "search images with text."
Spotify uses it for music recommendations.
Amazon uses it for product recommendations.
Challenge: Try to find your own word vector relationship!
$$\text{Sushi} - \text{Japan} + \text{Italy} = \text{Pizza}$$
Principle: (Food - Origin Country) + New Origin Country = New Food
This demonstrates how embeddings encode complex relationships.
This is the secret trilogy of how AI understands language:
Tokenize
Break text into small chunks the model can process.
Embed
Convert tokens into vectors in high-dimensional space.
Understand
Understand semantics through vector operations and model reasoning.
Next time you see "strawberries," you'll know it's just a string of mysterious code in the AI world.