Small Model Slimming: Why the Embedding Table Is the Weight You Can't Drop

    On-device small language models hide a surprise: the embedding (vocabulary) table can account for more than half of total parameters and dominate the model file size. This article explains why the vocabulary stays fixed no matter how small the model gets, why mainstream quantization tends to skip it, how "excluding the embedding layer" statistics understate real deployment cost, and practical engineering paths—vocabulary pruning, dimension reduction, low-rank decomposition, and product quantization—to shrink it.

    1. A Counterintuitive Breakdown

    Take a small model aimed at phones and laptops, with roughly 200 million parameters in total. If you break it down layer by layer, you find something that runs against intuition: the feed-forward network and attention blocks—the parts that actually do the computation and reasoning—account for only about 70 million parameters. The embedding table, the piece responsible for “translating tokens into vectors,” takes up about 170 million on its own, more than 60% of the entire model.

    This number is jarring because we usually assume “big models are hard, small models are light.” But a small model’s lightness is mostly about the compute layer, while the vocabulary is a nearly fixed constant—no matter how small you make the model, it has to cover the same enormous token space. So on a small model, the vocabulary goes from a negligible rounding error to the main body of the model. Anyone who only optimizes the compute layer will overlook this biggest piece of excess.

    2. Why the Vocabulary Is Inherently Large: One Table, Two Jobs, a Fixed Token Space

    To understand the size of the vocabulary, start with how it’s built. The size of the embedding table can be roughly written as a product:

    1. embedding table params ≈ vocab size (V) × vector dimension (d)

    The vocab size is decided by the tokenizer, and common language models have anywhere from a hundred-something thousand to over two hundred thousand tokens; the vector dimension is tied to the model’s hidden width. Multiply the two, and the size easily climbs into the hundreds of millions.

    More importantly, the vocabulary is often “one table, two jobs.” Small models commonly use weight tying: the input side uses this table to look tokens up as vectors, and the output side reuses the same table directly to project the hidden state back into a token distribution. In code it looks like this:

    1. # The embedding table is essentially a "gather by row", not a dense matrix multiply
    2. embedding_table = [...] # [V, d]
    3. input_ids = [42, 7, 1000] # tokens used in the current batch
    4. vectors = embedding_table[input_ids] # input side: fetch only the rows used
    5. # Weight tying: the output layer reuses the same table
    6. logits = hidden @ embedding_table.T # output side: project against the full table

    This reuse is itself a good design—it saves a copy of the parameters. But it also means the table is depended on by two paths at once, input lookup and output projection, so any change has ripple effects. The token space is determined by language itself and won’t shrink just because the model gets smaller—this is the root of why the vocabulary is so hard to shed in small models.

    3. The Slimmer the Body, the More the Vocabulary Stands Out: Quantization Creates a New Conflict

    In recent years, a few trends have emerged in the on-device small-model space: first, extreme compression techniques like ternarization have matured, pushing weights down to just three values (-1, 0, +1) with almost no quality loss; second, models under a billion parameters are already good enough for many everyday tasks; third, people are genuinely starting to run these models locally on phones and laptops, where every megabyte of size and every memory read becomes a real cost.

    The problem is that compression hasn’t brought the vocabulary along—instead it makes the conflict sharper. When the “body” is compressed to close to 1 bit while the vocabulary is still stuck at 16-bit, an extreme imbalance appears: in a model file with a body of about 20 MB but a vocabulary of about 335 MB, the vocabulary accounts for more than 90% of the whole package. The excess that used to be diluted within the compute layer is now the straw that breaks deployment size.

    4. Why Mainstream Quantization Skips the Vocabulary

    It’s worth noting that whether it’s calibration-data-based weight quantization methods or common on-device inference engines, most treat the embedding layer as a “no-go zone” and skip it, compressing the output layer at most to 6–8 bits. This isn’t laziness—the vocabulary really is hard to crack:

    • Different operator shapes. Dense weight quantization is optimized for matrix multiplication (matmul), while the input-side embedding is more like a gather lookup; the quantization scheme doesn’t match the memory-access pattern, and the payoff is limited.
    • Prominent outliers. The distribution of embedding vectors often has clear outliers, and simple symmetric quantization damages these values, with quality loss concentrated on low-frequency tokens.
    • The output layer is sensitive to precision. The shared output projection directly determines the softmax probability distribution; small perturbations in logits get amplified exponentially and affect the probability ranking across the whole vocabulary.
    • Sparse activation is hard to calibrate. In a single inference pass, only a tiny fraction of the full table is actually activated, so calibration data can’t cover every token, and the quantization error itself is hard to evaluate.

    Overall, the risk-reward ratio of “quantizing the vocabulary” isn’t worth it, so everyone skips it by default, treating it as a “known to be fat, but left alone for now” corner.

    5. The Statistic Everyone Drops: Starting from “Excluding the Embedding Layer”

    This default acceptance is itself worth being wary of. When a vendor publishes a report on its ternarization technique, the memory figure is often written as “0.x GB (excluding the embedding layer)”—effectively kicking the biggest piece out of the statistic. This makes sense from a compute-layer perspective, but it’s misleading for anyone actually trying to run the model on a phone: the device’s memory and VRAM have to hold the entire model file, and that huge vocabulary is an unavoidable physical cost.

    The first principle of engineering practice is: count deployment cost by the whole package. When distributing model packages via object storage, the gap between 335 MB and 20 MB shows up directly in download size, cold-start time, and peak memory; pairing that with monitoring and alerts to observe on-device load time and memory usage is how you discover that the vocabulary is the overlooked performance bottleneck. Taking the biggest component out of the statistic only makes the problem surface after launch.

    6. Engineering Paths to Lighten the Vocabulary

    Since the vocabulary can’t be avoided, you have to tackle its weight head-on. The following ideas can be used individually or in combination:

    1. Vocabulary pruning. Measure the token frequency of what’s activated in the corpus, cut the rarely used low-frequency tokens, and add back the necessary placeholders. Trimming the long tail shrinks the table, and the impact on general-task quality is usually manageable.

    2. Reduce the embedding dimension. The compute layer can use a larger hidden dimension, but embedding vectors don’t necessarily need to be as wide. Give the embedding a smaller dimension of its own, directly cutting d out of V × d.

    3. Low-rank decomposition. Perform a singular value decomposition of the embedding matrix and approximate it with two small matrices:

    1. E ∈ R^{V×d} ≈ A · B, A ∈ R^{V×r}, B ∈ R^{r×d}, r ≪ d

    The parameter count drops from V×d to V×r + r×d, and with a suitable rank r this gives a clear compression.

    1. Product quantization / codebooks. Split each d-dimensional vector into several sub-segments, match each segment against a codebook via nearest neighbor, and store only the codebook index:
    1. # Split each vector into m segments, each encoded by nearest match against a 256-entry codebook
    2. # Original storage: V × d floats
    3. # After compression: V × m uint8 indices + m codebooks of (256 × d/m)
    4. # At query time, stitch back the approximate vector by index; both memory access and size drop
    1. Embedding-aware quantization + selective untying. Use mixed precision or grouped quantization for the outliers; when necessary, handle the input embedding and output projection separately instead of forcing one table to satisfy both paths’ precision demands.

    Which path to choose depends on the constraints: for extreme size, go with codebooks and low-rank; for a safe landing, vocabulary pruning plus dimension reduction often cuts the vocabulary size by more than half at the lowest rework cost.

    7. Conclusion: Deployment Optimization Should Target the Biggest Piece

    Competition among small models has shifted from “can it run” to “can it be small and fast.” When the compute layer is compressed to the extreme, the vocabulary—this excess that’s 60% of the volume—becomes the last hard bone you can’t avoid. Understanding why it’s so large, why quantization skips it, and why the statistic hides it, then using a combination of pruning, dimension reduction, low-rank, and codebooks to reduce its weight head-on, is what truly gets on-device deployment optimization right. Don’t let that vocabulary disappear in the report while it sets up camp in your phone’s memory.