Model Unmerging: Making Your Models Unmergeable for Secure Model Sharing

Zihao Wang, Enneng Yang, Lu Yin, Shiwei Liu, Li ShenSubmission to ICLR 2026 · Rejected

TL;DR

MergeLock is an active defense mechanism that makes fine-tuned Transformer models "unmergeable" without sacrificing a single drop of their native inference performance. By exploiting the continuous mathematical symmetries of multi-head self-attention, MergeLock relocates a model's weights into an entirely different loss basin, causing any unauthorized merged model's performance to plummet by over 95% while resisting data-free alignment attacks.

What Problem Does This Paper Address?

Model merging has rapidly emerged as a cheap, powerful alternative to multi-task learning. Techniques like Task Arithmetic and Ties-Merging can combine multiple fine-tuned models derived from the same base checkpoint (e.g., CLIP or LLaMA) simply by averaging or linearly combining their weight deltas—no expensive retraining required.

However, this convenience creates serious security and intellectual property risks:

  1. IP Infringement: Proprietary fine-tuned expert models can be freely downloaded and merged into third-party commercial systems without authorization.
  2. Safety & Privacy Risks: Malicious merging can strip safety guardrails or extract personally identifiable information (PII).

Prior defenses have leaned primarily on detection (e.g., watermarking and fingerprinting), which are passive and only flag unauthorized use after the fact. The few existing prevention methods (such as PaRaMS) target multilayer perceptron (MLP) layers, but their protections are easily unraveled using standard linear assignment algorithms.

Methods

MergeLock introduces a parameter-space transformation that preserves exact mathematical output equivalence while deliberately destroying parameter-space compatibility with other fine-tuned models.

       Original QK Branch                     MergeLock Transformed QK Branch
  X ──> [ W_Q ] ──> X_Q ┐                X ──> [ A^T W_Q ] ──> X_Q A ┐
                         (X_Q)(X_K)^T                                 (X_Q A)(A^-1 X_K)^T
  X ──> [ W_K ] ──> X_K ┘                X ──> [ A^-1 W_K] ──> X_K A^-1 ┘
                                                       = (X_Q)(X_K)^T (Identical Output!)

1. Exploiting Self-Attention Symmetry

Unlike MLPs, where element-wise non-linear activations (e.g., ReLU, GELU) restrict valid functional transformations strictly to discrete neuron permutations, self-attention layers process linear projections directly before matrix multiplication: $$\text{Attention Score} \propto (X W_Q^\top)(X W_K^\top)^\top = (X W_Q^\top) A A^{-1} (X W_K^\top)^\top$$ A similar relationship holds for the Value-Output ($V, O$) projection branch using an invertible matrix $B$. Because $A A^{-1} = I$ and $B B^{-1} = I$, the output representation remains completely unchanged.

2. Tri-Partite Matrix Construction ($A = RPD$)

To ensure the transformation cannot be easily reverse-engineered, each transformation matrix $A$ (and $B$) is synthesized from three distinct components:

  • $R$ (Random Invertible Matrix): Introduces continuous stochastic perturbations, expanding the parameter space diversity.
  • $P$ (Permutation Matrix): Reorders internal head dimensions to disrupt structural coordinate alignment.
  • $D$ (Diagonal Scaling Matrix): Scales dimensions independently to maximize parameter distance.

Authorized users holding the secret matrices $(A, B)$ can trivially invert the operation and recover the original weights.

Datasets

The authors evaluate MergeLock across both vision and NLP benchmarks:

  • Vision Classification (8 Datasets): SUN397, Stanford Cars, RESISC45, EuroSAT, SVHN, GTSRB, MNIST, and DTD.
  • Language Understanding (8 GLUE Tasks): CoLA, MNLI, MRPC, QNLI, QQP, RTE, SST-2, and STSB.

No new datasets were introduced; all benchmarks are standard evaluation suites in the model merging literature.

Key Insights and Ideas

  • Continuous vs. Discrete Symmetries: MLP protection is inherently weak because activations restrict symmetries to discrete permutation matrices, which attackers can undo with the Hungarian algorithm. Self-attention’s pre-softmax linearity unlocks continuous, non-orthogonal matrix transformations that are mathematically far harder to invert data-free.
  • Loss Basin Relocation: Fine-tuning from a common checkpoint typically keeps models within the same local basin, enabling Linear Mode Connectivity (LMC). MergeLock acts as a topological wedge: it shatters LMC, building a steep loss barrier between the protected model and its peers.
  • Neutralizing Hyperparameter Tuning: Adjusting the merge coefficient $\lambda$ cannot fix an unmergeable model. Across all merge strengths ($\lambda \in [0.3, 0.8]$), the merged model remains entirely broken.

Key Results

  • Devastating Performance Collapse: When merging a MergeLock-protected ViT-B/32 model with an unprotected one via Task Arithmetic, accuracy drops by 72% to 84% across all eight vision tasks, reducing performance to near-random guessing (often $< 5\%$).
  • Resilience Against Alignment Attacks: While prior baseline PaRaMS allows adversaries to recover up to ~72% accuracy using data-free alignment (e.g., Kabsch/SVD or Hungarian matching), MergeLock models only recover ~1% to 5%.
  • Generalization Across Architectures and Merging Schemes:
  • Larger Models: On ViT-L/14, accuracy drops by 84% to 91%.
  • Advanced Merging: Defeats interference-resolving merging methods (Ties-Merging accuracy drops by 76–87%) and entropy-driven adaptive merging (AdaMerging accuracy drops by 72–83%).
  • Generative Language Models: On Flan-T5 (encoder-decoder), downstream GLUE accuracy across all 8 tasks falls from ~80–88% to 0.0%.

Limitations and Future Work

  • Architecture Scope: MergeLock targets self-attention mechanisms. While effective for Transformers, non-attention architectures (such as pure CNNs or state-space models like Mamba) require different symmetry formulations.
  • Post-Hoc Nature: The defense is applied post-training. The authors note that integrating unmergeability directly into the fine-tuning optimization objective is an open direction.
  • Cross-Attention Omission: In encoder-decoder architectures (e.g., Flan-T5), MergeLock was applied only to self-attention blocks, leaving cross-attention untouched (though degrading self-attention alone proved sufficient in practice).

Summary updated

Abstract

Model merging leverages multiple finetuned expert models to construct a multi-task model with low cost, and is gaining increasing attention. However, as a growing number of finetuned models become publicly available, concerns about the safety of model merging have emerged. Unauthorized merging may infringe on developers' rights and risk leaking sensitive personal information. Most existing methods focus on detecting whether a merged model originates from a specific source model, but fail to effectively prevent illegal merging. In this paper, we propose MergeLock, an active protection mechanism that disrupts model parameters to render them unmergeable, thereby directly preventing unauthorized model merging. Specifically, leveraging the inherent symmetry of the attention mechanism in Transformer-based models, we randomly sample two pairs of invertible matrices and apply them to the Query-Key (QK) and Value-Output (VO) branches. This transformation keeps the model's output unchanged while pushing it away from the shared parameter space of other finetuned models. Extensive experiments across both vision and language tasks demonstrate that MergeLock can degrade the performance of merged models by over 95\% when a protected model is involved in most cases, demonstrating its effectiveness. Moreover, we further demonstrate that merged models protected by MergeLock cannot be effectively recovered using low-cost restoration methods, further enhancing robustness against unauthorized merging.
BibTeX
@misc{wang2025model,
  author = {Zihao Wang and Enneng Yang and Lu Yin and Shiwei Liu and Li Shen},
  title = {{Model Unmerging: Making Your Models Unmergeable for Secure Model Sharing}},
  year = {2025},
  eprint = {2509.01548},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.01548},
}

Loading related content...

Figure