The Vocabulary Table Can Make Up 60% of a Small Model: Freezing and Compression Approaches
This article examines a counterintuitive fact about small on-device language models: it is the embedding table (vocabulary), not the compute-heavy layers, that dominates the parameter count—accounting for around 63% in a model of roughly 268 million parameters. It explains why vocabulary tables are inherently heavy, why three recent trends push them into the spotlight, and why conventional quantization usually leaves them untouched, sometimes producing a "size inversion" where the table becomes the largest part of the file. It then surveys general techniques for "freezing" the vocabulary table—low-rank factorization, codebooks and vector quantization, hashing and clustering sharing, and mixed precision with selective freezing—along with the accuracy, fine-tuning, and inference tradeoffs each entails. Developers assessing whether a small model is "light enough" will learn to isolate the embedding table when estimating real file size and memory footprint.
A Structural Imbalance Hidden by Averages
As on-device AI gains momentum, more vendors are shipping small models in the range of a couple hundred million parameters, aimed at phones and laptops. They are compact and offer controllable latency, looking “light” in exactly the right way. But if you take one apart and tally the parameter distribution layer by layer, you run into a counterintuitive fact: the part that actually does the inference and carries the model’s “intelligence” accounts for far less than you would expect.
Take a typical on-device model with a little over 200 million parameters. It has about 268 million parameters in total. Of those, the feed-forward layers that participate in the forward pass and carry the reasoning capability come to only about 71 million, while the embedding table—the layer that maps discrete tokens to dense vectors—takes up about 168 million on its own, roughly 63% of the entire model.
Put differently, more than two-thirds of this model’s “body weight” is not thinking; it is memorizing words. That is the core contradiction this article is about.
Dissecting the Model: The Compute Part Is Light, the Storage Part Is Heavy
In a mainstream modern decoder-only language model, parameters fall into roughly two categories:
- Compute-intensive part: attention projections, the feed-forward network (FFN), and so on. This determines the model’s actual inference capability and throughput.
- Storage-intensive part: the input embedding table, together with the output projection layer, which usually shares parameters with it (the output layer often uses tied weights with the input layer).
The problem is that these two parts react very differently to size pressure. The compute part is highly redundant and can survive aggressive compression while keeping usable accuracy. The embedding table is a large, “dense” lookup matrix in which every row is a dense vector that must be preserved intact—it cannot be pruned as freely as ordinary weights.
The following illustrative code shows this imbalance directly:
vocab_size = 256_000 # Vocabulary size (easily reached with multilingual/byte-level tokens)hidden_dim = 640 # Hidden dimension# Embedding table params = vocab size × hidden dimembed_params = vocab_size * hidden_dim # ≈ 168 millionbody_params = 71_000_000 # FFN/attention and other compute layerstotal = embed_params + body_paramsprint(f"Vocab share: {embed_params / total:.0%}") # ≈ 63%
Here is a key formula worth remembering: embedding table params = vocabulary size × hidden dimension. It has almost nothing to do with how “smart” the model is, yet it is tightly coupled to how many kinds of tokens the model has to handle.
Why Vocabulary Tables Are Inherently Heavy
Many people assume vocabulary size is a fixed, inconsequential constant. It is not. As models move toward multilingual coverage, mixed code, and even fine-grained byte-level modeling, the tokenizer becomes increasingly fine-grained, and the vocabulary often climbs to well over 100,000—sometimes 200,000-plus entries. Meanwhile the hidden dimension cannot be pushed too low without hurting overall accuracy. Multiply the two factors together and the embedding table quickly balloons into the elephant in the room.
For a model with tens of billions of parameters, this table is a rounding error that can be safely ignored. But for a model with only a few hundred million parameters, it is practically the model itself. The same structure has its importance fundamentally inverted across different parameter scales.
Three Trends Putting the Spotlight on Vocabulary Tables
Three developments in the on-device small-model space have converged in recent years. Stacked together, they make the vocabulary problem impossible to ignore:
- Extreme quantization (ternarization) is maturing. Research has shown that neural network weights can be compressed to just three values—
-1,0, and+1(ternary)—cutting size and compute substantially while keeping accuracy loss under control. An ideal ternary encoding needs only aboutlog2(3) ≈ 1.58bits per weight in theory. - Sub-billion-parameter models are “good enough.” A range of small models can already handle everyday tasks such as conversation, summarization, and classification, so on-device use no longer demands something massive.
- These models are actually being shipped into phones and laptops. Once they land on real devices, every megabyte of size and every memory read turns into real cost and power consumption.
Each trend is itself working toward “slimming down”—but their combined results make that untouched slab of fat, the vocabulary table, stand out all the more starkly.
Why Quantization Can’t Save the Vocabulary Table
You would think that if the body can be pushed to 1 bit, you could just compress the vocabulary in passing. In reality it is not that simple, and the reasons are structural:
- Mainstream quantization methods typically skip the embedding layer. Common weight-only quantization schemes often leave the embedding table and the output layer out of low-bit treatment, for the sake of accuracy and numerical stability.
- Output-layer compression in local inference engines is also limited. Even in widely used on-device inference frameworks, output- and embedding-related layers are usually compressed only to 6–8 bits, nowhere near the aggressiveness applied to the compute layers.
- The result is a “size inversion.” Once the body is squeezed close to its limit, the vocabulary table is still kept at a relatively high bit width, so its share of the file goes up rather than down.
The illustrative calculation below shows how this inversion happens:
def size_mb(params, bits):return params * bits / 8 / (1024 ** 2)# Body ternarized (~2.25 bit/param, including packing and overhead)body_mb = size_mb(71_000_000, 2.25) # ≈ 15~20 MB# Vocabulary still kept at 16 bitembed_mb = size_mb(168_000_000, 16) # ≈ 320 MB scaleprint(f"Body: {body_mb:.0f} MB, Vocab: {embed_mb:.0f} MB")
A slim body of about 20 MB paired with a vocabulary of more than 300 MB—the supposed “fat” has become the largest part of the file. Even more concerning is the question of how the numbers are measured: some technical reports, when reporting memory usage, explicitly note “excluding the embedding layer.” That effectively removes this large chunk from the accounting, letting the appearance of “lightweight” hide the real deployment cost. Accepting such a measurement by default is itself worth questioning: is this vocabulary table really worth its price?
Freezing the Vocabulary Table: A Few General Compression Routes
So-called “freezing the vocabulary table” essentially means treating the embedding table, at inference-deployment time, as an object that can be handled, compressed, and even partially fixed independently—rather than quantizing it wholesale together with the rest of the model. The industry has accumulated several relatively mature general approaches:
1. Low-Rank Factorization
The embedding matrix E has shape [vocabulary size, hidden dimension], naturally a giant “tall-and-skinny” or “short-and-fat” matrix. Approximating it with two smaller matrices can cut parameters significantly:
import numpy as npvocab, dim = 256_000, 640E = np.random.randn(vocab, dim) # Original vocabulary: ~164 million paramsrank = 128A = np.random.randn(vocab, rank) # vocab × low rankB = np.random.randn(rank, dim) # low rank × dimprint(E.size) # 163,840,000print(A.size + B.size) # ≈ 32,850,000, reduced to about 1/5
With a well-chosen rank, the approximation error stays controllable while the parameter count can drop to a fraction of the original. The cost is an extra matrix multiplication, and accuracy has to be recovered through fine-tuning.
2. Codebook / Vector Quantization
Instead of storing a separate vector for every token, you learn a shared “codebook” and let many token vectors be composed from a handful of codewords (as in product quantization or residual quantization). This fits the idea of “freezing” closely: once the codebook is fixed, the mapping from tokens to codewords is fixed too, so inference only needs lookups and assembly, and storage cost drops substantially.
3. Hashing and Clustering Sharing
- Hash embeddings: use a deterministic hash function to map the huge number of tokens onto a smaller set of “buckets,” so multiple tokens share the same vector, decoupling the parameter count from the vocabulary size.
- Clustering sharing: cluster semantically similar tokens, then share vectors within a cluster or use low-bit differential encoding, exploiting the redundancy inherent in the word vectors.
4. Mixed Precision and Selective Freezing
Not all embedding rows are equally important. The vectors of low-frequency tokens are barely used and can take more aggressive low-bit or low-rank treatment, while high-frequency tokens keep higher precision. “Freezing” these low-frequency parts into a compressed static form and only maintaining the essential parts with care is an engineering compromise with strong cost-effectiveness.
Practical Tradeoffs
No compression is free, so you need to be clear about the costs before putting it into production:
- Accuracy loss: the embedding table carries semantic representation, and over-aggressive compression directly harms understanding, generation, and lexical modeling—especially for low-frequency words, proper nouns, and multilingual scenarios.
- Fine-tuning cost: low-rank factorization and codebook learning usually need a round of retraining or distillation to restore accuracy, and this must be factored into the total investment up front.
- Inference overhead: low-rank approximation adds multiply-accumulate operations, and lookup-based methods add indirect addressing, so you need to assess against the target hardware whether a method “saves memory” or “costs compute.”
- Measurement basis: before shipping, always tally the full size under the real deployment configuration (embedding layer included), and don’t be misled by the pretty “excluding the embedding layer” numbers.
Conclusion
For a long time, size optimization of small models defaulted to “compress the body, leave the vocabulary table alone.” But once the body has been ternarized down to its physical limit, that table—which accounts for 60% of the model—becomes the last mile that can no longer be avoided. Treating the vocabulary table as an independent optimization target—freezing it with low-rank factorization, codebook sharing, hash clustering, or mixed precision—is becoming an underestimated yet rewarding technical high ground in on-device deployment. So the next time you evaluate whether some small model is “light enough,” it is worth pulling out the embedding table and computing it separately first: that is where the real file size and memory footprint are decided.
