Small Language Models: Is Freezing the Embedding Layer Feasible When Vocabulary Share Is High?

    In small models with hundreds of millions of parameters, the embedding table can account for a large share of total weights, affecting storage, loading, and effective compute capacity. This article examines when freezing the embedding layer is a practical option, how shared input-output weights change the implementation, and what training and evaluation steps reduce risk. It also reviews how freezing combines with low-rank decomposition, hashing, clustering, quantization, and input-output sharing, and concludes that the decision should be based on task quality and edge deployment cost rather than compression rate alone.

    1. Background: A Small Model’s “Weight” Is Not Always in Compute Layers

    In the design of small models at the hundreds-of-millions-parameter scale, one often overlooked fact is that model size is not always dominated by the feed-forward layers that perform the actual computation. Looking at the parameter structure, the embedding table maps discrete tokens to continuous vectors, and its parameter count is usually “vocabulary size × hidden dimension.” When the vocabulary is large and the hidden dimension is limited, the embedding table can easily take up a large proportion of total parameters—sometimes more than half in some small models.

    This leads to three direct consequences:

    1. High storage cost: Model files become larger, increasing installation package, cache, and distribution costs on edge devices.
    2. Loading and memory-access pressure: A large matrix must be read or mapped before inference, which affects cold start and memory usage.
    3. Diluted effective compute parameters: The proportion of feed-forward and attention parameters that actually participate in context modeling decreases. The model may “look large,” but its compute capacity is limited.

    Therefore, vocabulary optimization is not simply “model slimming.” It is a parameter-structure problem that small models must address for edge deployment.

    2. Core Idea and Applicable Boundaries of Freezing the Vocabulary

    “Freezing the vocabulary” usually means fixing the embedding matrix so that it does not participate in downstream training or continued pre-training updates, while only the remaining layers are trained. Its value lies in reducing trainable parameters, lowering optimizer state memory, avoiding embedding-table overfitting in small-data scenarios, and keeping the word-vector space stable.

    However, freezing the vocabulary is not unconditionally feasible. It applies to the following scenarios:

    • The pre-trained vocabulary already covers the main tokens of the target task;
    • The downstream task is mainly classification, extraction, rewriting, or fixed-domain question answering;
    • Training data is limited, and embedding-layer updates have low benefit and are prone to overfitting;
    • Edge deployment prioritizes size, loading speed, and stability.

    Scenarios that are unsuitable or require caution include:

    • Multilingual expansion, new symbols, or many new domain terms;
    • Output distribution differs significantly from the pre-training distribution;
    • Input embeddings and output projection share parameters, so freezing may also limit output adaptation;
    • The task depends on fine-grained morphology or long-tail word expression.

    3. Engineering Implementation: Check the Sharing Relationship First, Then Design the Freezing Strategy

    Before implementation, check whether the embedding layer and output layer share weights. If they are shared, freezing the input embedding may also freeze the output projection, affecting the model’s adaptation to the downstream label distribution. If they are decoupled, they can be handled separately. A general pseudocode example is as follows:

    1. def count_params(model):
    2. total = sum(p.numel() for p in model.parameters())
    3. emb = model.token_embedding.weight.numel()
    4. return emb, total, emb / total
    5. def freeze_embedding_only(model):
    6. model.token_embedding.weight.requires_grad = False
    7. frozen = {"token_embedding.weight"}
    8. return frozen
    9. def train_step(model, batch, optimizer, frozen_names):
    10. logits = model.forward(batch.input_ids)
    11. loss = cross_entropy(logits, batch.labels)
    12. loss.backward()
    13. for name, p in model.named_parameters():
    14. if name in frozen_names:
    15. p.grad = None
    16. optimizer.step()
    17. optimizer.zero_grad()

    If input and output are shared, a more granular strategy can be used: freeze the input side and apply low-rank adaptation or a small learning rate to the output side; or first decouple the output projection and then freeze the input embedding. The key is to use a validation set to confirm that freezing has not broken output calibration.

    4. Training Strategy: Freezing Is Not “Leaving It Alone,” but Reallocating Capacity

    After freezing the embedding, training capacity should be concentrated on the feed-forward layers, attention layers, and normalization layers, and differential learning rates can be used for the output layer. A suggested process is:

    1. Count the embedding table’s share and confirm the optimization objective;
    2. On a small validation set, compare the quality gap between “full-parameter fine-tuning” and “frozen embedding”;
    3. If quality drops, first try freezing only the rows corresponding to low-frequency tokens, or apply a low-rank update to the embedding matrix;
    4. Monitor long-tail words, new words, and output calibration metrics;
    5. Set a rollback threshold; if quality does not meet the target, unfreeze or switch to a compression approach.

    5. Combining with Vocabulary Compression: Low-Rank, Hashing, Quantization, and Sharing

    Freezing only controls training parameters. To truly reduce size, vocabulary compression is also needed. Common general methods include:

    • Low-rank decomposition: Approximate the embedding table with two small matrices to reduce storage;
    • Hashed embeddings: Let multiple tokens share a small number of vectors, sacrificing some discrimination;
    • Cluster sharing: Map low-frequency words to similar cluster centers;
    • Quantization: Store the embedding matrix at low bit width and dequantize during inference;
    • Input-output sharing: Reduce duplicate matrices when quality allows.

    These methods should be evaluated jointly with the freezing strategy. Do not look only at compression rate; also examine long-tail word recall, perplexity, and edge latency.

    6. Evaluation and Conclusion

    Evaluation should at least cover model size, cold-start loading time, peak memory, inference latency, task quality, long-tail word performance, and output calibration. The reasonable role of freezing the vocabulary is: in scenarios where the vocabulary is already sufficiently covered and the task distribution is stable, trade a controlled quality loss for lower training and deployment costs. If the task requires vocabulary expansion or the output distribution changes significantly, partial freezing, low-rank adaptation, or a compression combination should be prioritized rather than a one-size-fits-all freeze.

    For small models, the vocabulary is not an auxiliary configuration but a “large block” in the parameter structure. Freezing or compressing it is essentially reallocating model capacity: let more parameters handle computation and fewer parameters handle storage. Whether it is feasible must ultimately be answered by both task metrics and edge deployment cost.