HyperRepair: Recovering Forgotten General Capabilities of Fine-Tuned Language Models
Organizations: Shanghai Jiao Tong University · The University of Queensland
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 HyperRpair 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.
Figures & tables
| Method | ARC-Challenge | HellaSwag | MMLU | OpenBookQA | PIQA | SciQ | WinoGrande | ANLI-R1 | SocialIQA | LogiQA | WiC | COPA | MATH | HumanEval | MBPP |
| Qwen2.5-7B | |||||||||||||||
| Base | 51.4 | 78.8 | 71.8 | 47.4 | 79.8 | 95.2 | 73.1 | 53.0 | 54.7 | 35.8 | 57.8 | 91 | 39.3 | 56.1 | 63.8 |
| LEDGAR-Top10 | |||||||||||||||
| Fine-tuned | 53.8 | 73.1 | 55.0 | 46.0 | 79.4 | 88.1 | 70.8 | 48.5 | 49.0 | 33.6 | 50.0 | 88 | 3.6 | 22.0 | 28.8 |
| CorDA-KPM | 45.7 | 65.7 | 24.0 | 44.2 | 75.7 | 78.1 | 69.6 | 33.0 | 46.8 | 27.0 | 50.0 | 90 | 0.0 | 4.3 | 0.0 |
| FAPM | 55.4 | 75.0 | 63.1 | 48.0 | 80.5 | 91.3 | 71.9 | 49.0 | 51.1 | 33.3 | 50.0 | 89 | 28.5 | 34.8 | 44.0 |
| Base (correct) | Fine-tuned (incorrect) | HyperRepair (correct) |
| ARC-Challenge (discriminative) Adaptation: HateXplain (Split A) | ||
| Prompt. An astronomer observes that a planet rotates faster after a meteorite impact. Which is the most likely effect of this increase in rotation? | ||
| Planetary days will become shorter. | Planetary gravity will become stronger. | Planetary days will become shorter. |
| MATH (generative) Adaptation: MASSIVE-en (Split B) | ||
| Prompt. Determine the number of ways to arrange the letters of the word ELLIPSE. | ||
| The word ELLIPSE has 7 letters, with 2 L’s and 2 E’s. The number of ways to arrange the letters is | The word ELLIPSE has 7 letters, but the letter E appears twice. Therefore, the number of ways to arrange the letters is | The word ELLIPSE has 7 letters, with 2 L’s and 2 E’s. The number of ways to arrange the letters is . |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Parameter | Value |
| Repairing Side Net (RSN) | |
| Hidden dimension / layers | 192 / 6 |
| Attention heads / feedforward dimension | 4 / 768 |
| Backbone layers (Qwen / Llama) | 5, 10, 15, 19, 24, 28 / 6, 11, 17, 22, 27, 32 |
| Prompt gate | Mean pooling, MLP (hidden dimension 384), sigmoid |
| Ladder gate | Learned per layer; sigmoid temperature 0.1 |
| Dataset | Task | Train | Test | Metric |
| HateXplain ( Mathew et al., 2021 ) | Hate-speech detection | 4,000 | 1,000 | Macro-F1 |
| SemEval-2010 T8 ( Hendrickx et al., 2010 ) | Relation classification | 4,000 | 2,717 | Macro-F1 |
| SCOTUS ( Chalkidis et al., 2022 ) | Legal issue classification | 5,000 | 1,400 | Macro-F1 |
| MedMCQA ( Pal et al., 2022 ) | Medical QA | 4,000 | 1,000 | Accuracy |
| MASSIVE-en ( FitzGerald et al., 2023 ; Bastianelli et al., 2020 ) | Intent recognition | 4,000 | 1,000 | Accuracy |
| WikiSQL ( Zhong et al., 2017 ) | Text-to-SQL | 4,000 | 1,000 | Execution accuracy |
| Dataset | Category | Train | Test |
| Discriminative tasks | |||
| ARC-Challenge ( Clark et al., 2018 ) | Science QA | 889 | 1,172 |
| HellaSwag ( Zellers et al., 2019 ) | Commonsense reasoning | 1,970 | 10,042 |
| MMLU ( Hendrycks et al., 2021a ) | Multitask knowledge | 21,752 | 14,042 |
| OpenBookQA ( Mihaylov et al., 2018 ) | Science QA | 1,970 | 500 |
| PIQA ( Bisk et al., 2020 ) | Physical reasoning | 1,970 | 1,838 |
| Split | Domain 1 | Domain 2 | Domain 3 |
| A | HateXplain | SemEval-2010 T8 | SCOTUS |
| B | MedMCQA | MASSIVE-en | WikiSQL |
| C | RACE | Banking77 | CodeXGLUE-JS |
| D | LEDGAR-Top10 | SNIPS-7 | DROP |
| Base (correct) | Fine-tuned (incorrect) | HyperRepair (correct) |
|---|---|---|
| HellaSwag Adaptation: CodeXGLUE-JS (Split C) | ||
| Prompt. Clean and jerk: A woman in a black shirt is bent over. She | ||
| picks up a heavy weight. | is putting lotion onto her back. | picks up a heavy weight. |
| MMLU Adaptation: SCOTUS (Split A) | ||
| Prompt. A wave transfers | ||
| energy | amplitude | energy |