Anchoring the Base Model's Off-Domain Response During Specialization

When a compact language model is fine-tuned on a narrow domain such as grade-school math or medical exams, it gets much better at that domain and noticeably worse at everything else. This loss is often called the specialization tax. Specializing Smaller Language Models towards Multi-Step Reasoning reports that a Flan-T5 model specialized on math "loses almost all its ability to perform CoT on non-math tasks" across BigBench Hard. This note borrows one lesson from generative modeling of data that lies on a thin surface, or manifold. If training data covers only a thin slab of space, the model is constrained only on that slab, and its behavior off the slab is left free to degrade. Fine-tuning data from one domain fills only a thin region of the model's internal activation space. The directions pointing away from that region are the ones general-purpose inputs use, and nothing in the fine-tuning loss protects them.

The proposal is to thicken that thin region during training in a specific way. At an intermediate layer, we add random perturbations to the hidden states of domain examples along directions normal to (pointing away from) the domain's activation manifold. We then require the fine-tuned model to respond to these perturbations the way the frozen original model does. Existing noise regularizers either jitter the input to make the model robust or ask the model to be invariant to noise. Both push the model toward ignoring off-domain directions. We argue that this ignoring is itself the mechanism behind the specialization tax, and that the remedy is to preserve the model's sensitivity in those directions rather than suppress it.

Core Claim

The claim has two parts, and each can be tested on its own. The diagnostic claim is that the specialization tax shows up geometrically as contraction in normal directions. As fine-tuning proceeds, the network's downstream response to perturbations orthogonal to the domain manifold shrinks relative to the base model. The size of this shrinkage across checkpoints should track the drop on out-of-domain reasoning. The method claim is that a stochastic penalty which matches the fine-tuned model's normal-direction response to the base model's recovers much of that drop without hurting in-domain accuracy. The penalty needs only the domain data, the frozen base model, and second-order statistics of general-text activations. It does not need general-text replay.

Two strands of prior work motivate this. Manifold theory for generative models shows that thin support creates trouble concentrated in the normal directions. Representational aspects of depth and conditioning in normalizing flows ties thin support to ill-conditioning and "manifold overfitting," in which the model behaves arbitrarily off the data. Improving the Euclidean Diffusion Generation of Manifold Data by Mitigating Score Function Singularity shows that the normal component dominates what the network learns, while the tangential component carries the actual distribution. Universal Approximation Using Well-Conditioned Normalizing Flows proves that padding the unused dimensions with Gaussian noise, rather than constants, is what keeps the map well-conditioned. We reuse that padding idea directly. Our noise covariance is shaped by how general text actually varies, not by an isotropic Gaussian.

The second strand is interpretability. REMA finds that correct reasoning activations lie on manifolds of intrinsic dimension below 30 inside ambient spaces of 2,048 to 8,192 dimensions. That leaves a very large normal space the fine-tuning loss never touches. Off-Manifold Collapse in Guided Protein Language Models shows that when a model is pushed toward a narrow objective, its activations contract radially toward a centroid. That study only rejects collapsed samples after generation. Our method acts during training so the contraction never forms.

Mechanism

Let $h_\ell(x)$ be the fine-tuned model's hidden state at layer $\ell$ for a domain input $x$. Let $g_\theta(\cdot)$ map a layer-$\ell$ state to output logits through the remaining fine-tuned layers, and let $g_0(\cdot)$ be the same map in the frozen base model. We estimate a local tangent basis of the domain manifold by running PCA on the $k$ nearest domain activations under the base model, refreshed every few hundred steps. From that basis we form the projection $P_\perp(x)$ onto its orthogonal complement. We draw $\epsilon \sim \mathcal{N}(0, \Sigma_{\text{gen}})$, where $\Sigma_{\text{gen}}$ is a low-rank-plus-diagonal covariance of base-model activations on generic text. The training objective is

$$ \mathcal{L}(\theta) = \mathcal{L}_{\text{domain}}(\theta) + \lambda \, \mathbb{E}_{x,\epsilon}\Big\| \big[g_\theta(h_\ell + \sigma P_\perp \epsilon) - g_\theta(h_\ell)\big] - \big[g_0(h_\ell + \sigma P_\perp \epsilon) - g_0(h_\ell)\big] \Big\|^2, $$

Here $\sigma$ sets how far off the manifold the thickening reaches and $\lambda$ weights the anchor. The bracketed differences are finite-difference responses of each model to the same normal perturbation. Matching them preserves the base model's behavior in a slab around the domain manifold. The model stays free to change its behavior on the manifold, because tangential directions are projected out.

The contrast with Improving Pretrained Language Model Fine-Tuning With Noise Stability Regularization (LNSR) is the crux. LNSR adds noise and penalizes $\|h(x)-h(\tilde x)\|$ across layers, and its in-manifold variant restricts noise to $k$-NN tangent directions. Its penalty rewards insensitivity. If applied in normal directions, that is exactly the contraction we hypothesize causes forgetting. LNSR was also studied only on BERT-style encoders for classification. NEFTune adds uniform noise to input embeddings with no anchor, and it was evaluated on broad instruction tuning rather than narrow specialization. Preserve and Sculpt is the nearest geometric-preservation method. It matches Gram matrices between pre-trained and fine-tuned CLIP features, which is deterministic and applies only to observed inputs, and it degrades when data is extremely scarce. Our anchor instead probes unobserved directions stochastically.

The following methods constrain parameter space and are complementary to ours. LoRAM optimizes on the manifold of low-rank weight matrices. Dynamic Orthogonal Continual Fine-tuning projects LoRA gradients away from tracked subspaces of earlier tasks, which requires discrete task boundaries.

Research Program

The first stage is diagnostic and can falsify the idea cheaply. We fine-tune a 7B decoder with LoRA and with full fine-tuning on each domain and save checkpoints along the way. At every checkpoint we measure the normal response ratio: the norm of the fine-tuned model's finite-difference logit response divided by the base model's, averaged over normal perturbations drawn as above. We also compute REMA-style $k$-NN distances from general-task activations to the base model's general manifold. If the response ratio does not fall during specialization, or does not correlate with the BBH drop across checkpoints and runs, the premise fails. In that case we report the result as a negative finding and stop.

The second stage trains with the anchor. We sweep $\lambda$, $\sigma$, and the layer $\ell$, choosing among early, middle, and late layers. The choice of layer matters because LNSR reports that Transformers amplify noise in higher layers, and REMA localizes reasoning divergence to mid-to-late layers. As an optional variant, we anneal $\sigma$ from large to small, following the continuation view of One-Line-of-Code Data Mollification. This is an ablation, not a core claim. The anchor costs one extra forward pass from layer $\ell$ onward for each model, and we charge it against the compute budget.

Proposed Experiments

The primary domain is math. We fine-tune LLaMA-2-7B and Flan-T5-XL on GSM8K training rationales, which are human-written, to avoid the teacher-model dependency. We evaluate in-domain on GSM8K, near-domain on MultiArith, ASDiv, and SVAMP, and the specialization tax on the non-math tasks of BigBench Hard as defined in Challenging BIG-Bench Tasks, plus MMLU. The second domain is biomedical. We fine-tune on MedQA and MedMCQA training data and evaluate on the BioMistral QA suite from BioMistral, with BBH and non-medical MMLU as the tax measures. A third domain, Verilog using the VeriGen corpus and HDLBits, is a stretch goal that tests rigid-syntax specialization.

Every method is reported as a Pareto curve of in-domain accuracy against general-retention accuracy, traced by sweeping each method's own strength hyperparameter. Single points are not used. We run three seeds per setting, because LNSR's main documented benefit is lower variance across seeds.

Baselines

The naive reference is plain fine-tuning on domain data: LoRA at rank 16 and full fine-tuning, with the same token budget, learning-rate search, and number of steps as every other method. It fixes the size of the tax we are trying to close.

The published anchor for math specialization is Specializing Smaller Language Models towards Multi-Step Reasoning. It reports specialized Flan-T5 11B at 27.1% on GSM8K and describes BBH performance as collapsing, but no reported omnibus BBH number was found on Lacuna for that model. We therefore re-measure BBH for our own plain fine-tuned models rather than quote a figure.

The strongest existing competitor on the retention question is general-data replay with a KL penalty to the base model's output distribution. Each step mixes a fraction of generic web text into the batch. Compute is matched by giving replay the same number of extra forward passes that our anchor consumes, and its mixing fraction and KL weight get the same tuning budget as our $\lambda$ and $\sigma$. No reported result was found on Lacuna for replay-plus-KL on GSM8K-to-BBH retention, so we establish it ourselves.

Weight merging is the other strong, cheap competitor. We interpolate each fine-tuned model with the base model using SLERP and sweep the interpolation weight. BioMistral reports that SLERP merging gave a +5.11% average zero-shot gain over the standalone continually pretrained model on its medical suite. That is the number to beat on the biomedical domain.

We include two published noise regularizers at their recommended settings, re-tuned on our validation sets. The first is NEFTune, which reports raising LLaMA-2-7B's AlpacaEval win rate from 29.8% to 64.7%. That is a conversational metric, not a retention metric, so it does not transfer directly. The second is LNSR in both its Gaussian and in-manifold variants.

Three ablations isolate the key ingredients. The first replaces the base-model anchor with LNSR's invariance target while keeping normal perturbations, which isolates anchoring versus invariance. The second keeps the anchor but samples isotropic rather than normal-projected, general-covariance noise, which isolates the geometry. The third projects onto tangent rather than normal directions, which should block domain learning and serves as a sanity check.

Our method counts as beating a baseline only if its Pareto curve dominates that baseline's. Concretely, at in-domain accuracy within one point of plain fine-tuning, it must recover at least half of the BBH drop from base to plain fine-tuning, and it must retain more BBH accuracy than NEFTune, LNSR, and SLERP at matched in-domain accuracy.

Why not just…?

Why not just add NEFTune-style noise to the embeddings? Input noise with no anchor teaches the model robustness on domain inputs. Nothing in it tells the model to keep responding to general-text directions. NEFTune's retention evidence comes from broad instruction data that is itself general, which differs from narrow specialization. The direct test is the NEFTune baseline on the BBH Pareto curve. If it matches our method, the geometric story is unnecessary and we will say so.

Why not just replay general data with a KL penalty to the base model? This is the real threat, and it may well match or beat our method, because it constrains behavior on actual general inputs rather than on a local slab around domain inputs. Local first-order anchoring might not protect behavior on inputs far from the domain manifold. The compute-matched Pareto comparison settles the question. If replay dominates, our contribution reduces to the diagnostic account of why forgetting happens, together with a method for settings where general text cannot be stored or mixed in. We would also test whether the two methods combine.

Why not just use LoRA, or merge with SLERP afterward? LoRA limits the rank of the weight update but not where the update points. The tax Fu et al. report arises in exactly this kind of parameter-efficient regime. Merging trades domain gains for retention along a single interpolation line. Both are run as Pareto baselines. Merging is the one we expect to be hardest to beat on the biomedical suite.

Why not just use isotropic perturbations with our anchor, since almost every random direction is already normal when the intrinsic dimension is under 30? This is fair as dimension counting. Our bet is that general-task directions are a small, high-variance subset of the normal space, so shaping the noise with the general-text covariance is what makes it effective. The isotropic-anchor ablation tests this. If it performs the same, we drop the tangent estimation and keep the simpler method.

Decisive Checks

Three results decide the proposal. First, the normal response ratio must fall during plain fine-tuning and correlate with the BBH drop across checkpoints; without that, the mechanism is wrong. Second, replacing the base-model anchor with LNSR's invariance target, while keeping normal perturbations, must increase the tax rather than reduce it. That result is the sharpest test of the claim that insensitivity causes the forgetting. Third, the anchored method must dominate NEFTune, LNSR, and SLERP on the retention Pareto curve and stay close to compute-matched replay plus KL. Whether it beats, ties, or loses to replay determines whether this is a practical method or mainly an explanation.