arXiv:2610.41147cs.CLOct 2026

Manuscript Offprint

arXiv:2610.41147

HyperRepair: Recovering Forgotten General Capabilities of Fine-Tuned Language Models

Junrong Tang, Jianghui Wang, Hao Kong, Yang Lin, Yibo Yang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Fine-tuning improves a language model's performance in a target domain but can weaken its general capabilities. Existing methods often face a trade-off between general capabilities and domain specialization, making it difficult to preserve both. We introduce HyperRepair, a framework for recovering general capabilities while retaining domain specialization at only inference cost. To make recovery generalizable across models sharing a pretrained backbone, HyperRepair learns a hypernetwork from repairs trained on source models. The hypernetwork uses activation fingerprints that summarize changes from the pretrained backbone to generate a tailored Repairing Side Net (RSN), whose prompt-conditioned gate applies corrections selectively. This enables recovery on models from unseen adaptation domains without target-domain examples or additional optimization. We evaluate HyperRepair across two model families, 12 LoRA adaptation datasets, and 15 general benchmarks. On the default split, HyperRepair achieves 93.4% of the base models' average general score while retaining 99.5% of the fine-tuned models' average domain score.

1 INTRODUCTION

The widespread use of pretrained large language models creates a need to adapt them to diverse downstream tasks, domains, and application requirements. Fine-tuning improves downstream performance but can degrade pretrained knowledge and general capabilities (Wang et al., 2024; Kotha et al., 2024; Luo et al., 2025), a phenomenon known as catastrophic forgetting (McCloskey & Cohen, 1989; Yang et al., 2023; Liu et al., 2025). Such degradation can impair responses beyond the adaptation task, limiting the usefulness of specialized models when applications also require broad knowledge and reasoning. Although low-rank adaptation (LoRA) trains only a small number of additional parameters (Hu et al., 2022), studies show that catastrophic forgetting can still occur (Kalajdzievski, 2024; Yang et al., 2024b).

Existing approaches mitigate forgetting during fine-tuning through parameter regularization (Kirkpatrick et al., 2017), rehearsal and distillation (Huang et al., 2024b; Li & Hoiem, 2016), or changes to adapter construction and loss weighting (Yang et al., 2024b; Sanyal et al., 2025; Lin et al., 2026). However, these approaches intervene during adaptation and cannot directly repair an already fine-tuned model without further training. Post-hoc approaches instead modify trained weights through model merging (Ilharco et al., 2023; Yadav et al., 2023; Huang et al., 2024a; Yu et al., 2024), layer-wise rescaling (Wang et al., 2025), or forgetting-aware pruning (Huang et al., 2025). Post-hoc rescaling and pruning can recover general performance without repeating the original fine-tuning process. However, methods that apply a single set of modified weights to all inputs can face a trade-off between recovering general capabilities and retaining downstream specialization. We therefore pose and study the following question:

∗^{*}Corresponding author.

Figure

Figure 1: Comparison of prior approaches and HyperRepair. (a) Training-time mitigation requires control over fine-tuning. (b) Post-hoc weight modification may trade domain specialization for general recovery. (c) HyperRepair selectively corrects a frozen model with a gated RSN to recover general capabilities while retaining domain specialization, without target-domain data or optimization at deployment.

Given a fine-tuned language model with degraded general capabilities, how can we efficiently recover its general performance at inference cost only while retaining downstream task performance?

This motivates a selective approach to recovery: we keep the fine-tuned weights fixed and place the correction in a separate pathway (Figure 1). This retains the original model as a fallback and makes it possible to decide from the prompt whether a correction should be used. Side networks provide a natural starting point for this design because they can reuse intermediate representations from a frozen backbone without rewriting its parameters (Zhang et al., 2020; Sung et al., 2022). A separate pathway alone, however, does not solve the entire problem. If a new repair must be trained for every newly released adapter, the cost of recovery still grows with the number of models. What is missing is a way to learn from repaired models and use that experience to repair another model.

To make recovery reusable across models, we consider models adapted independently from the same pretrained backbone. Some of these models serve as sources from which repairs can be learned. The target model comes from an adaptation domain that was not used to learn the repair mechanism. Its domain data is unavailable, and no optimization is allowed on the target model. To our knowledge, this is the first work to study amortized recovery of general capabilities across independently fine-tuned language models. The goal is not merely to find a better compromise for one checkpoint, but to learn a repair process that generalizes to an unseen downstream domain.

Building on this formulation, we introduce HyperRepair, which learns this repair process. To prepare data for learning how to repair, we first train a lightweight Repairing Side Net (RSN) for each fine-tuned source model. The RSN reads intermediate hidden states and produces a residual correction before the language model head. Labeled general examples teach it how to improve general predictions. A prompt-conditioned gate determines how much of the correction should be applied. The gate is trained to activate on general prompts and to remain inactive on unlabeled domain prompts. When the correction is inactive, the model produces the original fine-tuned predictions. The model can therefore use the repair where it is helpful without giving up direct access to the behavior learned for a downstream domain.

The remaining question is how to obtain a suitable RSN for a new model without training one. We represent each fine-tuned model by an activation fingerprint. The fingerprint records how its hidden representations differ from those of the pretrained model on a fixed group of unlabeled general prompts. We train a hypernetwork, HyperNet (Ha et al., 2017; Aliev et al., 2026), to map this fingerprint to the complete parameters of the RSN, including its prompt gate. Training uses the parameters of directly trained source repairs together with supervision on the behavior of the generated repairs. At deployment, HyperNet receives the fingerprint of a model from a held-out adaptation domain and generates its RSN in one forward pass. No target-domain examples or optimization are required.

We summarize our main contributions as follows:

  1. We formulate post-hoc recovery as the activation-conditioned generation of model-specific Repairing Side Nets (RSNs) that recover general capabilities while retaining downstream performance. Given a fine-tuned checkpoint, our method generates its repair from activation fingerprints without additional optimization or target-domain examples.

  2. We design HyperRepair, a hypernetwork-based framework that predicts the weights of a lightweight RSN, including its prompt-conditioned gate. The RSN applies selective residual corrections to the frozen backbone, while HyperNet learns from source repairs and generalizes to new fine-tuned models.

  3. We show that generated RSNs can recover general capabilities while preserving domain performance. We evaluate two backbones across 12 adaptation datasets and 15 general benchmarks, training HyperNet on source models and testing on held-out domains. On the default split, HyperRepair reaches 93.4% of the base models' average general score and retains 99.5% of the fine-tuned models' average domain score.

References (76)