Abstract
A substantial body of research has focused on developing systems that assist medical professionals during labor-intensive early screening processes, many based on convolutional deep-learning architectures. Recently, multiple studies explored the application of so-called self-attention mechanisms in the vision domain. These studies often report empirical improvements over fully convolutional approaches on various datasets and tasks. To evaluate this trend for medical imaging, we extend two widely adopted convolutional architectures with different self-attention variants on two different medical datasets. With this, we aim to specifically evaluate the possible advantages of additional self-attention. We compare our models with similarly sized convolutional and attention-based baselines and evaluate performance gains statistically. Additionally, we investigate how including such layers changes the features learned by these models during the training. Following a hyperparameter search, and contrary to our expectations, we observe no significant improvement in balanced accuracy over fully convolutional models. We also find that important features, such as dermoscopic structures in skin lesion images, are still not learned by employing self-attention. Finally, analyzing local explanations, we confirm biased feature usage. We conclude that merely incorporating attention is insufficient to surpass the performance of existing fully convolutional methods.
Introduction
In the world of computer vision, self-attention—the core mechanism behind Transformers—is frequently touted as a superior method for capturing "global context" compared to the local receptive fields of standard Convolutional Neural Networks (CNNs). In medical imaging, this promise is particularly alluring. Clinicians often rely on global patterns, such as the overall symmetry of a skin lesion or the spatial distribution of cells in tumor tissue, to make diagnoses.
However, a persistent challenge in medical AI is the tendency of CNNs to "cheat" by relying on spurious biases, such as background artifacts or colorful patches, rather than medically relevant features like the dermatological "ABCD" rule (Asymmetry, Border, Color, Dermoscopic structures). This study investigates whether self-attention can bridge this gap, or if it simply adds architectural complexity without clinical substance.
Methodology: A "Fair Fight"
To rigorously evaluate the impact of self-attention, the researchers extended two widely used CNN backbones—ResNet18 and EfficientNet-B0—with three distinct variants of self-attention:
- Global Self-Attention (GA): Every pixel attends to every other pixel to capture long-range dependencies.
- Local Self-Attention (LA): Pixels attend to their immediate neighborhood, acting as a more flexible alternative to standard convolution.
- Embedded Local Self-Attention (ELA): A novel approach using residual connections to "embed" local attention into a pre-trained network. This allows the model to retain learned convolutional features while gradually incorporating attention during fine-tuning.
These hybrid models were compared against pure CNN baselines and Vision Transformers (ViT-tiny). To ensure a fair comparison, parameter counts were kept comparable across models to prevent performance gains from being attributed simply to increased model capacity.
Datasets and Evaluation
The models were evaluated on two distinct medical tasks involving both in-distribution and out-of-distribution (OOD) data:
- Skin Lesion Classification: Trained on the ISIC archive, with OOD testing on the PAD-UFES-20 dataset (images from different sources and camera types).
- Tumor Tissue Classification: Utilized the Camelyon17 dataset, which includes a built-in OOD split consisting of images from a different hospital.
Key Insights and Results
The Performance Plateau
Contrary to the prevailing trend in AI literature, the study found no statistically significant improvement in balanced accuracy when adding self-attention to CNNs. On the ISIC dataset, the ResNet18 baseline achieved approximately 73.9% accuracy; adding Global Attention (GA) actually decreased performance to 72.1%. While EfficientNet showed a slight increase (75.4% to 76.6%), the gain was not statistically significant. Furthermore, pure Vision Transformers (ViT) performed significantly worse than CNNs when pre-trained on ImageNet-1k, only matching CNN performance when scaled up with ImageNet-21k pre-training.
Missing the Clinical Mark
Using feature attribution methods, the authors investigated whether self-attention helped models learn the "ABCD" rule used by dermatologists. While the models were relatively successful at identifying "Asymmetry," they almost universally failed to learn "Dermoscopic structures" (the 'D' in ABCD). Even with the supposed advantage of global context, the models did not prioritize the features that human experts find most critical.
Attention Artifacts and Bias
Visualization of global attention maps revealed "spikes" of high attention in the corners or backgrounds of images. This suggests that the models use these areas as "registers" to store information rather than actually focusing on the medical pathology. Additionally, the inclusion of attention did not mitigate the models' reliance on non-medical biases, such as colorful patches in the training data.
Conclusion
The study concludes that simply "plugging in" self-attention mechanisms is not a silver bullet for medical imaging. While attention offers theoretical advantages for global context, it does not inherently force a model to respect clinical logic or ignore spurious correlations. Future research should move beyond layer-swapping and focus on architectural constraints that align model learning with established medical principles.
Summary updated