Trainable Projected Gradient Method for Robust Fine-Tuning
Junjiao TianXiaoliang DaiChih-Yao MaZecheng HeYen-Cheng LiuZsolt Kira
Proposes an end-to-end bi-level optimization framework that automatically learns layer-specific weight projection constraints during fine-tuning, significantly boosting out-of-distribution generalization without costly manual hyperparameter searches.
Transfer learning and fine-tuning are foundational for adapting large pre-trained vision models to specific tasks. However, standard fine-tuning often causes models to overfit to new training data and overwrite valuable pre-trained representations, significantly reducing robustness when facing out-of-distribution (OOD) data. While constraining how far model weights move from their pre-trained states can mitigate this problem, existing methods rely on manual heuristics or computationally prohibitive combinatorial parameter searches across neural network layers.
The article introduces and evaluates the Trainable Projected Gradient Method (TPGM), an automated approach designed to learn fine-grained, layer-by-layer distance constraints during fine-tuning. By framing fine-tuning as a bi-level constrained optimization problem, TPGM enables neural networks to retain pre-trained generalization capabilities on OOD data without degrading standard in-distribution (ID) task performance.
To accomplish this, TPGM incorporates projection operators into the forward pass of the model and alternates between updating model parameters on training data and optimizing layer-specific distance constraints on validation data. The researchers tested TPGM across both convolutional neural network (ResNet50) and vision transformer (ViT-B) architectures. They evaluated performance using major benchmarks, including the multi-domain DomainNet dataset and ImageNet, along with its robustness test variants (ImageNet-V2, ImageNet-A, ImageNet-R, and ImageNet-S).
The findings demonstrate substantial robustness improvements across all tested scenarios. First, on DomainNet-Real using a CLIP pre-trained ResNet50, TPGM achieved a 16.01% relative average improvement in OOD accuracy and a 22% relative gain on the sketch domain, while also improving ID accuracy by 3.34% over standard fine-tuning. Second, on ImageNet using a CLIP pre-trained ViT-B, TPGM delivered a 19.69% relative OOD performance boost while matching baseline ID accuracy, outperforming the previous state-of-the-art interpolation method (WISE) at comparable trade-off levels. Third, when fine-tuning data was restricted to only 10% on DomainNet, TPGM automatically enforced tighter constraints to prevent overfitting, improving ID accuracy by 27.56% and average OOD performance by 59.27% relative to vanilla fine-tuning. Fourth, analysis of the learned parameters confirmed that early layers require tight distance constraints to preserve general features, while deeper layers require more flexibility to specialize.
These results demonstrate that automated, layer-specific constraint optimization effectively resolves the trade-off between task specialization and out-of-distribution robustness. For engineering teams, this significantly reduces the operational cost, compute time, and risk associated with extensive manual hyperparameter tuning. The method proves especially beneficial in resource-constrained settings where training data is limited and models must remain resilient to real-world domain shifts.
Organizations deploying vision models in mission-critical environments with variable real-world data should adopt automated per-layer projection methods like TPGM for model fine-tuning. Teams working with transformer architectures can apply this projection efficiently as a one-time step at the end of training, while convolutional workflows should integrate projections across training iterations. Future technical work should explore adapting TPGM to additional model architectures, non-vision modalities, and alternative projection operators.
The authors note minor limitations, including added computational overhead during the alternating optimization steps and occasional under-fitting in specific self-supervised configurations, which required total variation smoothing to stabilize. Overall, confidence in the findings is high, as the empirical gains are substantiated across diverse architectures, varying dataset sizes, and theoretical analysis on over-parameterized linear models.
- Paper: Assaying Out-Of-Distribution Generalization in Transfer Learning, Florian Wenzel et al. (2022). Provides a large-scale empirical evaluation of out-of-distribution generalization in transfer learning, establishing foundational insights into why fine-tuning degrades robust representations.
- Paper: The Many Faces of Robustness: A Critical Analysis of Out-of-Distribution Generalization, Dan Hendrycks et al. (2021). Introduces key natural distribution shift benchmarks like ImageNet-Rendition and formalizes the evaluation framework for vision model robustness under shift.
- Paper: Towards Understanding Sharpness-Aware Minimization, Maksym Andriushchenko et al. (2022). Explores optimization geometry and distance-constrained loss landscapes, offering theoretical grounding for the parameter constraint mechanisms leveraged in TPGM.
- Paper: Domain Generalization: A Survey, Kaiyang Zhou et al. (2021). Surveys the primary methodologies and challenges in domain generalization, contextualizing the need for automated parameter-level adaptation.
- Paper: Robustness May Be at Odds with Accuracy, Dimitris Tsipras et al. (2018). Establishes the fundamental tension between in-distribution task accuracy and out-of-distribution robustness that TPGM explicitly seeks to resolve.
- Paper: Pre-Trained Model Guided Fine-Tuning for Zero-Shot Adversarial Robustness, Sibo Wang et al. (2024). Extends the principle of constraining fine-tuning deviations from pre-trained foundation models to preserve zero-shot adversarial robustness.
- Paper: Mechanistically analyzing the effects of fine-tuning on procedurally defined tasks, Samyak Jain et al. (2024). Offers a mechanistic interpretability perspective analyzing how fine-tuning modifies network layers, directly complementing TPGM's layer-wise constraint dynamics.
- Paper: SFT Memorizes, RL Generalizes: A Comparative Study of Foundation Model Post-training, Tianzhe Chu et al. (2025). Investigates the out-of-distribution generalization limits of supervised fine-tuning versus reinforcement learning post-training strategies.
- Paper: SPTNet: An Efficient Alternative Framework for Generalized Category Discovery with Spatial Prompt Tuning, Hongjun Wang et al. (2024). Explores an alternative alternating optimization framework for adapting vision models to novel and shifted distributions via spatial prompt tuning.
