NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Provenance-Gated Residual Scaling for Vocabulary-Expanded Domain Pre-Training

When a general language model is adapted to medicine, law, or IT support, practitioners often add new tokens for technical terms. A term like "acetaminophen" then becomes one token instead of five generic fragments. Each new token gets a fresh embedding vector, and the model is then trained further on domain text, a step called continued domain pre-training. These fresh vectors are poorly calibrated relative to the deep layers that were trained without them. Training therefore starts with a loss spike, and the large early gradients flowing back from the new tokens disturb the pretrained weights everywhere, which costs the model some of its general ability. Today the repair happens only at the input. Practitioners initialize new embeddings cleverly, or they freeze the backbone for a while.

We propose a repair inside the network's skip connections. Every transformer block adds its output to a running "residual stream" at each token position. We give positions that hold newly added tokens their own learnable, per-channel scale on that addition, initialized near zero. Positions holding original tokens keep the pretrained behavior exactly. A new token therefore starts by passing through the network close to its initialized embedding. Its gradient contribution to the backbone weights is also damped in proportion to the scale. As the embedding matures, the scale learns to open. The idea in two sentences: residual scaling methods such as ReZero damp every token equally to keep training stable, but in vocabulary expansion only some tokens are uncalibrated. We condition the damping on whether the token is new, so the shock is absorbed where it originates without slowing the rest of the model.

Core Claim

Our hypothesis is that a residual scale conditioned on token provenance gives a better trade-off between domain gain and general-ability retention than input-side fixes alone, at matched compute. The trade-off we mean is downstream domain accuracy measured against held-out general perplexity and general benchmark accuracy. The comparison targets are subword-averaged or alignment-based initialization, with or without the freeze-then-unfreeze schedule. The secondary claim is diagnostic. The learned scale's trajectory per layer gives a measurable signal of when new tokens have been absorbed. That signal can replace the hand-chosen switch point in staged schedules.

Mechanism

Let $x_{l,t}$ be the residual stream at layer $l$ and position $t$, let $f_l$ be the block's attention or feed-forward branch, and let $p_t \in \{0,1\}$ mark whether the token at position $t$ is newly added. The gated block is

$$x_{l+1,t} = x_{l,t} + \big[(1-p_t)\,\mathbf{1} + p_t\, a_l\big] \odot f_l(x_l)_t,$$

where $a_l$ is a learnable per-channel vector initialized to a small constant $\epsilon$, in the style of LayerScale, and $\mathbf{1}$ is the all-ones vector, so original-token positions reproduce the pretrained block exactly. Because the scale multiplies the branch, the gradient on the block's weights $\theta_l$ decomposes position by position:

$$\frac{\partial \mathcal{L}}{\partial \theta_l} = \sum_t \frac{\partial \mathcal{L}}{\partial x_{l+1,t}} \big[(1-p_t)\mathbf{1} + p_t a_l\big] \odot \frac{\partial f_l(x_l)_t}{\partial \theta_l}.$$

Shrinking $a_l$ therefore directly shrinks the backbone updates that come from new-token positions, and nothing else changes. We also test a second variant that replaces learned $a_l$ with a per-token schedule $a(t) = 1 - e^{-n_t/\tau}$. Here $n_t$ is the number of updates token $t$'s embedding has received, and $\tau$ sets how fast the gate opens. This is a per-token version of BranchNorm's global ramp. Both variants add one vector per block and no extra forward pass.

Two limits are stated up front. First, original-token positions still attend to new-token keys and values, so some contamination travels through attention. We measure this rather than assume it away, and we test an optional variant that also gates value vectors at new positions. Second, in decoders the output-side shock comes from new rows of the prediction layer. A forward gate cannot condition on the target token without leaking it. Every arm, including every baseline, therefore uses the same small-initialized new output rows. The gate addresses only the input side.

Relation to Prior Work

The residual-scaling line supplies the method. ReZero multiplies each branch by a scalar initialized to zero. SkipInit does the same and shows that batch normalization's benefit comes largely from biasing blocks toward identity. LayerScale uses a per-channel vector initialized near $10^{-5}$ to train 48-layer vision transformers. BranchNorm ramps a global branch scale from 0 to 1 to avoid undertraining. LAuReL learns residual weights and low-rank residual paths in general language models. All five apply the same scale to every token and all start from scratch. We instead act on a pretrained model, leave the original tokens' computation untouched, and condition the scale on token identity. That conditioning is absent from all five.

The vocabulary-adaptation line supplies the problem and the strongest competitors. TokAlign initializes new embeddings from their nearest source tokens, using similarities between embeddings trained separately on each token space. It then trains the embeddings with the backbone frozen before unfreezing. Its initial perplexity is still $1.2\times10^2$ and recovery takes 5,000 steps, which motivates our work. IndoBERTweet shows that subword averaging lets 200k domain steps beat a 1M-step from-scratch model. AVocaDo regularizes new-vocabulary representations with a contrastive loss that needs a second forward pass. It notes that extending to generative decoders is open. All three intervene at the input or the loss, never inside the blocks.

The domain-modeling line sets the regime and the evaluation. BioMegatron shows that entity tasks depend on how often domain terms are fragmented. A 345M model with a domain vocabulary beats a 1.2B general-vocabulary model on BC5CDR. This tells us vocabulary expansion is worth stabilizing. Multi-Stage Pre-training for Low-Resource Domain Adaptation expands RoBERTa-large's vocabulary for IT support and gives us a second domain. BioClinical ModernBERT runs large two-phase continued pre-training with an expanded vocabulary but standard residuals. We treat it as a scale reference, not something to reproduce.

Research Program

We build the gate into two settings that share one code path. The first is a 12-layer encoder, RoBERTa-base-sized. Its vocabulary is expanded with PubMed-derived terms chosen by AVocaDo's fragment score, and it receives continued masked-language-model training on PubMed abstracts. The second is a Pythia-family decoder from the TokAlign setup, expanded with the same biomedical terms and trained autoregressively. A second domain repeats the encoder setting on IBM Technotes and AskUbuntu, using the expansion procedure of the multi-stage paper. All arms see identical token streams and identical new-token sets. The general-text replay fraction is held fixed across arms at 0% in the main runs. A separate 10% replay condition tests whether the gate's benefit survives replay.

The analysis has three parts. First, we log the spike: peak loss, steps to return to pre-expansion domain loss, and the norm of backbone weight updates in the first 2,000 steps, split by originating position type using the gradient decomposition above. Second, we trace the frontier between domain gain and general retention as checkpoints accumulate. Third, we read the learned $a_l$ per layer over time and test whether gates open faster for frequent new tokens and in later layers. We also test whether the gate's crossing of a threshold predicts the step at which unfreezing helps in the staged baseline.

Baselines

The naive reference is vocabulary expansion with randomly initialized new embeddings and plain full-parameter continued training. TokAlign reports that this setting starts at a perplexity of $3.4\times10^2$. We also run the no-expansion reference, which uses the original tokenizer with the same continued training. It tells us whether expansion is worth having in this regime at all.

The strongest competitor is TokAlign-style alignment initialization with its freeze-then-unfreeze schedule. It is the only published method in the file that explicitly targets the post-expansion spike. Its frozen stage is the hard version of what our gate does softly. We tune its freeze length over the same budget of trials we give our method's $\epsilon$ and $\tau$. Its reported figures, initial perplexity of $1.2\times10^2$ and recovery within 5,000 steps, come from a different model pair. We rerun it rather than compare across papers. Subword averaging, as in IndoBERTweet, is the second input-side baseline. Our gate is always layered on the best input-side initialization, so the comparison isolates the internal mechanism.

The key ablation is global LayerScale or ReZero-style scaling on all positions with the same initialization. If it matches the provenance-gated version, the conditioning on token identity is not doing the work. A second ablation compares learned $a_l$ with the count-based schedule, and both with a fixed scale that never opens.

For downstream reference points from the file: BioMegatron-345m with a 30k domain vocabulary reports 92.9 F1 on BC5CDR-chem. With a 50k vocabulary it reports 77.0 F1 on ChemProt. BioMegatron-1.2b reports 47.4% strict accuracy on BioASQ-7b. The multi-stage paper reports 56.7 test F1 on TechQA reading comprehension and 0.672 MAP on AskUbuntu duplicate detection. For NCBI-Disease, no reported result was found on Lacuna. These come from models trained with far more domain compute, so they are ceilings for context, not targets.

Beating the strongest baseline means one of two outcomes, at equal tokens and tuning budget, across three seeds. The first is strictly better general retention at equal domain F1. The second is equal retention at higher domain F1. Either must hold on at least two of the four domain tasks and in both domains.

Why not just…?

Why not just use a good embedding initialization and freeze the backbone first, as TokAlign does? This is the real threat, and we treat it as the hypothesis to beat, not a strawman. Freezing blocks all backbone learning, including useful adaptation from original-token positions. The switch point is also chosen by hand. Our gate damps only the new-token contribution and opens on its own. If the tuned staged schedule matches our frontier within seed noise, we will report that the internal gate adds nothing beyond a convenient switching signal. The spike-recovery and frontier comparisons settle this directly.

Why not just apply ReZero or LayerScale to every token? Applied to a pretrained model, near-zero global scales would erase the pretrained function. Applied with scales near one, they do not damp anything. A global scale has no way to treat calibrated and uncalibrated tokens differently. The global-scale ablation at matched initialization tests whether provenance conditioning is the active ingredient. A null result here would falsify the core claim.

Why not just clip gradients, lower the learning rate on new embeddings, or add AVocaDo's contrastive loss? Gradient clipping and per-group learning rates are cheap. We include both as tuned additions to the strongest baseline. They limit how fast the new embeddings change, but they do not limit how much those embeddings' errors move the shared weights. Our gradient decomposition measures exactly that quantity. AVocaDo's regularizer needs a second forward pass and was validated only on small-data classification fine-tuning. We run it on the encoder setting at matched wall-clock, not matched steps, so its doubled cost is visible.

Why not just mix in general data to prevent forgetting? Replay addresses forgetting but not the early spike, and it spends domain tokens. The replay condition tells us whether the gate's retention benefit is additive to replay or redundant with it.

Proposed Experiments and Decisive Checks

The first decisive check is the spike. With the best input-side initialization in every arm, the gated model should show a smaller peak loss and fewer recovery steps than full unfrozen training. It should also show a smaller backbone update norm attributable to new-token positions. It should be no worse than the tuned staged schedule on any of these measures.

The second check is the frontier. We plot domain F1 on BC5CDR-chem, NCBI-Disease, ChemProt, and BioASQ-7b, plus TechQA and AskUbuntu in the second domain, against held-out general-text perplexity. Decoder runs add BoolQ accuracy. The gate must dominate the staged baseline and the global-scale ablation to support the claim.

The third check is interpretability. The learned gates should open in an order that tracks new-token frequency. The threshold-crossing step should fall within the range of freeze lengths that tuning found best for the staged baseline. If it does, the gate replaces a hyperparameter search with a measurement.

Failure on the first two checks against the staged baseline, or success of the global-scale ablation, would mean the claim is wrong. We would report it as such.