TL;DR
This paper introduces a novel "functional regularization" approach for fine-tuning large pre-trained models (like CLIP) to improve their performance on both in-distribution (ID) and out-of-distribution (OOD) tasks. By directly regularizing the model's function in "function space" rather than just its parameters or features, they achieve better OOD robustness without sacrificing ID performance, outperforming existing methods across various model architectures.
What Problem Does This Paper Address?
Foundation models like CLIP are incredibly powerful, learning general knowledge from vast datasets. However, when we fine-tune these models for specific downstream tasks (e.g., image classification on ImageNet), they often become overly specialized to that task's data distribution (in-distribution, ID). This specialization comes at the cost of their ability to generalize to slightly different or unseen data distributions (out-of-distribution, OOD). This phenomenon, known as OOD robustness degradation, is a significant problem when deploying these models in real-world scenarios where data can vary. Existing methods try to mitigate this by constraining how much the fine-tuned model's parameters, features, or logits can change from the pre-trained model. However, the authors argue these indirect constraints are insufficient and don't always guarantee OOD robustness, especially across different model architectures. They propose that OOD robustness is fundamentally about how the model's function (its output given an input) behaves, and thus, regularization should directly target this function space.
Methods
The core of the paper's contribution lies in two novel regularization techniques applied in the "function space":
- Functional Alignment Regularization (FAR): This method directly constrains the distance between the fine-tuned model's function and the pre-trained model's function. The intuition is that by keeping the model's overall behavior (its function) close to the robust behavior learned during pre-training, we can preserve OOD robustness. To achieve this without access to OOD data, they use data augmentation techniques (like RandAugment) on the in-distribution data to simulate OOD samples.
- Functional Consistency Regularization (FCR): To further enhance OOD robustness, this technique encourages the fine-tuned model to produce stable predictions even when its inputs are slightly perturbed. This is inspired by prior work on model invariance, which has shown to be beneficial for OOD generalization. It aims to minimize the discrepancy between predictions on original and perturbed samples.
These two regularizers are combined into a single objective function, FRR-FT (Functional Regularization Robust Fine-Tuning), which is optimized during the fine-tuning process. The overall algorithm is model-agnostic, meaning it can be applied to various pre-trained models.
Datasets
The paper uses standard datasets for evaluating fine-tuning and OOD robustness:
- ImageNet: The primary dataset for in-distribution (ID) fine-tuning.
- ImageNet Variants:
- ImageNet-V2: A natural re-sampling of the original ImageNet validation set.
- ImageNet-R (Rendition): Images with artistic renditions (paintings, sculptures).
- ImageNet-A (Adversarial): Adversarially curated examples.
- ImageNet-Sketch: Hand-drawn sketches of ImageNet classes.
- WILDS Datasets: A suite of challenging, real-world distribution shift datasets.
- WILDS-iWildCam: Camera-trap wildlife dataset with geographic domain shifts.
- WILDS-FMOW: Satellite imagery dataset with geographic and temporal domain shifts.
- EuroSAT: A remote-sensing dataset used for cross-class zero-shot transfer evaluation.
Key Insights and Ideas
- Function Space is Key: The paper strongly advocates that optimizing directly in the "function space" is more effective for preserving OOD robustness than indirectly constraining parameters, features, or logits. This is because function space directly relates to the model's predictive behavior.
- Indirect Constraints are Insufficient: Existing regularization methods that focus on parameter/feature/logit alignment are shown to be imperfect proxies for function-space behavior and don't consistently achieve OOD robustness across all model architectures.
- Simulated OOD Data is Effective: Using data augmentation to create simulated OOD samples for regularization is a practical and effective way to improve OOD robustness when true OOD data is unavailable.
- Complementary Regularizers: The two proposed regularizers, FAR and FCR, offer complementary benefits. FAR preserves the pre-trained model's OOD-aware generality, while FCR enhances stability against perturbations, leading to superior overall robustness when combined.
- Model-Agnostic Approach: The proposed FRR-FT method is shown to be effective across various CLIP architectures (ViT, ResNet), demonstrating its broad applicability.
Key Results
- Consistent OOD Improvement: FRR-FT consistently improves OOD accuracy across multiple CLIP backbones (ViT-L/14, ViT-B/32, ViT-B/16, ResNet-50) on various benchmarks, including ImageNet variants and WILDS datasets.
- ID Performance Maintained: The method achieves these OOD gains without sacrificing in-distribution (ID) performance, often even improving it slightly.
- Outperforms Baselines: FRR-FT outperforms existing state-of-the-art regularization-based robust fine-tuning methods. For example, on ViT-B/32, it achieves 52.17% OOD accuracy compared to the previous best of 50.09%. On ViT-B/16, it reaches 63.04% OOD accuracy, surpassing the previous best of 62.37% while also achieving higher ID accuracy.
- Robustness to Perturbations: Empirical analysis shows that function-space perturbations lead to significantly smaller changes in loss and accuracy compared to parameter, feature, or logit space perturbations, demonstrating superior robustness.
Limitations and Future Work
- Simulated OOD Data: While effective, the use of simulated OOD data might not perfectly capture the nuances of real-world OOD shifts. Future work could explore more sophisticated methods for generating realistic OOD data.
- Hyperparameter Tuning: The method introduces hyperparameters ($\lambda_1, \lambda_2$) that control the trade-off between ID and OOD performance. Further research could explore automated methods for tuning these parameters.
- Model Ensembles: The paper briefly touches upon combining FRR-FT with model-ensemble strategies, showing further improvements. This suggests that exploring hybrid approaches could be a promising direction.
- Broader Applicability: While shown to be effective for CLIP models, future work could investigate the applicability of FRR-FT to other types of foundation models and downstream tasks.
Summary updated