How AI turns words into numbers that capture meaning โ so "vendor proposal" and "supplier quote" understand each other. Interactive 3D explorer with healthcare terms.
๐ ~10 min read๐ฎ Interactive 3D๐ฅ Healthcare ContextL100 Foundational
๐ค The Problem: Numbers Don't Have Meaning
After tokenisation, your text is just a list of token IDs โ random numbers from a vocabulary table. Token 42 might mean "vendor", token 9001 might mean "supplier". These numbers are identifiers, not meaning.
For an LLM to understand that a "vendor" and a "supplier" are similar concepts, those words need to be represented in a way where similar things have similar numbers. That's what embeddings do.
๐ฅ Healthcare Analogy
A token ID is like a hospital's file number โ Patient #4827, Vendor #1138. Useful for filing, useless for anything else. Two patients with consecutive file numbers might have nothing in common. We need a representation where Patient #4827 sits near other diabetic patients, not next to whoever happened to register before them.
๐ข
Token IDs = Identifiers
"vendor" โ 42, "supplier" โ 9001. The numbers themselves are arbitrary lookup positions. No meaning embedded.
๐
Embeddings = Coordinates
A list of 1,536 numbers per word. Similar words land at nearby coordinates in this high-dimensional space.
๐
Distance = Similarity
"vendor" and "supplier" might be 0.08 apart. "vendor" and "scalpel" might be 0.94 apart. Distance reveals semantic closeness.
๐ง
Learned, Not Hand-Coded
The model figures out positions automatically by reading billions of sentences. Words used in similar contexts end up close together.
๐ก
Why this is huge for healthcare: When a staff member asks AgentSea about "leave entitlement", embeddings let the system find your policy on "annual leave allowance" even though the words are different. Without embeddings, AI would only match exact words โ useless for real-world queries.
๐ฏ What Embeddings Make Possible
Every "smart" feature you've seen in AgentSea or any modern AI relies on embeddings underneath:
Semantic search: "Show me policies on remote work" finds "Telecommuting guidelines" even though no word matches.
RAG (next explainer): Find the most relevant chunks of your handbook for any question.
Clustering: Group similar vendor proposals together automatically.
Anomaly detection: Flag a leave request that looks unusually different from past ones.
Translation: "vendor" in English and "ไพๅบๅ" in Chinese end up in similar coordinates because they appear in similar contexts.
๐ข The Naive Approach: One-Hot Encoding
Before embeddings, you'd represent each word as a giant list of zeros with a single 1 at the word's position. If your vocabulary has 50,000 words, every word is a 50,000-long vector with 49,999 zeros and one 1.
"vendor"
0001000000โฆ 49,990 more zeros
"supplier"
0000001000โฆ 49,990 more zeros
"scalpel"
0100000000โฆ 49,990 more zeros
Why one-hot is bad
๐ฆ
Massively Wasteful
Storing 50,000 numbers per word, almost all zeros. Multiply that by every word in a 30-page document.
๐ซ
Zero Similarity Info
"vendor" and "supplier" look as different from each other as "vendor" and "scalpel". The math says they're equally unrelated.
๐
Can't Handle New Words
What about "AgentSea"? "MOH circular"? Adding a word means resizing every vector โ impractical at scale.
๐ The Better Way: Dense Embeddings
Instead of 50,000 mostly-zero numbers, use a few hundred (typically 768 or 1,536) decimal numbers โ and let the model learn what each dimension means.
"vendor"
0.42-0.130.880.07-0.550.210.93-0.34โฆ 1,528 more
"supplier"
0.39-0.180.850.11-0.520.240.91-0.31โฆ 1,528 more
"scalpel"
-0.710.62-0.04-0.880.45-0.770.120.66โฆ 1,528 more
Notice: The "vendor" and "supplier" rows are nearly identical across all 1,536 dimensions. The "scalpel" row is wildly different. The numbers themselves don't mean anything to humans โ but the model has arranged them so that similar concepts have similar coordinates.
๐ก
Where do these numbers come from? The model trained on billions of sentences. It noticed: when "vendor" appears, words like "proposal", "contract", "SLA", "pricing" tend to nearby. Same context for "supplier". So it learned to place them at similar coordinates. This is called distributional semantics โ "you shall know a word by the company it keeps."
๐ฎ 3D Embedding Space Explorer
Real embeddings live in 768 or 1,536 dimensions. This 3D projection shows healthcare terms โ drag to rotate, scroll to zoom, click any word. Notice how related concepts cluster, while unrelated words sit far away.
๐ฎ 3D Embedding Space Explorer
Drag to rotate ยท Scroll to zoom ยท Click a word
๐
Procurement words cluster tightly (purple). Finance is nearby (cyan). Clinical sits far away (pink). Unrelated words (grey) are pushed even further. This is how AgentSea understands "vendor proposal" relates to "supplier quote" โ but not to "scalpel".
๐ฑ๏ธ drag to rotate
โ scroll to zoom
๐ click word
๐ก
This is a 3D simplification. Real embeddings live in 1,536+ dimensions. We use techniques like t-SNE or UMAP to project down to 3D so humans can see them. The relative positions stay roughly the same โ what's near each other in high-D is near each other in 3D.
๐ Similarity = Distance Between Vectors
The whole point of embeddings is that distance reveals meaning. There are 3 common ways to measure how close two embeddings are:
Metric
How it works
When to use
Cosine similarity โญ
Angle between vectors. Range: โ1 (opposite) to 1 (identical).
Default for text embeddings. Used by AgentSea.
Euclidean distance
Straight-line distance. 0 = identical.
When magnitude matters (rare for text).
Dot product
Multiply & sum. Higher = more similar.
Faster compute when vectors are normalised.
Healthcare similarity examples
Cosine similarity scores between healthcare terms (range 0โ1, higher = more similar):
vendor โ supplier
0.92
budget โ expenditure
0.88
leave entitlement โ annual leave allowance
0.84
vendor โ contract
0.71
PDPA โ data protection
0.79
vendor โ patient
0.18
vendor โ scalpel
0.08
๐ก
For semantic search: AgentSea computes the embedding of your question, then finds the document chunks with the highest cosine similarity. That's how it answers "what's our work-from-home policy?" by retrieving the chunk titled "Telecommuting guidelines" โ same meaning, different words.
๐ Where Embeddings Live in AgentSea
You don't see embeddings directly when using AgentSea โ but they're working behind the scenes for several features. Here's where:
๐
Document Search
When you upload a vendor proposal and ask questions, AgentSea embeds your question and finds matching chunks via cosine similarity.
๐
Knowledge Spaces (Phase 1B)
August 2026: SharePoint integration will let you embed your entire policy library, then query it semantically.
๐ค
Skill Selection
When AgentSea picks which skill to use (Doc Analysis vs Doc Gen vs Outlook), it's matching your intent embedding against skill descriptions.
๐
RAG (next explainer)
Retrieval-Augmented Generation is the dominant pattern for grounding AI answers in your documents โ entirely powered by embeddings.
What you should remember
Embeddings turn tokens into coordinates in a meaning space.
Similar concepts have similar coordinates. Distance reveals semantic similarity.
Real embeddings have 768โ1,536 dimensions. We project to 3D for human viewing.
Cosine similarity is the standard distance metric for text embeddings.
Embeddings power semantic search, RAG, clustering, and intent matching in AgentSea.
โญ๏ธ Up Next: The Transformer
Now that the model has tokens (with embeddings), how does it actually think about them and produce a response? That's the transformer architecture โ covered in the next explainer.