Freezing the Vocabulary in Small Language Models: A Practical Guide to Trimming Embedding Bloat

    Small language models under one billion parameters are now practical for real deployment, but their parameter budgets are dominated by an often-overlooked component: the vocabulary. This article explains why embedding matrices can consume 40–60% of a small model's parameters, why they have historically escaped optimization, and how freezing the embedding layer during continued training enables a pipeline of further compression techniques—including vocabulary pruning, factorized embeddings, weight tying, and vocabulary-specific quantization—for efficient on-device deployment.

    1. Background: The Parameter Ledger Gets Reopened in the Small-Model Era

    The past two years have brought a notable shift in language model development: sub-billion-parameter models have become genuinely useful. Lightweight open-source models from multiple organizations, along with the smaller members of major model families, now handle everyday tasks—text classification, summarization, instruction following, simple question answering—reliably. Maturing distillation techniques let small models inherit a substantial share of large-model capabilities, while falling training costs have made building a custom small model an affordable option rather than a luxury.

    At the same time, deployment scenarios have changed fundamentally. More and more applications run models directly on phones, laptops, in-vehicle systems, and even embedded devices instead of relying on cloud inference. This changes the nature of the technical constraints: model size is no longer an inconsequential number in a data center, but the wait time of a user download, the share of device storage consumed, and real pressure on runtime memory. Every megabyte of size and every byte of read speed translates into tangible cost. In on-device inference, memory bandwidth often becomes the bottleneck before compute does, and loading the model from storage into memory is itself a major power drain.

    Against this backdrop, developers have begun auditing the parameter distribution of small models layer by layer—and discovered a long-neglected fact: in small models, the vocabulary is the real heavyweight.

    2. Problem Analysis: Why the Vocabulary Eats 60% of the Model’s Weight

    2.1 The Imbalance in Parameter Distribution

    A typical Transformer language model distributes its parameters across two main parts: the stacked attention and feed-forward layers, and the input embedding matrix (plus the output projection layer). The size of the embedding matrix equals vocabulary size × hidden dimension.

    In the large-model era, this matrix was a small fraction. For a model with a hidden dimension of 4096 and 32 layers, the backbone holds billions of parameters, while a 50,000-token vocabulary accounts for only about 200 million—a negligible share. But when the whole model is compressed to a billion parameters or a few hundred million, the picture reverses completely: the backbone is cut thin, while the vocabulary does not shrink proportionally. A 32,000-token vocabulary with a hidden dimension of 2048 already contains roughly 65 million parameters; if input and output embeddings are not shared, vocabulary-related parameters easily exceed 120 million. For a 300-million-parameter model, that is 40%. Add in the oversized 250,000-token vocabularies common in multilingual models, and the vocabulary eating 60% of the model’s “body weight” is no exaggeration.

    2.2 Why the Vocabulary Has Never Been Touched

    Several reasons explain why the vocabulary has escaped optimization.

    The first is historical inertia. A large vocabulary was the “correct” choice for large models: the bigger the vocabulary, the shorter the tokenized sequences, the lower the sequence-length cost of training and inference, and the better the multilingual coverage. This experience was carried directly into small-model design without anyone redoing the math.

    The second is risk aversion. The vocabulary is the model’s “foundation.” Changing it means the input representation changes entirely, which typically requires retraining from scratch or at least large-scale continued training—expensive, with uncertain outcomes. By comparison, compression techniques that leave the vocabulary alone, such as pruning and quantization, carry far less engineering risk.

    The third is an evaluation blind spot. Most benchmarks focus on task accuracy and rarely measure the vocabulary’s impact on on-device size and loading latency in isolation, so the problem long stayed off the optimization agenda.

    3. The Core Idea: Freeze the Vocabulary

    Facing this hardest piece of the problem, a pragmatic engineering approach has emerged: freeze the vocabulary.

    Freezing the vocabulary means setting the embedding matrix as non-trainable during continued pretraining or downstream fine-tuning, updating only the backbone network. Several layers of logic support this practice:

    First, embeddings are already well learned during large-scale pretraining. The vocabulary layer is essentially a lookup-table mapping. After training on massive corpora, its semantic structure is stable. In a small model’s continued pretraining, distillation, or fine-tuning, further updates to the embeddings yield very limited gains—and may even damage the existing semantic geometry through overfitting on small datasets. Freezing preserves a high-quality representation space.

    Second, freezing is the prerequisite for all subsequent aggressive compression. Only when the vocabulary no longer changes can developers safely process it offline—pruning, dimensionality reduction, quantization, migration to dedicated storage—without worrying that training dynamics will undo the optimization. Freezing is not the end goal; it is the key step that demotes the vocabulary from a “training object” to a “static asset.”

    Third, freezing directly saves training cost. With a frozen vocabulary, backpropagation no longer computes gradients or maintains optimizer states for it. Adam-style optimizers need two extra buffers per trainable parameter for momentum; freezing a vocabulary that accounts for 60% of parameters immediately frees a large chunk of training memory—very practical for resource-constrained small-model training.

    In engineering terms, freezing takes just a few lines:

    1. # Pseudocode: freeze the embedding layer
    2. embedding = model.get_input_embeddings()
    3. for param in embedding.parameters():
    4. param.requires_grad = False
    5. # If the output projection is not shared with the input embedding, freeze it too
    6. lm_head = model.get_output_embeddings()
    7. if lm_head is not embedding:
    8. for param in lm_head.parameters():
    9. param.requires_grad = False

    One caveat: freezing the vocabulary is not universally applicable. If the target domain’s lexical distribution differs drastically from the original pretraining corpus—for example, moving from general text to a highly specialized vertical—full freezing may leave new tokens undertrained. A compromise strategy works here: first freeze the backbone and train only the vocabulary for domain adaptation, then reverse the setup—freeze the vocabulary and fine-tune the backbone—completing the process in stages.

    4. The Combination Punch: Further Compression After Freezing

    Freezing is only the first step. The real size savings come from structured compression applied afterward.

    4.1 Vocabulary Pruning

    Most general-purpose vocabularies are designed for multilingual, multi-scenario coverage, but a specific application typically uses only a small subset. By counting actual token frequencies on the target corpus, you can delete entire rows for tokens that never appear or are extremely rare, then repack the retained embedding vectors into a new matrix. For a single-language, single-business on-device application, the vocabulary can often be cut by more than half. Pruning must be synchronized with the tokenizer configuration so that old-to-new token ID mappings stay consistent—this is where engineering pitfalls most often occur.

    4.2 Factorized Embeddings (Low-Rank Decomposition)

    The embedding matrix has inherent redundancy: semantic correlations among tokens mean this high-dimensional matrix can be approximated by a low-rank structure. The classic approach introduces an intermediate dimension much smaller than the hidden dimension, splitting the large “vocabulary size × hidden dimension” matrix into two smaller ones: “vocabulary size × intermediate dimension” and “intermediate dimension × hidden dimension.” With an intermediate dimension of 128 to 256, parameter count typically shrinks severalfold while the impact on quality can be kept small.

    4.3 Input–Output Weight Sharing

    Many models use two independent parameter sets for the input embedding and the output projection by default. Enabling weight tying lets the output layer reuse the transpose of the input embedding, immediately eliminating an entire copy of the vocabulary parameters. This is a common technique during training, and an existing model can also be switched over through continued training.

    4.4 Aggressive, Vocabulary-Specific Quantization

    Quantization is standard practice for on-device deployment, but a frequently overlooked detail is that the embedding layer and the backbone have different quantization sensitivities and deserve separate strategies. The vocabulary is a lookup table that does not participate in the accumulation of matrix multiplications, so it tolerates low-bit representations relatively well and can withstand more aggressive bit-widths than attention layers. Combined with freezing, the vocabulary can even be quantized offline and stored in a dedicated format, read directly via mapping at inference time—further reducing memory bandwidth pressure.

    5. End-to-End Implementation Recommendations

    Combining the techniques above, a feasible optimization pipeline for on-device small models looks like this:

    1. Audit the parameter distribution: First measure the vocabulary’s share of parameters and the token frequency distribution to confirm the optimization headroom.
    2. Prune the vocabulary: Trim the vocabulary to the target scenario and update the tokenizer in sync.
    3. Apply structured compression: Use factorized embeddings and weight tying, with continued training as needed to recover quality.
    4. Freeze the vocabulary: Freeze the vocabulary during subsequent fine-tuning to lock in the gains and save training resources.
    5. Layered quantization: Apply different bit-width strategies to the vocabulary and the backbone, completing vocabulary quantization offline.
    6. On-device validation: Measure model size, loading latency, peak memory, and task metrics on real devices—not just paper parameter counts.

    When evaluating, remember: on-device experience is determined jointly by disk footprint, memory usage, time-to-first-token, and power consumption. No single metric should be optimized at the expense of task quality. Build a regression test set covering your core tasks and run a full comparison after every compression step.

    6. Conclusion

    The rise of small models has put parameter efficiency back in the spotlight, and the vocabulary—long overlooked—is precisely the most cost-effective optimization target. Freezing the vocabulary matters not only for the training cost it saves, but because it turns the vocabulary into a static asset that can be processed offline, allowing pruning, dimensionality reduction, and quantization to be stacked safely. For teams deploying language models on resource-constrained devices like phones and laptops, doing the vocabulary math first often delivers faster results than wrestling with more complex compression algorithms.