How to Slim Down the Embedding Layer: Freezing Vocabulary Bloat in Small Language Models

    Small language models are attractive for their low inference cost, edge deployment, and fast response times, but when parameters are squeezed down to a few hundred million or less, every parameter counts. A large share of that budget is consumed not by reasoning layers but by the vocabulary embedding table. This article dissects where those parameters go, explains why the vocabulary is so heavy, and walks through freezing and slimming strategies—weight tying, factorized embeddings, and low-rank or quantized representations. It shows how to reduce memory, speed up training, and keep generalization intact, so limited parameter budgets can be spent where they matter most.

    The “Parameter Anxiety” of Small Models

    Over the past couple of years, sub-billion-parameter models have steadily become practical. Their advantages are clear: low inference cost, the ability to run on-device, and low latency—more than enough to cover a wide range of everyday tasks such as classification, extraction, rewriting, and simple question answering. But once the parameter count is pushed down to a few hundred million or lower, every bit of the budget starts to matter. Developers then ask a key question: where are these limited parameters actually going? The answer is that a substantial share is eaten up by the vocabulary.

    Where Do the Parameters Go? Dissecting the Embedding Table

    Mainstream Transformer-based language models all have a word embedding table at the input, which is essentially a matrix shaped [vocab size, hidden dimension]. The parameter count is calculated very simply:

    1. embedding params = vocab size × hidden dimension

    As an illustrative example: with a vocabulary of 128,000 and a hidden dimension of 768, this single table alone comes to about 98 million parameters. For a small model whose total parameters are only around 100 million, the embedding table nearly takes up half of the model; and if you add the projection layer at the output that maps hidden vectors back to the vocabulary (assuming weights are not shared), its share climbs even higher. This is exactly where the idea that “the vocabulary eats up 60% of a small model’s weight” comes from.

    Why the Vocabulary Is So “Heavy”

    The root of the problem is a mismatch between vocabulary size and model capacity:

    • The vocabulary is too large: To make tokenization more fine-grained and reduce out-of-vocabulary words, modern tokenizers tend to be designed with larger vocabularies (tens of thousands to over a hundred thousand entries), which directly inflates the number of rows in the embedding matrix.
    • The dimension is not low: Even when small models lower the hidden dimension to save parameters, the embedding table remains a tall, narrow matrix with a huge number of rows, so its total size is far from trivial.
    • Diminishing returns: From a linguistic standpoint, the representations of many low-frequency words and subwords are actually highly sparse. Assigning each of them an independent, dense vector that must be updated in full offers poor value for money.

    In other words, the vocabulary contributes “coverage,” but coverage does not need to consume model capacity in equal proportion.

    What Does “Freezing” Actually Mean?

    In a training context, “freezing the vocabulary” usually refers to freezing the embedding layer during (fine-tuning) training so that it does not participate in gradient updates. Technically, this means setting the embedding layer’s requires_grad to False: forward computation still performs the lookup as usual, while backpropagation no longer computes or accumulates gradients for that layer.

    1. # During fine-tuning: freeze word embeddings to reduce trainable params and optimizer state
    2. for param in model.embedding.parameters():
    3. param.requires_grad = False

    Why bother freezing it? The core motivation comes from the memory cost of optimizer state. Take the commonly used Adam optimizer: for every trainable parameter it must store two extra states, the first and second moments, which effectively makes training memory on the order of “parameters × 3.” Since the embedding table is often the largest block, freezing it lets you:

    • Save memory: The optimizer no longer maintains momentum states for the vocabulary, and peak memory usage drops noticeably.
    • Increase speed: Backpropagation skips computing a large chunk of gradients, making each training step faster.
    • Stabilize convergence: When fine-tuning on small datasets, freezing the general-purpose vocabulary helps suppress overfitting and lets limited samples focus on the upper layers’ semantics.
    • Preserve semantics: The lexical space learned during pretraining is kept intact, so fine-tuning does not “drift” the underlying representations.

    Freezing is a “touch it less” strategy. Around the vocabulary, there are also several complementary “make it smaller” paths that are often used together:

    1. Weight tying: Let the input embeddings and the output projection share the same matrix, directly eliminating one equivalent copy of parameters. This is the default in almost all modern language models.
    2. Factorized embeddings: Split [vocab, hidden dimension] into two mapping steps, [vocab, low rank] × [low rank, hidden dimension], compressing parameters with a low-rank bottleneck—a cost that stays manageable when the vocabulary is large.
    3. Low-rank / quantized representations: Apply a low-rank approximation or quantized storage to the embeddings to further shrink their size (though the actual impact on accuracy must be evaluated).

    The trade-off with freezing is this: weight tying and factorization change “what the table looks like,” and are decided during the pretraining/design stage; freezing acts on “how it is updated during training,” and can be enabled flexibly during fine-tuning. They are not in conflict, and are often stacked together.

    Practical Recommendations

    • Diagnose first, then decide: Before training, measure the parameter share of each component. If the embedding layer’s share is too high (for example, over half), prioritize weight tying and factorization.
    • Layer-wise unfreezing: If the task is strongly tied to vocabulary usage, adopt a “freeze first, tune later” strategy—freeze the vocabulary early to stabilize semantics, then unfreeze it later with a smaller learning rate, balancing stability and adaptation.
    • Control learning-rate differences: When unfreezing, set a separate, lower learning rate for the embedding layer to avoid letting a small number of samples heavily perturb the general-purpose word vectors.
    • Leverage platform capabilities: On general cloud capabilities such as container platforms, training and inference services (for example, the related infrastructure offered by Baidu AI Cloud), it is easier to manage memory quotas, distributed training, and model versioning, freeing up saved resources for more valuable experiments.

    Conclusion

    The value of small models lies in being “affordable and runnable.” When the vocabulary accounts for over half of the parameters, blindly piling on more parameters is not a good strategy. Refined structural design (weight tying, factorization) and training strategies (freezing, layer-wise unfreezing) are the keys to spending a limited budget where it counts most. Once you understand “why the embedding table is heavy” and “how to slim it down,” you can strike a better balance among compute, memory, and quality—letting small models deliver greater value in real-world applications.