TECHNOLOGY

Adding vocabulary tokens creates new embedding rows to train

In this article
THE QUICK TAKE

Resizing makes rows available for new token identifiers; it does not automatically give those rows useful learned meaning or preserve a mismatched tokenizer mapping.

A tokenizer vocabulary and a model’s embedding tables must agree on token identifiers. Extending the vocabulary therefore changes a coordinated interface, not just a text file. New entries need valid input rows, compatible output scoring where relevant, and an explicit initialization and training plan before their behavior can be meaningfully evaluated.

An identifier must address a valid input row

The input embedding lookup uses a token identifier to select a learned row. If a tokenizer emits an identifier beyond the table’s capacity, the representation contract is broken. Adding a vocabulary entry therefore requires checking the table size and preserving the mapping of existing entries. Equal vocabulary counts do not prove equal mappings. A reordered tokenizer can send old identifiers to semantically unrelated rows even though every lookup is within bounds, creating an error that a shape-only validation cannot identify.

The output side may need coordinated changes

A causal language model typically scores vocabulary entries through an output projection. If newly added tokens can be predicted, its vocabulary axis must correspond to the extended identifier set. Input and output weights may be tied, so resizing and tying behavior depend on the architecture and library contract. Inspect the documented resize operation rather than manually changing only one apparent table. A model used solely as an encoder can have different output requirements, which is why the intended task must be stated before assuming all vocabulary extensions are identical.

Initialization is not semantic learning

Imagine adding a domain-specific marker that previously required several ordinary pieces. A new embedding row needs initial values, but those values do not automatically reproduce the old multi-token behavior or establish a protocol meaning. Different documented initialization policies can affect the initial output distribution. A subsequent training objective must provide evidence for the new representation. Simply observing that the model no longer raises an index error establishes mechanical compatibility, not useful understanding, improved token efficiency at equal quality or reliable use of the new marker.

Save and verify the coordinated artifact

Preserve the extended tokenizer, model configuration, resized weights and any tied-weight behavior together. Test old-token identity, new-token encoding, input lookup and output candidate mapping on a miniature fixture. If training continues, inspect whether the intended rows are trainable and included in the optimizer. Loading only the old tokenizer later can silently undo the intended interface even when the weights contain extra rows. A complete artifact makes vocabulary extension reproducible and separates structural correctness from the empirical question of how well the added tokens learned their role.

Primary research and implementation references

Reproducible inference stacks: preserving a GPU pilot’s result; A GPU inference benchmark you can trust.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles