Zenaique

Your team debates 32K vs 128K vs 256K vocab. What is the core tradeoff they should frame?

Flashcard·Easy·4.0 · 0·~30s·Asked atFlipkartMidjourneyMongodb·Relevant atMeta
Attempt it
TL;DR

Bigger vocab compresses text into shorter sequences (cheaper attention) but fattens the embedding matrix, lm_head, and softmax. The 2026 sweet spot for general LLMs is 100K to 200K.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Picture a dictionary you carry around to read every book. A tiny dictionary fits in your pocket but you have to look up every other word, so reading is slow. A huge dictionary lets you read fast because almost every word is one lookup, but the book itself is now twice as heavy in your backpack. Vocabulary size in a language model is the same choice. A small vocabulary breaks text into many small tokens, making the model work through more positions, and the attention math gets expensive. A big vocabulary compresses text into fewer tokens, so the model processes it in fewer steps. But the model also carries one slot per vocabulary entry in two large matrices, so a huge vocabulary makes the model bigger and the final prediction step slower.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

Vocabulary size is one of the small handful of hyperparameters a tokenizer design team fixes early and cannot easily change later. The decision trades sequence length against model parameter count and inference overhead, and the right answer depends on context window targets, multilingual requirements, and training data scale.

This explanation walks through both sides of the tradeoff as your team should frame it, names the 2026 production sweet spots with concrete numbers, and explains why the trend over the last few years has been steadily upward.

What gets cheaper as vocabulary grows

The primary benefit of a bigger vocabulary is shorter sequences. Each token covers more characters of input, compressing the same content into fewer positions. For English text the rough rules of thumb in 2026 are:

  • 32K vocab: roughly 2.5 characters per token.
  • 100K vocab (cl100k_base): roughly 4 characters per token.
  • 200K vocab (o200k_base): roughly 5 characters per token.

Shorter sequences pay off on two compute budget axes. Attention is O(n squared) in sequence length per layer, so halving the sequence reduces attention compute per layer by 4x. KV cache memory at inference scales linearly with sequence length, so halving the sequence halves KV cache memory. On long context workloads (documents, multi-turn chats, agent transcripts) both numbers dominate per-request cost.

There is a third payoff worth naming: more semantic content fits in any fixed context window. A 1M token context window holds more useful text when each token covers more characters. As models pushed to 1M+ token windows in 2025 to 2026, the value of larger vocabularies grew correspondingly.

What gets more expensive as vocabulary grows
The 2026 production sweet spots
Why the trend has been upward
How to pick a size in practice
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • tiktoken cl100k_base ships a 100K vocabulary for GPT-4 era models; o200k_base ships 200K for GPT-4o, o1, o3, GPT-5, and GPT-5.5.
  • Llama 3 and Llama 4 use a 128K BPE vocabulary, quadrupled from Llama 2's 32K SentencePiece.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QDoubling the vocabulary roughly halves sequence length. Why does that not perfectly cancel out the doubled embedding cost?
A

The two costs sit on different axes. Sequence length affects attention compute (quadratic per layer) and KV cache (linear per token). Embedding size affects parameter count and softmax cost. The net is workload dependent: long-context inference benefits more from shorter sequences, while embedding cost matters more at training time.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Thinking bigger vocabulary is strictly better. The embedding matrix and lm_head both scale linearly with vocab_size, doubling the vocabulary roughly doubles those parameters and adds real cost to every forward pass.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • State the headline tradeoff in one sentence: sequence compression versus parameter cost.

  • Name the two large matrices that scale with vocab_size (embedding and lm_head).

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Why does BPE tokenization use subwords instead of words or characters?
Flashcard·Easy