Adapting large language models (LLMs) to specialized domains often comes with a hidden cost: the so-called "alignment tax." Fine-tuning on domain-specific tasks can trigger catastrophic forgetting, where the model loses its general capabilities. A new paper from Hugging Face researchers introduces MemSFT, a method designed to sidestep this trade-off by decoupling domain specialization from backbone parameter updates.
Instead of modifying the core model, MemSFT trains an external parametric memory to mimic the behavior of a non-parametric retriever over domain data. This memory effectively captures the knowledge and patterns that would otherwise be accessed via retrieval. During generation, a learned router dynamically fuses the output distributions of the memory and the backbone at each decoding step, allowing domain expertise to be invoked selectively without disturbing the base model's general knowledge.
The researchers evaluated MemSFT across three domains—biology, geoscience, and law—using models ranging from Qwen3-8B to Qwen3-235B-A22B. Results show that MemSFT consistently improves domain performance with negligible degradation in general performance, whereas full supervised fine-tuning (SFT) suffers severe forgetting on general tasks.
A notable advantage is reusability: a single domain-specific 8B memory can be applied across different Qwen3 backbones, from 8B to 235B-A22B. The paper also reports that adapting four backbones with MemSFT requires only 0.22 times the FLOPs of full SFT, highlighting its computational efficiency.