★ Highlight CVPR 2026

Immunizing Models Against Harmful Long-Horizon Fine-Tuning via Contractive Optimization Dynamics

Department of Computer Science, Virginia Tech

Abstract

Fine-tuning has become the default way to adapt powerful foundation models, but this also enables low-cost repurposing for harmful objectives. Existing immunization methods try to optimize local geometry or use meta-learning to simulate short attacker horizons, and penalize observed loss drops. However, downstream attackers can run long training sessions and can overcome these short-horizon defenses.

We propose CLAMP (Contractive Long-horizon Attacker Mitigation via Progress-bounding), an immunization method that traps harmful fine-tuning by shaping the attacker's optimization dynamics rather than only the initial landscape. Our key idea is to make harmful training locally contractive, making each update smaller than the last. This yields a closed-form bound on the attacker's training beyond the simulated steps. Empirically, CLAMP consistently outperforms existing immunization baselines across classification, generative, and autoregressive language models.

Model Immunization

Model immunization aims to pre-process a model so that subsequent fine-tuning on harmful data fails to cause harmful behavior, while still allowing benign adaptation. Prior work formulates this as shaping the loss landscape through meta-learning or by raising barriers for harmful updates. CLAMP extends this line of work by explicitly targeting the dynamics of harmful fine-tuning trajectories over long training horizons.

Model Immunization Introduction
Figure 1. Overview of the model immunization problem. An immunized model should resist harmful downstream fine-tuning (e.g., harmful content generation) while remaining adaptable for benign tasks.

Method

Intuition

The core challenge in immunization is that an adversary can run far more fine-tuning steps than a defender can simulate. Existing methods optimize the initial loss landscape but have no control over what happens after the first K steps, a determined attacker can simply train longer.

CLAMP solves this by making harmful training contractive: each successive harmful gradient update is forced to be smaller than the previous one in magnitude. If the sequence of update magnitudes is contractive (ratio < 1), the total remaining progress is bounded by a geometric series — giving a closed-form guarantee on the attacker's total achievable progress, regardless of how many steps they take.

Key idea: shape the attacker's optimization dynamics so that harmful weight changes contract to zero, rather than trying to build a wall at the starting point.

Concept

Concept figure: CLAMP vs prior immunization methods
Figure 2. Conceptual illustration of CLAMP. While prior methods protect only for a short number of fine-tuning steps, CLAMP's contractivity constraint bounds harmful progress over longer training horizon via a geometric series tail bound.

Method Overview

CLAMP formulates immunization as a bi-level optimization. The inner loop simulates the attacker's fine-tuning trajectory over K steps, and approximates the bound from K to infinity steps. The outer loop then measures the resulting short-horizon loss drop and applies three penalties: (1) a long-horizon tail bound that extrapolates the simulated progress to infinity by assuming contractivity, (2) a contractivity penalty to encourage assumed contractivity, (3) a curvature trap that hardens the loss landscape along harmful descent directions, and (4) An inverse loss that prevents the model from gaming the meta-learning process.

CLAMP method overview
Figure 3. CLAMP pipeline. We simulate the attacker for K inner steps, directly measure the short-horizon harmful loss drop, and use a closed-form long-horizon tail bound to constrain all future progress. A contractivity penalty ensures successive weight updates shrink, and a curvature trap hardens the loss landscape along harmful descent directions.

Results

We evaluate CLAMP across three paradigms: image classification, diffusion-based generative models, and autoregressive LLMs. CLAMP consistently outperforms existing immunization baselines under long-horizon attack conditions.

Diffusion Model Dataset & Performance

For the generative model evaluation, we construct a dataset of unusual concept compositions designed to test whether a model can have finegrained immunization of sub-concepts. The figure below shows examples of generated images, along with quantitative results.

Diffusion model dataset and performance
Figure 4. Diffusion model dataset and performance. (Top) Example images used in the generative training setup. (Bottom) Quantitative performance comparison across immunization methods on harmful and benign generative fine-tuning tasks.

More Results

Generative Training Dataset Samples

Examples of concept-combination prompts and the corresponding generated images used in our generative model training setup.

cobblestone robot 1 cobblestone robot 2 cobblestone robot 3 cobblestone robot 4

cobblestone + wheeled robot: A small wheeled robot constructed from cobblestone-like blocks with moss filling the seams and worn wheel axles; photorealistic, 3/4 view, warm rim light, neutral studio backdrop.

elephant zebra 1 elephant zebra 2 elephant zebra 3 elephant zebra 4

elephant + zebra: An elephant with high-contrast black-and-white zebra-style stripes across its body and a short trunk; close-up focusing on translucent glass-like refractions and subsurface scattering, watercolor, dramatic high contrast studio lighting.

fox clockwork 1 fox clockwork 2 fox clockwork 3 fox clockwork 4

fox + clockwork: A fox with visible clockwork components integrated into its body: brass gears, cogs, and a winding key; dramatic golden hour sunlight scene, resting on a pedestal, cinematic composition.

owl racing car 1 owl racing car 2 owl racing car 3 owl racing car 4

owl + retro racing car: A retro racing vehicle that features an owl-like round frontal disk (face) and winged fenders on a streamlined metallic body; perched on an object in a fantastical starry sky, illustration, neon backlight at night.


Downstream Harmful Adaptation in Immunized Models

Each row shows generated images from finetuning on a harmful dataset. Columns correspond to training epochs 5, 15, 25, and 35. An immunized model should prevent harmful content from emerging across all epochs.

Epoch 5 Epoch 15 Epoch 25 Epoch 35
Reference Images
ref epoch 5 ref epoch 15 ref epoch 25 ref epoch 35
SFT (Un-immunized)
sft epoch 5 sft epoch 15 sft epoch 25 sft epoch 35
IMMA (Immunized)
imma epoch 5 imma epoch 15 imma epoch 25 imma epoch 35
CLAMP (Immunized)
clamp epoch 5 clamp epoch 15 clamp epoch 25 clamp epoch 35

Downstream harmful adaptation. CLAMP maintains immunization across all epochs, while SFT rapidly drifts toward harmful outputs and IMMA loses protection in later epochs.


Downstream Benign Adaptation in Immunized Models

Each row shows generated images from finetuning on a benign dataset. CLAMP should preserve the model's ability to learn benign concepts normally.

Epoch 5 Epoch 15 Epoch 25 Epoch 35
Reference Images
ref epoch 5 ref epoch 15 ref epoch 25 ref epoch 35
SFT (Un-immunized)
sft epoch 5 sft epoch 15 sft epoch 25 sft epoch 35
IMMA (Immunized)
imma epoch 5 imma epoch 15 imma epoch 25 imma epoch 35
CLAMP (Immunized)
clamp epoch 5 clamp epoch 15 clamp epoch 25 clamp epoch 35

Downstream benign adaptation. CLAMP preserves normal learning on benign tasks, showing that immunization does not degrade benign utility.

Citation

If you find this work useful, please cite our paper:

@InProceedings{Sarker_2026_CVPR, author = {Sarker, Najibul Haque and Ibn Abdul Hakim, Zaber and Asgarov, Ali and Tang, Chia-Wei and Ishmam, Alvi Md and Thomas, Chris}, title = {Immunizing Models Against Harmful Long-Horizon Fine-Tuning via Contractive Optimization Dynamics}, booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)}, month = {June}, year = {2026}, pages = {34940-34949} }