1. What IS an Embedding?
An embedding is a list of numbers that represents the meaning of a token. Think of it as GPS coordinates, but instead of 2 dimensions (latitude, longitude), you have thousands of dimensions.
Each of those 4096 numbers captures some aspect of meaning — we don't always know what each dimension means, but collectively they encode:
- Is this a verb or noun?
- Is it positive or negative?
- Is it formal or casual?
- Is it about food? technology? emotions?
2. How Are Embeddings Learned?
Start: Completely Random
Training: Learn from Context
The model reads trillions of sentences and learns:
After Billions of Sentences:
The famous example:
3. How Does It Store Names, Proper Nouns, Standard Words?
Standard Words (common):
Names and Rare Words (get split):
Key insight: For split words, the meaning isn't in any single token's embedding — it emerges when the transformer layers process them together with attention.
4. Embedding Sizes Across Models
| Model | Vocab Size | Embedding Dimensions | Total Parameters (embedding layer alone) |
|---|---|---|---|
| GPT-2 | 50,257 | 768 | ~38 million |
| GPT-3 | 50,257 | 12,288 | ~617 million |
| GPT-4 | ~100,000 | ~8,192–12,288 (estimated) | ~800M–1.2B |
| LLaMA 2 | 32,000 | 4,096 | ~131 million |
| LLaMA 3 | 128,256 | 4,096 (8B) / 8,192 (70B) | ~525M / ~1B |
| Mistral 7B | 32,000 | 4,096 | ~131 million |
| BERT (base) | 30,522 | 768 | ~23 million |
Why bigger models have larger embeddings: More dimensions = more nuance. Like describing a person with 5 adjectives vs. 4,096 adjectives — the more dimensions, the more precisely you can differentiate meanings.
5. Who Prepares the Initial Vocabulary and How?
The vocabulary is built before training using an algorithm called BPE (Byte Pair Encoding). Here's how:
Step-by-Step BPE Example:
Who does this?
The model creators (Meta, OpenAI, Google) run BPE on their training corpus once before training starts. It's a preprocessing step.
6. The Big Question: "English Didn't Change, So Why Do Vocabs Differ?"
Great intuition — but here's why vocabs do change between models:
Reason 1: Different Training Data
Reason 2: Different Vocab Sizes = Different Splits
Reason 3: Different Optimization Goals
Reason 4: Efficiency Tradeoffs
Summary Table
| Question | Answer |
|---|---|
| What is an embedding? | A vector of numbers that encodes meaning |
| How is it learned? | By observing which words appear in similar contexts across billions of sentences |
| Names/rare words? | Split into subword pieces; transformer combines them for meaning |
| Who makes the vocab? | Model creators, using BPE on training data, before training starts |
| Does vocab change across models? | Yes — different data, different sizes, different goals |
| Why change if English is the same? | More languages, more code, efficiency tradeoffs, and different corpus compositions |
The analogy:
English alphabet hasn't changed — but dictionaries differ (Oxford vs. Webster vs. Urban Dictionary). Each is optimized for different audiences. Same idea with LLM vocabularies — same language, different "dictionaries" optimized for different jobs.