Provable Repair of Vision Transformers

Stephanie Nawas, Zhe Tao, Aditya V. Thakur

Introduction

Deep Neural Networks (DNNs) are increasingly deployed in safety-critical domains such as autonomous driving and medical diagnostics. Despite their impressive performance, these models often exhibit "faulty" behaviors, misclassifying specific inputs that can lead to catastrophic failures. Traditional methods for correcting these errors, such as retraining the entire model, are computationally prohibitive. Conversely, standard fine-tuning often results in "catastrophic forgetting," where the model loses its original knowledge (high drawdown) while attempting to learn new data points.

"Provable repair" offers a solution by providing mathematical guarantees that a model will correctly classify a specific set of problematic inputs (the "repair set"). However, applying these techniques to Vision Transformers (ViTs) has historically been challenging. Previous methods either required architectural changes, failed to scale beyond small repair sets, or significantly degraded the model's overall performance.

The PRoViT Approach

Researchers from UC Davis have introduced PRoViT (Provable Repair of Vision Transformers), a method that achieves 100% accuracy on a repair set without altering the model's architecture. The fundamental insight behind PRoViT is that for Vision Transformers, editing only the parameters of the final fully-connected layer is sufficient to achieve provable correctness with high generalization. This property is unique to ViTs; in convolutional architectures like ResNet, last-layer edits are significantly less effective.

Visualizing the last-layer repair mechanism: (a) matrix formulation and (b) neural network representation of edited weights.

PRoViT offers three distinct variants:

  1. PRoViT$_{FT}$: Fine-tunes only the last layer until the repair set is perfectly classified, offering superior generalization to similar unseen images.
  2. PRoViT$_{LP}$: Employs a novel Linear Programming (LP) formulation. By modifying only the weights and biases associated with the specific labels in the repair set, it drastically reduces the number of variables and constraints compared to standard LP approaches.
  3. PRoViT$_{FT+LP}$: A hybrid approach that combines the generalization benefits of fine-tuning with the absolute guarantees of the LP solver.

Scalability and Efficiency

A major breakthrough of PRoViT is its scalability. By focusing the LP formulation on the labels present in the repair set ($K$) rather than the total number of classes ($n$), the computational complexity becomes independent of the dataset's total class count. This allows PRoViT to handle repair sets of thousands of images, whereas previous state-of-the-art methods would often crash or run out of memory.

Scalability comparison: PRoViT$_{LP}$ maintains linear growth and significantly outperforms the standard LP baseline ($STD_{LP}$) in repair time.

Experimental Results

The researchers evaluated PRoViT using state-of-the-art models (ViT-B/16, ViT-L/32, and DeiT) on repair sets derived from ImageNet-C, which contains various weather-related corruptions. Key findings include:

  • Speed and Scale: PRoViT successfully repaired 2,000 images in just 1,423 seconds, representing a 107x speedup over standard LP formulations.
  • Minimal Drawdown: When repairing 2,000 images, PRoViT achieved a drawdown of only 0.12% on the original ImageNet validation set. In contrast, full-model fine-tuning caused a disastrous drawdown of nearly 80%.
  • Generalization: PRoViT$_{FT}$ improved accuracy on similar corrupted images by up to 54.33%, demonstrating that the repairs are not just "memorized" but generalize to related data.

Conclusion

PRoViT demonstrates that Vision Transformers possess a unique structural property that makes them highly amenable to last-layer provable repair. By leveraging this, PRoViT provides a scalable, efficient, and effective way to ensure model reliability in critical applications. Future work will explore the theoretical underpinnings of why this approach favors Transformers over CNNs and extend the method to Natural Language Processing tasks.

Summary updated

Abstract

Vision Transformers have emerged as state-of-the-art image recognition tools, but may still exhibit incorrect behavior. Incorrect image recognition can have disastrous consequences in safety-critical real-world applications such as self-driving automobiles. In this paper, we present Provable Repair of Vision Transformers (PRoViT), a provable repair approach that guarantees the correct classification of images in a repair set for a given Vision Transformer without modifying its architecture. PRoViT avoids negatively affecting correctly classified images (drawdown) by minimizing the changes made to the Vision Transformer’s parameters and original output. We observe that for Vision Transformers, unlike for other architectures such as ResNet or VGG, editing just the parameters in the last layer achieves correctness guarantees and very low drawdown. We introduce a novel method for editing these last-layer parameters that enables PRoViT to efficiently repair state-of-the-art Vision Transformers for thousands of images, far exceeding the capabilities of prior provable repair approaches.
BibTeX
@inproceedings{nawas2024provable,
  author = {Stephanie Nawas and Zhe Tao and Aditya V. Thakur},
  title = {{Provable Repair of Vision Transformers}},
  booktitle = {SAIV},
  year = {2024},
  doi = {10.1007/978-3-031-65112-0\_8},
}
Figure