Where Fragmentation Hurts: Output-Side Vocabulary Expansion for Generative Domain Models

When a general language model is adapted to a technical field such as biomedicine, its tokenizer (the fixed list of word pieces it reads and writes) breaks domain terms like "nephropathy" or drug names into arbitrary fragments. The standard remedy is to add whole domain terms to the vocabulary on both sides of the model: the input embedding table and the output prediction layer. This proposal argues that for generative, left-to-right models the two sides should be treated separately. On the input side, fragmentation is probably harmless, because the model's later layers can reassemble a split word once all its pieces have been read. On the output side, it probably is not: a model writing left to right must commit to the first fragment of a term before the term exists, and nothing later in the network can repair a wrong commitment. If that asymmetry holds, the cheaper and safer adaptation is to add domain terms only to the output layer and keep feeding the fragments as input.

The evidence for the input-side half comes from encoders. Biomedical Language Models are Robust to Sub-optimal Tokenization trained BERT from scratch on PubMed with a morpheme-aligned 80k vocabulary. They found essentially no gain over PubMedBERT's frequency-driven 28k vocabulary: BC5CDR-chem F1 was 93.4 versus 93.0. They traced this to higher layers that "repair" fragmented inputs. The authors say explicitly that autoregressive generators may behave differently, and nobody has checked. Meanwhile, Gold Panning in Vocabulary (VEGAD) shows that vocabulary changes in generative LLMs can badly damage general ability: GSM8K accuracy fell from 22.10% to about 6–9% under naive expansion, and to 15.20% even with its gradient-based token selection. So the question of which side needs the new tokens has real consequences for both domain quality and forgetting.

Core Claim

In causal (left-to-right) domain models, the benefit of vocabulary expansion comes mostly from the output layer. Most of the forgetting comes from the input layer, because new input embeddings shift the representations the pre-trained layers were built on. We therefore predict that output-only expansion recovers most of the domain-generation gain of full expansion, with measurably less general-capability loss.

The mechanism works as follows. The model predicts over the union of the base vocabulary and a set of whole-term tokens. At the position where a term begins, the training target is the whole-term token. When the model emits such a token at inference time, the system writes the term's base-tokenizer fragments back into the input. Those fragments are processed in a single forward pass, the same way speculative decoding verifies drafted tokens. Input length therefore does not shrink, but the number of sequential decoding steps for terms does.

Relation to Prior Work

Several papers show that vocabulary matters in domain adaptation, and they motivate this work. PubMedBERT showed that an in-domain vocabulary plus from-scratch training beats general-vocabulary continual pre-training on BLURB, with an overall score of 81.16. BioBART carried domain pre-training to generation but kept the general vocabulary. MonoCoder showed that compact domain-only models can beat much larger general models on HPC code. None of these separates the input side from the output side.

Four expansion methods are the direct competitors, and all of them change both sides or only the input. exBERT adds input embeddings and side modules to a frozen encoder. VE-KD expands a distilled student's vocabulary and finds that performance degrades beyond 60k tokens. VEGAD selects terms by accumulated gradients on both the embedding layer and the output layer, then expands both. Generation with Dynamic Vocabulary encodes arbitrary phrases into both input and output vocabularies at inference time, without any domain pre-training.

We reuse two methods from this literature. The first is VEGAD's gradient criterion for choosing which terms to add; holding it fixed isolates the effect of which side receives them. The second is the convex-hull initialization from An Empirical Comparison of Vocabulary Expansion and Initialization Approaches. Its Constrained Word2Vec (CW2V) method places new vectors as weighted averages of existing ones, and it reported 17.02 versus 11.17 CHRF over OFA on LLaMA 2. Because output-layer rows are also vectors in a space the model already uses, the same geometric argument applies to them.

Research Program

The first stage is a controlled from-scratch study that replicates the encoder robustness experiment for decoders. We train small decoder-only models, in the few-hundred-million-parameter range, on the PubMed corpus used by the robustness paper. There are three tokenizer arms: a general vocabulary, a PubMedBERT-style statistical domain vocabulary, and the morpheme-informed BioVocabBERT vocabulary. Compute is matched by training tokens, and the arms are also compared at matched characters.

Comparisons use tokenizer-independent measures. The first is bits per character, reported separately over term spans and non-term spans. Within term spans we split the loss into the first fragment and the continuation fragments; this split tests the prediction that the damage concentrates on the first fragment. The second measure is the rate at which free generations contain non-existent terms, meaning strings not found in UMLS or the corpus lexicon. The third is a linear probe that reads concept identity (the UMLS concept ID) from the hidden state at a term's last fragment, used to test whether causal models repair terms as encoders do.

The second stage is continual pre-training of a public decoder from the Pythia family, which is the model family used by Efficient Continual Pre-training, on the same PubMed text. The design crosses expansion side with initialization. The side factor has four levels: none, input-only, output-only, and both. The initialization factor has two levels: subword mean and CW2V. The term set in every arm is the same top-K list chosen by VEGAD's gradients, and K is swept to locate each arm's peak.

Baselines

The naive reference point is plain continual pre-training with the base tokenizer, run on the same data, steps, and learning-rate sweep as every other arm. If output-only expansion does not beat it on domain generation, the proposal fails outright.

The strongest existing method is VEGAD's full both-sided expansion, which on legal Article QA reports BLEU 28.58 against 28.04 for Jieba-based expansion and 26.70 for standard fine-tuning. For its English PubMedQA experiment, the research file contains no reported number, so no reported result was found on Lacuna for VEGAD on English PubMedQA. We will therefore reimplement it on our data, and it will receive the same K sweep and tuning budget as our method. It is the strongest competitor because it already addresses the main failure of naive expansion.

A second strong comparison is both-sided expansion with CW2V initialization. It combines the best available selection method with the best available initialization, and it tests whether better initialization alone removes the forgetting we attribute to the input side.

The input-only arm is the ablation that isolates the key ingredient. If the core claim is right, it should match no-expansion on generation while costing some general ability.

Beating the baselines means the following. Output-only expansion must reach at least the both-sided arm's domain score on MeQSum Rouge-L, on CovidDialog BLEU, and on BC5CDR entity linking treated as generation, where exact-match accuracy is the reference metric. It must also retain strictly more of the base model's GSM8K and MMLU accuracy, averaged over three seeds with confidence intervals. As an external anchor, BioBART reports MeQSum Rouge-L of 53.15 against 51.05 for general BART-Large.

Why not just…?

Why not just keep the base tokenizer and rely on continual pre-training? The encoder result suggests this might be enough, and it is the cheapest option. Two findings cut against it. PubMedBERT found that general vocabularies lengthen sequences and weaken learning. The cross-lingual expansion study measured Tamil words splitting into nearly 29 pieces, reduced to 2.8 after expansion. What neither shows is harm to generation specifically. The first stage measures this directly through the first-fragment loss and the non-existent-term rate. If the decoder turns out to repair terms as well as encoders do, we will report that and drop the method.

Why not just use VEGAD with better initialization on both sides? This is the real threat. If CW2V initialization stops input-side embeddings from disturbing the pre-trained layers, then both-sided expansion could equal output-only expansion on forgetting while also shortening inputs. The crossed design settles this question. If the both-sided CW2V arm matches output-only on GSM8K and MMLU retention, our forgetting argument fails. The remaining case for output-only expansion would then be the smaller one of sparing embedding parameters, and we would say so.

Why not just constrain decoding with a domain term dictionary? A prefix tree over valid terms could block non-existent terms at generation time with no retraining. It cannot, however, fix a wrong or overly confident first-fragment choice, and it adds no knowledge. We include trie-constrained decoding on the no-expansion model as an extra arm. If it closes the gap in term validity, then output-only expansion must justify itself through task scores and fewer decoding steps alone.

Why not just go byte-level? ByT5 removes the vocabulary problem entirely. It does so at the cost of sequences several times longer and a redesigned asymmetric architecture, which rules out adapting an existing decoder. We treat it as out of scope, but report bits per character so the results remain comparable to byte-level models.

Decisive Checks

The idea stands or falls on three results. First, in the from-scratch study, first-fragment loss on terms must be substantially higher than continuation loss, and higher under the general vocabulary than under the domain vocabulary; this confirms that the damage sits at the moment of commitment. Second, the probe must recover concept identity at the last fragment about as well as a single-token model does; this confirms that input-side repair survives causal attention. Third, in continual pre-training, output-only expansion must match both-sided expansion on domain generation while forgetting less. If the probe fails, meaning causal models do not repair fragmented inputs, the asymmetry claim is wrong, and both sides need expansion after all.