MemSFT: Mitigating Alignment Tax with an External Parametric Memory

Jiarui Wang, Xiang Shi, Jiaqi Cao, Rubin Wei, Xiquan Wang, Hao Sun, Jingzhi Wang, Zhiqi Yang, Qipeng Guo, Bowen Zhou, Zhouhan LinarXiv 2026

TL;DR

MemSFT mitigates the "alignment tax"—the catastrophic loss of general capabilities when fine-tuning large language models (LLMs) for specialized domains—by introducing a plug-and-play external parametric memory. By keeping the backbone LLM frozen and using a learned token-level router to dynamically fuse backbone and memory outputs, MemSFT achieves massive domain performance gains with virtually zero degradation in general reasoning skills.

What Problem Does This Paper Address?

When we try to adapt a general-purpose LLM to highly specialized fields like biology, geoscience, or law, the standard approach is Supervised Fine-Tuning (SFT). However, updating the model's core parameters on domain-specific data often triggers catastrophic forgetting. The model gets smarter in the target domain but dumber overall, losing its hard-won instruction-following, mathematical reasoning, and conversational abilities. This trade-off is known as the alignment tax.

While Parameter-Efficient Fine-Tuning (PEFT) methods like LoRA reduce parameter updates, recent studies show they still suffer from a strong inverse relationship between domain expertise and general capability retention. The authors of this paper ask: Can we completely decouple domain specialization from the core backbone model parameters?

Methods

The authors propose MemSFT (Memory-assisted Supervised Fine-Tuning), a modular framework consisting of three main components:

  1. Retrieval-Based Supervision: First, they build a token-level datastore from the domain SFT corpus. This datastore acts as a non-parametric retrieval-augmented generation (RAG) teacher, providing a rich distribution of domain-relevant tokens for any given context.
  2. External Parametric Memory: Instead of fine-tuning the backbone, they train a separate, smaller language model (the "Memory LM") to mimic the output distribution of this RAG teacher. This forces the Memory LM to internalize domain-specific knowledge and patterns.
  3. Learned Token-Level Router: During inference, both the backbone LLM and the Memory LM remain frozen. A lightweight, two-layer MLP router looks at the hidden states and output confidences of both models at each decoding step to predict a dynamic interpolation weight ($\lambda_t$). The final next-token distribution is a linear combination of both models' outputs.

Because the memory training is independent of the backbone, a single trained domain memory can be reused across different backbone sizes (e.g., from an 8B model up to a 235B model) as long as they share a compatible tokenizer.

Overview of MemSFT architecture showing memory training, router training, and dynamic inference fusion.

Datasets

The framework was evaluated across three distinct specialized domains:

  • Biology-Instructions (BioIns): A multi-omics sequence-understanding dataset spanning 21 tasks across DNA, RNA, and protein data.
  • OpenSWI: A geoscience dataset focused on surface-wave dispersion-curve inversion, heavily featuring numerical arrays and structured profiles.
  • DISC-Law-SFT & LawBench: Datasets used to evaluate legal knowledge and professional textual reasoning capabilities.

General capabilities were tracked using standard benchmarks: MATH-500, C-Eval, IFEval, MMLU-Redux, and INCLUDE.

Key Insights and Ideas

  • The Power of Token-Level Routing: A fixed global mixing weight ($\lambda$) creates a harsh trade-off curve. If $\lambda$ is too low, the model ignores the memory; if it's too high, general reasoning collapses. The learned router solves this by varying the memory's influence token by token. It selectively calls upon the memory for domain-heavy terms (like numerical arrays or biological sequences) while letting the backbone handle function words and general logic.
  • Cross-Scale Reusability: Because the memory module is decoupled from the backbone, an 8B memory module trained once can be plugged directly into a 14B, 32B, or even a massive 235B Mixture-of-Experts (MoE) backbone. This makes domain adaptation highly scalable.
  • Massive Compute Savings: Training a single shared memory module and only optimizing lightweight routers for individual backbones drastically cuts down adaptation compute. Adapting four different Qwen3 backbones using MemSFT required only 9.23 EFLOPs—just 22% of the compute needed for full SFT across all four models.
Analysis showing that learned token-level routing beats fixed interpolation and that larger memory sizes scale domain performance without hurting general capabilities.

Key Results

MemSFT consistently hit the "Ideal Zone"—achieving high domain performance with practically lossless general capability retention.

  • Biology (BioIns): On Qwen3-14B, full SFT improved the biology score significantly (+34.52) but caused a catastrophic drop in general capabilities (-31.39 points on average, collapsing on MATH-500 and IFEval). MemSFT achieved an even higher biology boost (+36.28) while actually slightly improving the general benchmark average (+0.40).
  • Geoscience (OpenSWI): MemSFT achieved the lowest Root Mean Squared Error (RMSE) for numerical profile generation across 8B, 14B, and 32B scales, outperforming both full SFT and LoRA while keeping general capabilities perfectly intact.
  • Law (LawBench): MemSFT matched the domain gains of LoRA (+6.64 vs +6.62) but completely avoided LoRA's -13.51 point penalty on general benchmarks.
Domain performance vs. general capability retention for Biology and Geoscience domains. MemSFT approaches the ideal lossless zone.

Limitations and Future Work

While highly effective, MemSFT currently relies on the memory and backbone sharing a compatible tokenizer and output vocabulary. Transferring a trained memory across completely unrelated model families (e.g., from Qwen to LLaMA) would require an additional vocabulary alignment step, which the authors flag as a promising direction for future work. Additionally, the current memory construction is purely supervised; exploring reinforcement learning to further align the external memory with the frozen backbone remains an open area of research.

Summary updated

BibTeX
@misc{wang2026memsft,
  author = {Jiarui Wang and Xiang Shi and Jiaqi Cao and Rubin Wei and Xiquan Wang and Hao Sun and Jingzhi Wang and Zhiqi Yang and Qipeng Guo and Bowen Zhou and Zhouhan Lin},
  title = {{MemSFT: Mitigating Alignment Tax with an External Parametric Memory}},
  year = {2026},
  eprint = {2607.25614},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.25614},
}
Figure