self-attention
自注意力
An operation in which each element of a sequence (a word or an image patch) gathers information from all the others, weighted by relevance. Convolution covers only a local neighborhood; self-attention links distant regions in one step, at a cost that grows with the square of the element count.
Each element is mapped to three vectors: a query , a key , and a value . How much element attends to element depends on the dot product of and ; after a softmax, these weights average the values. In matrix form, , where dividing by keeps large dot products from saturating the softmax. Multi-head attention runs several such operations in parallel, each free to track a different relation.
Dzmitry Bahdanau and colleagues introduced attention for machine translation in 2014; the 2017 transformer made it the only core operation.
In medical imaging, self-attention lets a model compare the left and right lungs or consult a distant structure directly. But elements form pairs. A 512×512 image cut into 16×16 patches gives 1,024 tokens and about a million pairs, and attention over every voxel of a CT volume is out of the question. Models therefore work on patches or, like the Swin Transformer, restrict attention to local windows.
- Vaswani A, Shazeer N, Parmar N, et al. Attention is all you need. NeurIPS 2017 (arXiv:1706.03762). arxiv.org/abs/1706.03762
- Bahdanau D, Cho K, Bengio Y. Neural machine translation by jointly learning to align and translate. ICLR 2015 (arXiv:1409.0473). arxiv.org/abs/1409.0473
Key works · 6
Landmark2017NeurIPS 2017152,463 citations
Attention Is All You Need
The Transformer uses multihead self-attention to exchange information within a sequence and encoder-decoder attention to condition the translation on its source. The architecture adds positional information and supports parallel training over sequence positions. The authors reported results on WMT English-to-German and English-to-French translation.
SignificanceThe paper established the combination of attention, positional encoding, and feed-forward layers that later vision transformers reused. ViT applies the encoder to image-patch sequences, and UNETR subsequently uses patch-based transformer encoding for volumetric medical segmentation.
arXiv Ashish VaswaniIllia Polosukhin transformerself-attentionencoder–decoder
Landmark2021ICLR 202172,289 citations
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
ViT splits an image into fixed-size patches, projects them to tokens, and adds position embeddings before applying a Transformer encoder. The paper compares different pretraining scales and finds that large-scale pretraining makes the approach competitive on several downstream image classification benchmarks.
SignificanceThe work established a general vision backbone that represents an image as a sequence of patches. UNETR adapts that idea to volumetric segmentation, and Masked Autoencoders use a ViT encoder to learn patch representations by reconstructing missing image content.
arXiv Alexey DosovitskiyNeil Houlsby vision transformertransformerself-attentiontransfer learning
Landmark2021ICCV 202149,078 citations
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
Swin computes attention inside local windows and shifts the partition between successive layers so information can cross window boundaries. Patch merging produces a hierarchy of spatial scales. With a fixed window size, attention computation scales linearly with image area. The paper evaluates classification, detection, and segmentation.
SignificanceHierarchical window attention provided a vision transformer backbone suited to dense prediction at larger image sizes. Swin UNETR adapts this design to three-dimensional medical volumes and uses its multiscale features to segment brain tumors in MRI.
DOI arXiv Full text Ze LiuBaining Guo Swin Transformervision transformerself-attention
Landmark2022CVPR 202237,689 citations
High-Resolution Image Synthesis With Latent Diffusion Models
The authors compressed images with a pretrained autoencoder and ran diffusion in the resulting latent space. Cross-attention allowed inputs such as text or bounding boxes to condition generation. Tests including inpainting, class-conditional synthesis, and super-resolution showed lower computational costs than the corresponding pixel-space diffusion models.
SignificanceLatent diffusion offered a reusable way to reduce the cost of generation while preserving image detail through a separate decoder. Pinaya and colleagues adapted the latent-space approach to three-dimensional brain MRI, where operating directly on full-resolution volumes is particularly demanding.
DOI arXiv Robin RombachBjörn Ommer diffusion modelautoencoderself-attention
Key2023IEEE Transactions on Image Processing1,570 citations
nnFormer: Volumetric Medical Image Segmentation via a 3D Transformer
nnFormer interleaves convolution and attention, uses local and global volumetric attention, and replaces conventional skip fusion with attention between encoder and decoder features. The authors compare performance on three public datasets and assess whether ensembling with nnU-Net provides complementary predictions.
SignificancennFormer provided a concrete design for testing local, global, and skip attention within the same volumetric segmenter. Its released code and weights let researchers compare those design choices with convolutional pipelines and study whether different architectures yield complementary errors.
DOI arXiv Hong-Yu ZhouYizhou Yu transformerself-attentionskip connectionimage segmentation
Key2024Medical Image Analysis1,929 citations
TransUNet: Rethinking the U-Net architecture design for medical image segmentation through the lens of transformers
TransUNet tokenizes convolutional features for a transformer encoder that models global context. The journal version also evaluates a cross-attention decoder that refines candidate regions. It compares encoder and decoder configurations in 2D and 3D on tasks including abdominal organs, pancreatic tumors, and hepatic vessels.
SignificanceThe earlier TransUNet release established a widely cited example of combining convolution and attention for medical segmentation. The journal study makes the roles of context encoding and candidate refinement separately testable by comparing encoder-only, decoder-only, and combined configurations.
DOI arXiv Full text Jieneng ChenYuyin Zhou U-Netvision transformerself-attentionimage segmentationmulti-organ segmentation