Freezing Vocabulary Parameters in Small Models: A Practical Guide to Embedding Overhead

    Vocabulary embeddings can account for a substantial share of a small language model’s parameters. This article explains what freezing vocabulary-related parameters does—and does not—save, when the approach is appropriate, and how to implement it. It covers parameter grouping, tokenizer compatibility, training strategies, checkpoint management, and evaluation of both task quality and resource savings.

    1. Why Vocabulary Overhead Matters More in Small Models

    Models with fewer than one billion parameters are increasingly used for classification, extraction, summarization, question answering, lightweight conversation, and on-device inference. As models shrink, however, vocabulary-related parameters do not necessarily shrink at the same rate.

    The input embedding matrix contains approximately vocabulary size × hidden dimension parameters. If the output projection does not share weights with the input embeddings, it adds another matrix of roughly the same size.

    For small models, these matrices can represent a substantial share of total parameters. With a large vocabulary, a relatively wide hidden dimension, or a very small model, their combined share can approach 60% or more.

    The basic calculation is:

    • Input embedding parameters ≈ vocabulary size (V) × hidden dimension (d).
    • With untied input and output weights, output projection parameters ≈ (V × d).
    • With tied weights, vocabulary-related parameters ≈ (V × d).
    • Vocabulary parameter share ≈ vocabulary-related parameters / total model parameters.

    For a model with (P) total parameters and tied embeddings, the share is approximately:

    [
    \frac{V \times d}{P}
    ]

    If (V = 50{,}000), (d = 256), and (P = 20) million, the embedding matrix contains about 12.8 million parameters—more than 60% of the model. If (V = 32{,}000), (d = 512), and (P = 100) million, tied embeddings account for roughly 16%; untied input and output matrices account for roughly 33%.

    The 60% figure is therefore not a constant. It depends on vocabulary size, hidden dimension, weight tying, and total model size. The smaller the model, the more visible this relatively fixed overhead becomes.

    Vocabulary overhead also extends beyond parameter count:

    • During training, embeddings can require gradients, optimizer states, communication, and GPU memory.
    • During inference, the embedding matrix must remain in memory.
    • In multi-tenant fine-tuning, storing a complete parameter copy for every task increases storage costs.

    Freezing vocabulary-related parameters addresses some of these costs by stopping updates to the embedding matrix, the output projection, or both, while allowing task heads or other model parameters to train.

    This is not the same as freezing the entire model, nor does it remove the embedding matrix or automatically reduce inference memory. Its primary benefits concern optimizer states, gradients, and gradient synchronization. Whether it works well depends on vocabulary coverage, task requirements, and deployment constraints.

    2. What Exactly Should Be Frozen?

    Before implementation, define which parameters the policy covers.

    Freeze Only the Input Embeddings

    This can suit tasks whose input distribution remains close to pretraining data but whose output layer still needs adaptation.

    The advantage is that the output projection can continue learning. However, if input and output weights are tied, freezing the input embeddings also freezes the shared output weights.

    Freeze Both Input Embeddings and the Output Projection

    With tied weights, these are typically frozen together. With untied weights, each matrix can be controlled independently.

    This approach is most suitable when the task’s output space is stable and the existing vocabulary adequately covers the target domain.

    Freeze Most Rows but Keep Selected Rows Trainable

    A small set of rows can remain trainable for frequent task-specific tokens, domain keywords, or newly added tokens.

    Row-level masks or sparse parameter groups can support this strategy, but they increase implementation complexity.

    Freeze the Embedding Module and Add an Adapter

    A lightweight adapter after the embeddings, a low-rank adaptation module, or a bottleneck layer can compensate for fixed embeddings.

    This limits vocabulary updates while preserving some ability to adapt representations.

    Pin the Tokenizer Version First

    The tokenizer and vocabulary version must be fixed before freezing.

    Changing the vocabulary can create checkpoint incompatibilities and inconsistent tokenization at deployment. Changes to existing token IDs are particularly risky. A safer sequence is to assess coverage first, decide whether vocabulary expansion is necessary, and then version the resulting tokenizer and model together.

    If new tokens are added, their embedding rows need separate training.

    3. When Freezing Helps—and When It Does Not

    Freezing vocabulary-related parameters is most appropriate in the following situations:

    • In-domain fine-tuning with adequate vocabulary coverage: The existing vocabulary represents the target corpus well, with few unknown tokens.
    • Resource-constrained or multi-tenant training: Reducing peak GPU memory, optimizer states, and duplicated task storage is important.
    • Adaptation centered on task-specific layers: Classification heads, sequence-labeling heads, or lightweight adapters handle most of the transfer.
    • Training stability is a priority: Updating a large embedding matrix during small-model fine-tuning can cause representation drift; freezing reduces the number of changing components.
    • Deployment is fixed: The tokenizer and vocabulary version will remain stable over time.

    Freezing is less suitable as a default in these cases:

    • Cross-lingual or substantial domain transfer: New terminology, proper nouns, and morphological patterns may be poorly represented.
    • A tokenizer poorly matched to the domain: The underlying issue may require vocabulary pruning or redesign rather than a different freezing policy.
    • Tasks that depend heavily on new token representations: Examples include code, chemical formulas, legal terminology, and product identifiers.
    • An output space that must expand: New labels or entity types may require training the relevant output mapping.
    • A large distribution shift from pretraining: Fixed embeddings may limit adaptation to the new data.

    A practical decision process is to assess vocabulary coverage and unknown-token behavior, then run short controlled experiments. Proceed to larger training runs only if the quality loss is acceptable and the memory or throughput gains are meaningful.

    4. Implementation Workflow

    Step 1: Establish a Baseline

    Before freezing, record:

    • Task metrics
    • Validation loss
    • Peak GPU memory
    • Training throughput
    • Steps to convergence
    • Checkpoint size

    Without a baseline, neither the savings nor the quality trade-offs can be quantified.

    Step 2: Group Parameters and Control Gradients

    Set vocabulary-related parameters to requires_grad=False and exclude them from the optimizer.

    In distributed training, correctly configured frozen parameters do not require gradient synchronization, which can reduce communication. Also check that mixed-precision handling, gradient clipping, and weight decay do not incorrectly include frozen parameters.

    The following framework-independent pseudocode illustrates the grouping process:

    1. # Freeze vocabulary-related parameters and optimize only the rest.
    2. def setup_trainable_params(model, tie_input_output=True):
    3. frozen_prefixes = ["token_embedding"]
    4. if tie_input_output:
    5. frozen_prefixes.append("output_projection")
    6. trainable = []
    7. frozen = []
    8. for name, param in model.parameters_with_name():
    9. if any(name.startswith(p) for p in frozen_prefixes):
    10. param.requires_grad = False
    11. frozen.append(name)
    12. else:
    13. param.requires_grad = True
    14. trainable.append(param)
    15. return trainable, frozen
    16. trainable, frozen = setup_trainable_params(model, tie_input_output=True)
    17. optimizer = build_optimizer(trainable, lr=base_lr)
    18. # Frozen parameters are excluded from the optimizer,
    19. # so no corresponding optimizer states are created.

    Actual parameter names and weight-sharing behavior must be checked in the model implementation. When weights are tied, freezing the shared parameter affects both input and output use.

    Step 3: Revisit the Learning Rate and Training Strategy

    Do not automatically reuse the learning rate from full-parameter fine-tuning. Freezing the vocabulary changes the trainable parameter set and can alter optimization behavior.

    Run a small learning-rate sweep and monitor how quickly task-specific layers converge. If fixed embeddings constrain adaptation, consider a lightweight adapter before unfreezing the entire vocabulary.

    Step 4: Version Checkpoints and Tokenizers Together

    Checkpoint metadata should record:

    • Tokenizer version
    • Vocabulary size
    • Whether input and output weights are tied
    • Frozen parameter names
    • Trainable parameter names

    Deployment must use the matching tokenizer. Token-ID mismatches can cause accuracy problems that are difficult to diagnose.

    Freezing alone does not make a full-model checkpoint smaller. Per-task storage savings depend on avoiding repeated storage of the unchanged base parameters.

    Step 5: Monitor and Define a Fallback

    During training, monitor task metrics, validation loss, gradient norms, peak GPU memory, and throughput.

    If validation performance remains consistently below the baseline, move to partial unfreezing or allow selected embedding rows to train.

    Make the freezing policy configurable rather than hard-coded so that it can be changed across tasks.

    5. Evaluate More Than Task Scores

    A useful evaluation should cover at least the following dimensions:

    • Task quality: Accuracy, F1, recall, or generation quality, depending on the task.
    • Language-modeling behavior: Validation loss or perplexity, where applicable, to track changes in model behavior.
    • Vocabulary coverage: How well the fixed vocabulary represents the target corpus, including unknown-token rates.
    • Resource savings: Peak GPU memory, optimizer-state size, checkpoint size, and training throughput.
    • Convergence cost: Steps and total training time required to reach the target quality.
    • Inference behavior: Time to first token, throughput, and memory usage.
    • Stability: Variance across random seeds and performance on long-tail cases.

    A simple coverage estimate can be written as:

    1. def token_coverage(dataset_tokens, fixed_vocab):
    2. hit = 0
    3. total = 0
    4. for token in dataset_tokens:
    5. total += 1
    6. if token in fixed_vocab:
    7. hit += 1
    8. return hit / max(1, total)

    This measures membership for the supplied token units. Interpret it carefully: if dataset_tokens already consists of tokens produced by the same fixed tokenizer, membership alone says little about whether domain terms are represented effectively. Excessive fragmentation can still indicate a poor vocabulary fit.

    If coverage is inadequate, freezing is usually not the first step. Assess vocabulary pruning, expansion, or tokenizer redesign before committing to the strategy.

    6. Risks and Best Practices

    Do Not Use Freezing to Hide Vocabulary Design Problems

    If domain terms are repeatedly split into unsuitable fragments, the tokenizer may be the bottleneck. Freezing does not fix that mismatch and may limit adaptation.

    Verify Input–Output Weight Tying

    Freezing tied embeddings also freezes the shared output weights. Untied matrices can be controlled separately.

    Train Newly Added Token Rows

    After vocabulary expansion, new rows need training even if existing rows remain frozen. Maintain consistent token-ID mappings and deployment compatibility.

    Try Partial Unfreezing Before Full Unfreezing

    If quality is insufficient, first consider unfreezing selected frequent-token rows, the output layer, or adaptation modules rather than the entire matrix.

    Run Controlled Comparisons

    At minimum, compare:

    1. Full-parameter fine-tuning
    2. Frozen vocabulary-related parameters
    3. Frozen vocabulary-related parameters with lightweight adaptation

    Avoid making a deployment decision from a single run.

    Avoid Duplicating Frozen Weights Across Tenants

    Freezing can reduce per-task checkpoint storage only when unchanged weights are not copied into every task artifact. If each task still stores the complete model, the storage benefit is limited.

    Container platforms, object storage, and logging or monitoring systems can support versioned deployment, but tokenizer and vocabulary versions must remain consistent throughout.

    7. Conclusion

    As small models become capable enough for everyday tasks, vocabulary-related parameters account for a more noticeable share of their cost.

    Freezing these parameters is not a universal compression method. It is an engineering trade-off that can reduce optimizer-state memory, gradient storage, and communication when vocabulary coverage is adequate, task-specific adaptation does most of the work, and deployment versions remain stable.

    The same approach can limit quality when the target domain contains many new terms, differs substantially from pretraining data, or is poorly served by the tokenizer.

    Start by calculating the vocabulary parameter share and assessing coverage. Then run short controlled comparisons and make the final decision using both task quality and resource savings. The goal is not simply to skip embedding updates, but to identify which parameters should remain stable, which capabilities need training, and how to keep tokenizers and checkpoints compatible over time.