Abstract
As Large Language Models make a breakthrough in natural language processing tasks (NLP), multimodal technique becomes extremely popular. However, it has been shown that multimodal NLP are vulnerable to adversarial attacks, where the outputs of a model can be dramatically changed by a perturbation to the input. While several defense techniques have been proposed both in computer vision and NLP models, the multimodal robustness of models have not been fully explored. In this paper, we study the adversarial robustness provided by modifying loss function of pre-trained multimodal models, by restricting top K softmax outputs. Based on the evaluation and scoring, our experiments show that after a fine-tuning, adversarial robustness of pre-trained models can be significantly improved, against popular attacks. Further research should be studying, such as output diversity, generalization and the robustness-performance trade-off of this kind of loss functions.
Introduction
Vision-Language Models (VLMs), which integrate visual and textual information for tasks like image captioning and visual question answering (VQA), have demonstrated remarkable capabilities. However, these models inherit vulnerabilities from both the computer vision and NLP domains. Specifically, they are susceptible to adversarial attacks—small, intentional perturbations to input data that lead to incorrect model outputs.
Traditional defense mechanisms, such as adversarial training, often come with prohibitive computational costs and may degrade performance on clean data. This paper explores an alternative: enhancing robustness by modifying the loss function during the fine-tuning phase. The authors propose that the vulnerability of VLMs is intrinsically linked to the distribution of the softmax output, particularly the "diversity" of the top-tier incorrect predictions.
Partially Recentralization Softmax Loss (PRSL)
The core contribution of this work is the Partially Recentralization Softmax Loss (PRSL). Unlike standard Cross-Entropy (CE) loss, which focuses solely on maximizing the probability of the ground-truth token, PRSL introduces a regularization term designed to flatten the distribution of the most likely incorrect tokens.
The loss function is defined as:
$$L(\theta) = L_{CE} + b \cdot \text{dist}\left(\sum_{k \in K} (P_k - P_{k\_min})\right)$$
Where:
- $b$ is a hyperparameter controlling the regularization strength.
- $K$ represents the set of top-$k$ highest probability outputs, excluding the ground truth.
- $P_{k\_min}$ is the minimum probability within that top-$k$ set.
By penalizing the distance between these top "runner-up" predictions, PRSL effectively "recentralizes" the softmax distribution. This geometric shift in the loss landscape makes it significantly harder for an adversary to perturb the input enough to flip the model's prediction to a specific incorrect class.
Experimental Evaluation
The researchers evaluated PRSL using standard benchmarks including COCO2017 and Visual Genome, testing architectures such as ViT-GPT2 and Blip2-OPT. Robustness was measured against the Basic Iterative Method (BIM) attack across multiple rounds.
Performance Under Attack
Models fine-tuned with PRSL demonstrated superior resilience compared to those trained with standard CE loss. As shown in the multi-metric evaluation, the performance decay of PRSL-enhanced models is notably slower as the number of attack iterations increases.
Threshold Success and the "K" Factor
A key finding is that the robustness gains scale with the value of $k$. Constraining a larger set of top-tier tokens (e.g., top-100 vs. top-6) provides better protection, suggesting that adversarial vulnerability is distributed across a wide range of potential outputs.
Furthermore, PRSL significantly improves the "threshold success rate." In experiments, the standard CE model saw nearly 60% of its outputs fall below a quality threshold after just two rounds of attack. PRSL variants successfully kept this failure rate below 50%, maintaining higher output quality under duress.
Conclusion and Future Directions
This study demonstrates that modifying the loss function to regularize the softmax distribution is a viable and computationally efficient path toward robust VLMs. PRSL provides "implicit robustness" without the need for generating adversarial examples during training.
Future research should address the potential trade-offs between robustness and clean-data performance, as well as the impact of softmax recentralization on the linguistic diversity of generated captions. Additionally, developing adaptive methods for selecting the hyperparameters $b$ and $k$ could further optimize the defense across varying tasks and model architectures.
Summary updated