Embedding Tables Consume 60% of a Small Model's Parameters: A Practical Guide to Vocabulary Slimming
This article breaks down why the embedding table, not the Transformer layers, is the dominant parameter consumer in sub-billion-parameter models, and walks through five slimming strategies: weight tying, low-rank factorization, vocabulary pruning, quantization and ternarization, and freezing the embedding. It also explains why freezing is a separate lever from compression, what order to apply these techniques in, and why the real on-device bottleneck is usually memory bandwidth rather than storage size.
1. The Overlooked Heavyweight: A Small Model’s Hidden Mass
When a language model is designed to run on a phone or a laptop, engineers tend to iterate endlessly on the number of layers and the hidden dimension, and routinely miss one fact: the part that actually consumes parameters is not the part that computes. It is the table that does the looking up.
Take a roughly 268M-parameter on-device model and split open its internals, and you get a counterintuitive result:
- All the layers that participate in the forward pass and feed-forward computation add up to only about 71M parameters;
- The one or two embedding tables that map tokens to vectors claim about 168M parameters on their own;
- The vocabulary accounts for as much as 63%.
In other words, the model looks like it is working hard to think, but more than half of its mass is resting on what is essentially a dictionary. For a cloud-scale model, this is noise. But for on-device scenarios, where footprint is measured in megabytes and inference speed is decided by memory bandwidth, that vocabulary table is dead weight that has to be dealt with head-on.
2. Why Embedding Tables Are So Heavy
To understand the root of the problem, start with how embedding parameters are counted. An embedding table is fundamentally a matrix shaped vocab_size × hidden_dim:
embedding_params = vocab_size × hidden_dim
Two hidden amplifiers live inside that multiplication:
- Vocabulary size keeps climbing. To cover multiple languages, source code, emoji, and rare characters, modern small models routinely ship vocabularies of 100,000 or even 250,000+ entries.
- The hidden dimension does not shrink at the same pace. To preserve representational capacity, small models often keep the hidden dimension in the hundreds.
Multiply the two and the result is striking:
vocab_size = 128_000hidden_dim = 640# Input embedding table aloneinput_embed = vocab_size * hidden_dim # ≈ 81.9 M# If input and output are not shared, the output projection doubles itoutput_embed = vocab_size * hidden_dim # ≈ 81.9 M
A model with a hidden dimension of just 640 and fewer than 300M parameters in total can easily spend hundreds of millions on embeddings. That is the math behind “the vocabulary eats most of the weight” — it has little to do with how smart the model is, and everything to do with what the structure dictates.
3. Why the Vocabulary Has to Be Cut Now
Three developments over the past few years have turned vocabulary optimization from an option into a requirement in the on-device small-model space:
- Extreme quantization has matured. The industry has demonstrated that compressing network weights to only
-1,0, and+1— ternary weights — can dramatically cut both footprint and compute with almost no quality loss. Once the main body of weights is squeezed that hard, the uncompressed embedding table becomes the stubborn holdout in the size budget. - Sub-billion-parameter models are genuinely good enough now. Small models already handle everyday question answering, text classification, simple summarization, and similar tasks, which has lowered the bar for on-device deployment.
- Models are actually running on phones and laptops. At that point, every megabyte of footprint and every weight read that consumes bandwidth translates directly into real cost, heat, and battery life.
The more aggressively the main body shrinks, the more prominent the vocabulary’s relative share becomes. Nobody has ever really gone after it, precisely because it is not as conspicuous as the attention layers — yet it is a bandwidth bottleneck that on-device deployment cannot route around.
4. Five Strategies for Slimming the Vocabulary
4.1 Weight Tying
The input embedding table and the output projection layer (which maps hidden vectors back to vocabulary probabilities) are transposes of each other mathematically. Having both share the same parameter matrix removes an entire duplicate copy:
# Share one weight matrix between input embedding and output projectionself.token_embedding = nn.Embedding(vocab_size, hidden_dim)self.output_proj = self.token_embedding.weight # no separate allocation
The cost is that input and output semantics are forced to be coupled, but for most small models the quality loss is usually acceptable. It is the highest-value first cut.
4.2 Low-Rank Factorization
Since the embedding matrix is a large rectangle of vocab_size × hidden_dim, it can be approximated by the product of two skinny matrices:
large matrix (V × D) ≈ A (V × r) × B (r × D), where r is far smaller than D
The parameter count drops from V×D to V×r + r×D. Pick a rank r equal to half the hidden dimension and embedding-related parameters are nearly cut in half, while representational capacity is largely preserved by the low-rank subspace.
4.3 Vocabulary Pruning
If the target scenario has a highly concentrated language distribution — Chinese-only in a vertical domain, for instance — then a large share of low-frequency tokens is pure burden. By computing frequency statistics over the corpus, long-tail rare words can be merged, deleted, or mapped to an “unknown” symbol, which shrinks the vocabulary for real. Pruning pays off twice: it saves parameters and shortens the output projection’s compute.
4.4 Quantization and Ternarization
The extreme compression techniques described earlier apply to embedding tables too: take vectors that were stored in high-precision floating point and push them down to ternary or even lower bit widths. At inference time the embedding table is mainly used for lookups and is extremely sensitive to storage density, so quantization often yields close to linear footprint savings with limited accuracy loss.
4.5 Freezing the Embedding
This is the idea the title points at. Once a small model finishes pretraining and enters fine-tuning or distillation, set the embedding table to be excluded from gradient updates — this saves optimizer state overhead and avoids letting the fine-tuning stage drift the representations learned during pretraining:
# Freeze the embedding during fine-tuning to avoid updating huge numbers of parametersfor param in model.token_embedding.parameters():param.requires_grad = False
The deeper payoff of freezing is often underestimated. With common adaptive optimizers, each trainable parameter carries one or two momentum states in addition to its own weights. Freezing an embedding table with hundreds of millions of parameters therefore saves its weight updates, its gradients, and its optimizer states all at once — on memory-constrained devices, that saving can matter even more than the model’s footprint itself.
5. Freezing in Depth: Why It Deserves Its Own Category
The other strategies compress how much space something occupies. Freezing changes whether it has to be moved around during training. These are different dimensions, and they stack.
Freezing holds up because of an empirical fact: an embedding table mainly carries general-purpose language representations, and that knowledge is essentially settled during pretraining. What downstream fine-tuning needs to adjust is the task-specific mapping logic, not the underlying word semantics. Forcing the embedding table to update yields diminishing returns while adding three kinds of overhead:
- Memory overhead: weights plus gradients plus optimizer states all resident at once;
- Update overhead: every step reads and writes sparse but enormous numbers of rows;
- Stability risk: fine-tuning at a small learning rate can still damage the existing representations.
With the embedding frozen, training only has to update the Transformer backbone, which converges faster, costs fewer resources, and is easier to run on an on-device handset or a lightweight cloud instance. If some adaptivity needs to be retained, there are compromise options: unfreeze only the rows corresponding to high-frequency tokens, or use a low-rank adapter bypass.
6. Engineering Trade-offs
These paths are not mutually exclusive. In practice they are combined, with decisions ordered like this:
- Start with the zero-cost items. Weight tying is close to a free lunch, so do it first.
- Then attack footprint. Low-rank factorization and quantization/ternarization directly cut size and bandwidth.
- Prune by scenario. In vertical domains, prune the vocabulary decisively; in general-purpose scenarios, be cautious and avoid damaging long-tail capability.
- Freeze during training. In fine-tuning and distillation, prefer freezing the embedding and spend the saved optimizer state on the backbone.
One common misconception is worth flagging: the real on-device bottleneck is often not storage footprint but memory bandwidth at inference time. Every layer and every table has to be moved from memory into the compute units, and while the embedding table is large, lookups are sparse accesses. So when estimating benefits, measure “how many parameters were saved” and “how many bytes were actually read and written” separately, to avoid a paper-only slimming where real bandwidth never drops.
7. Summary
Half the answer to a small model’s size problem is hidden in that neglected vocabulary table. Its size is set by vocab_size × hidden_dim, which makes it inherently large, and increasingly conspicuous as extreme quantization spreads. Weight tying, low-rank factorization, vocabulary pruning, quantization/ternarization, and freezing the embedding attack it from five angles — remove duplication, reduce dimensionality, cut token count, compress bits, and skip updates — and can be used individually or stacked. For the vast majority of on-device scenarios, getting the vocabulary’s hidden mass under control usually buys more real footprint, memory, and speed improvement than repeatedly shaving layers off the backbone.
