You Don't Need Memory Layers: Zero-Forgetting Continual Learning in Standard Pretrained LLMs and MoEs via Write-Once Native Memory
Catastrophic forgetting limits the deployment of Large Language Models (LLMs) that must absorb new facts and skills sequentially without full retraining or replay buffers. Recent work on Sparse Memory Finetuning (SMF) showed that restricting updates to sparse TF-IDF-selected slots in explicit Product-Key Memory (PKM) layers sharply reduces forgetting compared to LoRA and full fine-tuning. However, SMF and its follow-ups require pretraining or retrofitting custom external memory modules, leaving standard off-the-shelf LLMs and Mixture-of-Experts (MoE) checkpoints unable to use them without architectural changes. We show that standard pretrained SwiGLU, GeGLU, and ReLU^2 feed-forward layers already function as large sparse key-value memory banks (350,208 native slots in dense Qwen3-4B, 2.70M router-gated slots in Gemma-4-26B-A4B, and 4.72M router-gated slots in Qwen3-30B-A3B). We formally characterize the single-layer frozen-key interference decomposition with MoE co-activation bounds and the write-once saturation gradient-amplification cliff. Building on this analysis, we introduce Write-Once Native Memory (WONM), a drop-in, zero-replay, zero-extra-parameter continual learning algorithm combining Online Stream-IDF specificity, background hub shielding, write-once slot locking with soft capacity rollover, and clipped per-layer RMS-scaled trust-region sparse SGD on frozen-key W_down columns. For 30B+ MoEs, Sparse-Delta Folding computes exact sparse gradients with zero full-model gradient buffers on a single DGX Spark. Across 1,000 sequential strictly-unknown TriviaQA facts on stock Qwen/Qwen3-4B with zero replay, WONM validates our Memory Capacity Law. At k=64 (21.5% fill), WONM retains 78.0% New F1 with only -4.0% Known forgetting, 93.8% GSM8K, and 73.0% MMLU. At k=128 (43.0% fill), WONM reaches 80.9% to 82.5% New F1 (73.5% Early-100, 3.8x LoRA). Full fine-tuning reaches 46.0% New F1 (-17.4% Known) and LoRA reaches 34.9% New F1 (-24.7% Known). Across 3 independent stream permutations on two families (multiseed_v2_3x_*.json, N=100, MMLU-570, with faithful AdamW LiT and Early-25 / Late-25 tracking), WONM Global (k=256) on Qwen3-4B holds 86.8 +/- 2.1% New F1, 2.6 +/- 0.3% Known forgetting, 70.4 +/- 0.3% MMLU-570, and 0.0017 +/- 0.0000 exact WikiText KL versus 63.7 +/- 1.1% New F1 / 27.0 +/- 4.4% forgetting / 0.0364 KL for mini-batch LoRA and 61.9 +/- 3.3% New F1 / 23.9 +/- 8.9% forgetting / 0.0404 KL for AdamW LiT (10.4x and 9.2x less forgetting at 21.4x to 23.8x lower KL), while WONM Global (k=512) reaches 89.5 +/- 3.0% New F1 (91.5% E25) on Qwen3-4B and 99.0 +/- 0.0% New F1 (100.0% E25 / L25, KL 0.0024) on Llama-family SmolLM2-1.7B versus 27.2% LoRA-mb8 and 44.2% AdamW LiT. On unstructured declarative documents across four models and two architectures (Qwen2.5-0.5B, SmolLM2-1.7B, Qwen3-1.7B, and Qwen3-4B), Self-Consolidated WONM (SC-WONM) reaches up to 59.2% unseen QA F1 versus 27.4% for SEAL-LoRA at 5.5x to 40.9x lower exact full-vocabulary WikiText KL divergence. On zero-contamination 2-hop composition, full-depth and early-mid allocation reach up to 60.0% direct 2-hop accuracy on Qwen3-4B with 100.0% bridge retention at 20x to 356x lower exact KL than mini-batch LoRA (10x to 356x across all LoRA configs) versus 0.0% direct accuracy for LoRA. In a 34-run red-team audit on Qwen3-4B (MMLU-570), WONM beats mini-batch LoRA, L2-SP, LiT, and dense null-space projection on both zero-overlap paraphrases (63.5% Para F1, -6.7% Known) and raw Wikipedia passages (17.5% Exact F1 at -0.8% Known). Finally, on 24 zero-leakage executable Python SDKs across both Qwen3-4B and Llama-family SmolLM2-1.7B, weight-RMS-relative FP32-accumulated WONM reaches 62.5% unseen executable pass rate on both families (66.7% to 75.0% Early-12, up to 100.0% HumanEval-40 retention, and 17x to 155x lower exact WikiText KL) while all four LoRA baselines collapse to 0.0% Early-12. Scaling identically (k=256, c=1) to 30B 128-expert SwiGLU Qwen/Qwen3-30B-A3B-Instruct-2507 (4.72M native slots, Sparse-Delta Folding on 1x DGX Spark) erases the dense 4B cliff completely: WONM-MoE uses just 5.425% of slots across 1,000 sequential facts and holds 85.6% New F1 (89.3% Early-100, 68.2% PARA100, -2.9% Known, 84.6% MMLU, 0.00 PPL drift at 8.55, 2.50s bitwise rollback) versus 46.5% LoRA-mb8 (24.7% PARA100, -6.8% Known), 25.5% unlocked Static-IDF (-35.2% Known), and 23.9% Sparse Rand-WO. Cross-family verification on Google DeepMind's 26B GeGLU hybrid MoE google/gemma-4-26B-A4B-it (2.70M native slots, parallel shared dense MLP, double post-RMSNorm, N=500) confirms flat write-once stability (59.7% to 61.2% New F1 across t=100 to 500, 1.28s bitwise undo), beating full 205-module attention+MLP LoRA across every metric (61.2% vs 44.5% New F1, 56.3% vs 26.5% Early-100, 50.5% vs 20.9% PARA100, -2.8% vs -16.8% Known [6.0x less forgetting], -0.91 pp vs -6.92 pp NQ-300 [7.6x], and -0.35 pp vs -6.66 pp MMLU-285 [19.0x]), while unlocked Static-IDF suffers a -27.36 pp MMLU collapse at t=100 and 4.2x worse Known forgetting at t=500.
Authors
- Mustafa Ahmed (ORCID: https://orcid.org/0009-0006-7874-8328)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-02
- DOI
- https://doi.org/10.5281/zenodo.24753387
- Primary Topic
- Domain Adaptation and Few-Shot Learning
- Type
- preprint